# Emacs, this is -*- Mode: Tcl -*-
#
# This is an example configuration file for tkirc2 with a lot of comments.
#
# Last modified:    2000-08-26 (atte)


#############################################################################
#                                                                           #
#  Copyright (C) 1996-2000  Andreas Gelhausen <atte@netsplit.de>            #
#                                                                           #
#  This program is free software; you can redistribute it and/or modify     #
#  it under the terms of the GNU General Public License as published by     #
#  the Free Software Foundation; either version 2 of the License, or        #
#  (at your option) any later version.                                      #
#                                                                           #
#  This program is distributed in the hope that it will be useful,          #
#  but WITHOUT ANY WARRANTY; without even the implied warranty of           #
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            #
#  GNU General Public License for more details.                             #
#                                                                           #
#  You should have received a copy of the GNU General Public License along  #
#  with this program; if not, write to the Free Software Foundation, Inc.,  #
#  59 Temple Place - Suite 330, Boston, MA  02111-1307, USA                 #
#                                                                           #
#############################################################################


#  ####   ###  ####  #####     ###  #   # #####
#  #   # #   # #   #   #      #   # ##  # #
#  ####  ##### ####    #      #   # # # # ###
#  #     #   # #  #    #      #   # #  ## #
#  #     #   # #   #   #       ###  #   # #####
#
#
#  This part includes the basics of tkirc's configuration. Please
#  read (and maybe edit) it before you start tkirc with these
#  parameters!


# Max entries of the history you can use with cursor up and down.
set history_max 32

# Max number of lines you will see in a text field.
set lines_max   512

# Where can tkirc find the ircII client?
set ircpath     "irc"

# It's also possible to set the width of the margin. This value only 
# takes effect, if 'use_margin' is set to '1'.
set margin_size(*)        70
set margin_size(0)       100

# If you also want to see the beeps, you can use 'beeptext'.
# Here some examples for different text styles:
#set beeptext "\x02¤\x02" ; # \x02 to turn on/off 'bold'
set beeptext "\x16¤\x16" ; # \x16 to turn on/off 'reverse'
#set beeptext "\x1f¤\x1f" ; # \x1f to turn on/off 'underlined'

# The variable 'escape_sign' allows you to choose your own
# escape-sign. Default value is "^". You can use escape-codes and
# special characters with it.
# Usage:
#        ^b : bold            ^u : underlined    ^r : reverse
#        ^s : special         ^g : beep
#
#        ^c##: colors (## is a decimal value)
#        ^x##: extra signs (## is a hex value)
set escape_sign "^"

# The following list allows you to set your own key bindings for
# tkirc's entry widgets. If you don't know the exact expression for
# the key bindings, add the line '{<KeyPress> {+puts stdout "%K"}}'
# and start tkirc within a xterm. Then you will see the correct
# expressions for all pressed keys.
set entry_bindings {
    {<Control-u> {%W delete 0 end}}
    {<Alt-Shift-exclam> {%W insert insert "¡"}}
    {<<adiaeresis>> {%W insert insert "ä" ; break}}
    {<<udiaeresis>> {%W insert insert "ü" ; break}}
    {<<odiaeresis>> {%W insert insert "ö" ; break}}
    {<<Adiaeresis>> {%W insert insert "Ä" ; break}}
    {<<Udiaeresis>> {%W insert insert "Ü" ; break}}
    {<<Odiaeresis>> {%W insert insert "Ö" ; break}}
    {<<ssharp>> {%W insert insert "ß" ; break}}
    {<Control-asciicircum> {MsgHistoryUp "[string index "%W" 4]"}}
}

# Do you want to see one netsplit-message instead of many 
# signoff-messages on a detected netsplit?
set react_to_netsplits  1

