Index: notify.tcl =================================================================== --- notify.tcl (revision 11780) +++ notify.tcl (working copy) @@ -27,9 +27,15 @@ # * Code cleaning # * Bumped to version 1.4 # +# +# +# +# 2009-11-10 : +# * Added support to notify received messages when amsn is not focused. (by tiagopb at gmail dot com) +# * Added support to display nickname instead of e-mail (by tiagopb at gmail dot com) +# - namespace eval ::notify { # variables variable config @@ -65,6 +71,7 @@ proc registerEvents { } { # ::plugins::RegisterEvent "name" type localProc ::plugins::RegisterEvent "Notify" ChangeState userChangeState + ::plugins::RegisterEvent "Notify" chat_msg_received new_message #::plugins::RegisterEvent "Notify" contactStateChange userChangeState #::plugins::RegisterEvent "Notify" UserConnect userConnected } @@ -74,8 +81,10 @@ notify_send {notify-send} enable {} pic_size {32} - notify_header {aMSN: %email} + notify_header {aMSN: %dispname} notify_busy {1} + notify_msg {1} + show_nick {1} debug {0} } @@ -85,6 +94,8 @@ [list str "Pic size" pic_size ] \ [list str "Header" notify_header ] \ [list bool "Show notifications when busy" notify_busy ] \ + [list bool "Notify messages when unfocused" notify_msg ] \ + [list bool "Display nicknames instead of e-mail" show_nick ] \ [list bool "Debug" debug ] \ ] } @@ -208,6 +219,7 @@ #log "email check 10" } } + } #log "exec_notify after email check" if { "$category" != "" } { @@ -220,7 +232,14 @@ if { $config(notify_header) == "" } { set config(notify_header) "aMSN" } - set title [ string map [list "%email" "$email" ] $config(notify_header) ] + + if { $config(show_nick) == 1} { + set dispname [::abook::getDisplayNick $email] + } else { + set dispname $email + } + + set title [ string map [list "%dispname" "$dispname" ] $config(notify_header) ] #log "plop 1" #log "plop 2" @@ -320,6 +339,20 @@ exec_notify "$txt" "$email" } + + proc new_message {event evpar} { + variable config + upvar 2 $evpar newvar + upvar 2 $newvar(msg) msg + upvar 2 $newvar(user) user + set email $user + if { $config(notify_msg) == 1 && ([focus] == "")} { + exec_notify "$msg" "$email" + } + } + + + # UNUSED #proc userConnected { event epvar } { # log "userConnected called"