-# bf_irc.tcl -- Copyright (C) 2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+# bf_irc.tcl --
#
-# Handle the IRC transport (using picoirc)
+# The Bullfrog IRC transport. This hooks up the Bullfrog GUI
+# to an IRC connection using the picoirc library from tcllib.
+# It can support multiple IRC connections and multiple channels.
#
+# Copyright (C) 2007-2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
package require picoirc 0.5; # tcllib
-# Present a callback interface akin to the picoirc callback.
-# The idea is to have the picoirc application be able to use multiple transports
-# with only the callback being the comms interface.
+# bf_xmpp.tcl -
#
+# The Bullfrog XMPP transport. This file ties up our GUI to the
+# jabberlib library. It presents a callback interface similar
+# to the callback used with picoirc.
+#
+# Copyright (C) 2007-2008 Pat Thoyts <patthoyts@users.sourceforge.net>
+#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# TODO:
#
-# One-to-one chats should show the nick name - either from the
-# additional elements in the message stanza, or the resource if from a
-# groupchat source or just the node.
-# They also don't need a names window.
-# We must echo our own messages in such a window.
-# <message xmlns='jabber:client'
-# to='patthoyts@all.tclers.tk/Bullfrog'
-# type='chat'
-# from='tcl@tach.tclers.tk/rmax'>
-# <body>:)</body>
-# <x xmlns='urn:tkchat:chat' color='660016'/>
-# </message>
+# * One-to-one chats should show the nick name - either from the
+# additional elements in the message stanza, or the resource if
+# from a groupchat source or just the node.
+# * login profiles (persistent)
+# * message store (tied to the message view)
#
package require jlib
package require jlib::connect
proc ::tclers.tk::TestX {room chatwidget} {
proc ::tclers.tk::HistoryMessage {w when nick msg {opts ""} args} {
+ if {$nick eq {}} {return}
+ if {$nick eq "ijchain" && [string match {\*\*\* *} $msg]} { return }
if {[catch {clock scan $when -format "%Y-%m-%dT%H:%M:%S%Z" -gmt 1} time]} {
set time [clock scan $when -format "%Y%m%dT%H:%M:%S" -gmt 1]
}
if {$opts ne ""} {puts stderr "OPTS: '$opts'"}
- #$w insert history "$ts " TIMESTAMP "$nick\t$msg\n" [list NICK-$nick MSG]
- $w message $msg -mark history -nick $nick -time $time ;#-type $type
+ set type normal
+ if {$nick eq "ijchain"} {
+ if {![regexp {^(<.*?>) (.*)$} $msg -> nick msg]} {
+ if {[regexp {^\* ([^ ]+) (.*)$} $msg -> nick msg]} {
+ set type action
+ set nick <${nick}>
+ }
+ }
+ } elseif {[string match "/me *" $msg]} {
+ set msg [string range $msg 4 end]
+ set type action
+ }
+
+ $w chat configure -state normal
+ $w message $msg -mark history -nick $nick -time $time -type $type -tags HISTORY
+ $w chat configure -state normal
}
$chatwidget chat configure -state normal
+ $chatwidget chat tag configure HISTORYMARK -background black -foreground white
+ $chatwidget chat tag configure HISTORY -background "#eee"
catch {$chatwidget chat delete 1.0 "history + 1 line"}
+ $chatwidget chat insert 1.0 \
+ "+++++++++++++++++++++ Loading History +++++++++++++++++++++\n" HISTORYMARK
$chatwidget chat mark set history 1.0
- $chatwidget chat mark gravity history left
- $chatwidget chat insert history "--- end of history ---\n" HISTORYMARK
- $chatwidget chat mark gravity history right
$chatwidget chat configure -state disabled
gethistory $room \
-progress [namespace code [list TestProgress .htest.f.status.progress]] \
# message and clicking a message triggers the display in the lower
# section
#
+# See the file "license.terms" for information on usage and redistribution of
+# this file, and for a DISCLAIMER OF ALL WARRANTIES.
+#
# -------------------------------------------------------------------------
# TODO:
# - delete