# If you want an alarm on possible channel takeovers, then set
# 'react_to_takeover' to something different than '0'. tkirc will
# sound an alarm, if more than or exact <value of takeover_users> users
# of the same host join a channel in <value of takeover_period> seconds.
# tkirc neither bans nor kicks for itself. You have to confirm each
# action against channel takeovers within the request window.
# The elements of 'takeover_kick_reasons' are used as messages for the
# many kick-commands on a detected channel-takeover-try.
# The host address looks like <element1>.<element2>... If you have
# some elements (like 'slip-12-34-56' for example), you can add a
# pattern to 'takeover_star_patterns' (e.g. 'slip*'). Matching
# address elements are set to '*' within the address to ban.
# tkirc scans the elements from left to right. If an address element
# don't match any pattern of 'takeover_star_patterns', the other
# elements won't be compared.
set react_to_takeover       1
set takeover_users          3
set takeover_period       240
set takeover_kick_reasons {
    "Tschüs!" "Ciao!" "Bye!" "See you!" "Bis später!" "Ade!" "Tschö!"
}
set takeover_star_patterns {
    "slip*" "ppp*" "dial*" "kiosk*"
}

# Some CTCP-commands allow automatic response of your ircII. tkirc
# will try to prevent that ircII floods the IRC-server, if you set
# 'react_to_ctcp_flood' to '1'. If flooding from a certain host is
# detected, all CTCPs and INVITEs from that host are ignored for
# <value of host_flood_ignore_period> seconds. On flooding from
# many different users/hosts tkirc ignores _all_ CTCPs and INVITEs
# for <value of global_flood_ignore_period> seconds.
set react_to_ctcp_flood          1
set host_flood_ignore_period   300
set global_flood_ignore_period 120

# Here you can choose your preferred nicknames.
set preferred_nicknames {
    "bart" "lisa" "maggie"
}

# Do you have channels you often join?
set preferred_channels {
    "#freebsd" "#linux" "#netbsd" "#netsplit" "#tkirc"
}

# Preferred values for the signoff command.
set preferred_signoffmessages {
    "End of transmission" "Local kill from operator"
    "Idle time limit exceeded"
}

# Preferred values for the part or leave command.
set preferred_partmessages {
    "I´ll be back!" "Bis später!"
}

# Preferred topics for your channels.
set preferred_topics {
    "Please use your own default topic! =:^)"
    "Where do you want to join today?"
}

# Here you can set some reasons for the away command.
set preferred_awayreasons {
    "be right back" "be back later" "busy working"
}

# If you want to kick someone, you can choose between the
# following default kick messages.
set preferred_kickreasons {
    "Ciao!" "Bye!" "Best wishes!" "Try it again please!"
    "Play outside!"
}

# Some servers and their port numbers...
set preferred_servers {
    {"irc.server.com"                   6667 "Example server #1"}
    {"irc.server.net"                   6668 "Example server #2"}
    {"irc.server.org"                   6667 "Example server #3"}
}

# New versions of the IRC server doesn't transmit away-messages
# to other servers and users connected there. If someone wants to
# send you a private message and he is connected to another IRC 
# server than you, he won't receive an away-message from you. Set 
# variable 'send_away_notice' to '1' and each user who sends you
# you a private message/action will receive a notice like
# "+nick+ nick is away: <awayreason>". The awayreason is the same
# you specified through command '/away'. The other user just 
# receive this away-notice from you once in a quarter hour except
# you set a new away-message through command '/away'.
set send_away_notice 1

# Many people forget to mark or unmark themselves away. The following
# variables allows you to comission tkirc to do this job.
# Set 'auto_mark_away' to something different than '0' and after 
# <auto_away_period> seconds tkirc will automatically mark you away
# with the message "<auto_away_text>".
# For variable 'auto_unmark_away' you can choose between the following
# 3 values:
#        0 : You will never automatically be unmarked.
#        1 : You will only be unmarked after pressing <Return>, if 
#            tkirc has _automatically_ marked you away before.
#        2 : Press <Return> and you will always be unmarked, if
#            you was marked away before.
set auto_mark_away    1
set auto_away_period  1200
set auto_away_text    "automatically marked as being away after 1200 seconds"
set auto_unmark_away  1

# If you have more than one channel joined within one of tkirc's
# windows, you can choose, whether you want to see the channel's
# name on each received/sent message or just for messages of the
# background channel.
set show_only_background_channels 1

# Which browser or script do you want to start by clicking on a
# highlighted Uniform Resource Locator (URL)?
set on_urlclick {~/.tkirc2/netscape.sh "$url"}

# Which tool/procedure do you want to execute by clicking on a
# highlighted messageID?
#set on_msgclick {echo "tkirc2: You have selected message id '$msgid'."}
set on_msgclick {StringRequest "Which newsserver do you want to use?" "news.server.net" "Cancel|" "Show article|showarticle \"\$string\" {$msgid}"}

proc on_url_detect { } {
  global irc on_args

  # Do NOT use one of tkirc's print-procedures here to prevent
  # infinite loops! (print2crap, print2text, etc.)

  exec echo "[longdate]  $on_args(url)" >> ~/.tkirc2/IrcLog.urls
}

proc on_msgid_detect { } {
  global irc on_args

  # Do NOT use one of tkirc's print-procedures here to prevent
  # infinite loops! (print2crap, print2text, etc.)

  exec echo "[longdate]  $on_args(msgid)" >> ~/.tkirc2/IrcLog.msgids
}

# If someone joins and leaves a channel within <channelhop_period> seconds,
# the procedure 'on_channelhop' will be executed.
set channelhop_period 3000

proc on_channelhop { } {
  global irc on_args

  # do something
}

# The TAB-key completes the nicks of the current channel and the
# elements of this list.
set words_to_complete {
  "/away " "/baninfos " "/clear" "/clearall" "/ctcp " "/describe "
  "/debug " "/join " "/kick * " "/leave *" "/lusers" "/msg " "/names "
  "/notify " "/quit " "/search " "/splits" "/suspect " "/topic " "/whois "
  "#freebsd" "#linux" "#netbsd" "#netsplit"
}

# If neither a nick nor an element of 'words_to_complete' could be found
# for completion, this list of aliases will be searched. Through the usage
# of TAB the certain alias will be replaced. Each element of the following
# list includes the alias and its replacement:
set tab_aliases {
    {"USA" "United States of Amerika"}
    {"FRG" "Federal Republic of Germany"}
    {"rose" "---<-'-@"}
    {"tkirc" "http://www.netsplit.de/tkirc2/"}
}

# If the just completed nick is the first word in your command 
# line, this suffix will be added.
set nick_completion_suffix ": "

# Each kind of text-message can have its own text style.
# The elements of the follwing list include regular expression,
# text-style, command and comment.
#
# Example: Set command to "bell" and you will get a beep on each
#          message of that kind.
set user_styles {
  {
    {^(\*|\+|\*\*|\=)».*}
    {-foreground #00aa00}
    {}
    {# send private message/notice/action}
  }
  {
    {^((<|-)$me(>|-\	|»|\+)|\* $me(	|»|\+)).*}
    {-foreground #007700}
    {}
    {# send message/notice/action to channel}
  }
  {
    {^(\*|\+|\*\* |\=)[^ *+].*}
    {-foreground #dd0000}
    {}
    {# receive private message/notice/action}
  }
  {
    {^(\*\*\*|\[ notify \]).+ (is here|was here).*$}
    {-foreground #cc9900}
    {}
    {# notify messages}
  }
  {
    {^(\*\*\*|\[ suspect \]).+ (is suspect|was suspect).*$}
    {-foreground #996600}
    {}
    {# suspect messages}
  }
  {
    {^(.*[^a-zA-Z0-9]|)($me|ircii)(|[^a-zA-Z0-9].*)$}
    {-foreground #aa0000}
    {}
    {# my/your nickname or ircII}
  }
  {
    {^(\( |)([0-9][0-9][0-9])(| \)).*}
    {-foreground #440044}
    {}
    {# numerics}
  }
  {
    {^(\*\*\*|\[ signoff \]).+ has signed off \(([^ .]+\.)+[^ .]+ ([^ .]+\.)+[^ ]+\)$}
    {-foreground #ff5500}
    {}
    {# faked netsplit-signoff}
  }
  {
    {^(\*\*\*.|\[ )Net(split|join).*} {-foreground #ff5500}
    {}
    {# netsplit or netjoin}
  }
  {
    {^(\×\×\×|\+\+\+|\[ (alert|error|failure|note|warning) \]).*}
    {-foreground #aa0000}
    {}
    {# this program wants to tell you something}
  }
  {
    {^(\*\*\*|\[ ).*}
    {-foreground #000066}
    {}
    {# three stars messages}
  }
}


# With procedure 'write2irc' you can directly send any texts to
# ircII. But if you directly send "/join #test" to ircII, tkirc has
# NO information about it. Therefore it won't know the window for
# the channel. You should prefer procedure 'send2tkirc'!
#
# The usage of procedure 'send2tkirc' will have the same
# effect as typing a command within tkirc's commandline. 
#
# 'send2tkirc' needs two parameters:
#       1. window number
#       2. text to send
#
# To send a message directly to your ircII you can use
# procedure 'write2irc'.
#
# 'write2irc' needs two parameters too:
#       1. number of ircII (See window titles! Example: "(#0)")
#       2. text to send


# tkirc doesn't pay regards to file '~/.ircrc', because ircII
# will be executed with option '-q'. If you want to execute 
# some commands of 'ircII' after starting, you have to do it
# here within the procedures 'on_tkircstart', 'on_ircIIstart' and
# 'on_connect'.
#
# 'on_tkircstart' will be executed just after opening window 0.
# At this moment ircII is not running and therefore you don't have
# a connection to an IRC-server! Logfiles and additional windows can
# be opened here for example.
proc on_tkircstart { } {
  global irc margin on_args
  set margin(text) "example"
  write2crap $on_args(irc) "*** event='tkircstart'"
}

# Procedure 'on_ircIIstart' will always be executed just behind starting
# ircII. Here you should set some of ircII's variables and define your
# aliases. You are not connected to an IRC-server at this moment. Please
# see the examples below!
proc on_ircIIstart { } {
  global irc margin on_args
  set margin(text) "example"
  write2crap $on_args(irc) "*** event='ircIIstart'"

  write2irc $on_args(irc) "/set DISPLAY OFF"
  write2irc $on_args(irc) "/set TRANSLATION LATIN_1"
  write2irc $on_args(irc) "/set SHOW_AWAY_ONCE on"

## How to use the timer:
#  write2irc $on_args(irc) {/on #^timer 0 "*:00" time}

  write2irc $on_args(irc) {/alias think /say . o O \( $0- \)}
  write2irc $on_args(irc) {/alias nobitchx /mode * +b-b *%C=%n!*@* *%C=%n!*@*}
  write2irc $on_args(irc) "/set DISPLAY ON"
}

# 'on_connect' will be executed just before you usually get the 'Message
# Of The Day' from your IRC-server. Here you can set your usermodes and
# join your preferred channels.
proc on_connect { } {
  global irc margin on_args
  set margin(text) "example"
  write2crap $on_args(irc) "*** event='connect'"

## Do you want to be invisible?
  write2irc $on_args(irc) "/umode +i"

## Maybe you want to join channel #tkirc in window 0:
#  send2tkirc 0 "/join #tkirc"
}


#  ##### #   # #####    ##### #   # ####
#    #   #   # #        #     ##  # #   #
#    #   ##### ###      ###   # # # #   #
#    #   #   # #        #     #  ## #   #
#    #   #   # #####    ##### #   # ####
