Advertisement
Guest User

tiagopb

a guest
Nov 11th, 2009
300
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.46 KB | None | 0 0
  1. Index: notify.tcl
  2. ===================================================================
  3. --- notify.tcl (revision 11780)
  4. +++ notify.tcl (working copy)
  5. @@ -27,9 +27,15 @@
  6. # * Code cleaning
  7. # * Bumped to version 1.4
  8. #
  9. +#
  10. +#
  11. +#
  12. +# 2009-11-10 :
  13. +# * Added support to notify received messages when amsn is not focused. (by tiagopb at gmail dot com)
  14. +# * Added support to display nickname instead of e-mail (by tiagopb at gmail dot com)
  15. +#
  16.  
  17.  
  18. -
  19. namespace eval ::notify {
  20. # variables
  21. variable config
  22. @@ -65,6 +71,7 @@
  23. proc registerEvents { } {
  24. # ::plugins::RegisterEvent "name" type localProc
  25. ::plugins::RegisterEvent "Notify" ChangeState userChangeState
  26. + ::plugins::RegisterEvent "Notify" chat_msg_received new_message
  27. #::plugins::RegisterEvent "Notify" contactStateChange userChangeState
  28. #::plugins::RegisterEvent "Notify" UserConnect userConnected
  29. }
  30. @@ -74,8 +81,10 @@
  31. notify_send {notify-send}
  32. enable {}
  33. pic_size {32}
  34. - notify_header {aMSN: %email}
  35. + notify_header {aMSN: %dispname}
  36. notify_busy {1}
  37. + notify_msg {1}
  38. + show_nick {1}
  39. debug {0}
  40. }
  41.  
  42. @@ -85,6 +94,8 @@
  43. [list str "Pic size" pic_size ] \
  44. [list str "Header" notify_header ] \
  45. [list bool "Show notifications when busy" notify_busy ] \
  46. + [list bool "Notify messages when unfocused" notify_msg ] \
  47. + [list bool "Display nicknames instead of e-mail" show_nick ] \
  48. [list bool "Debug" debug ] \
  49. ]
  50. }
  51. @@ -208,6 +219,7 @@
  52. #log "email check 10"
  53. }
  54. }
  55. +
  56. }
  57. #log "exec_notify after email check"
  58. if { "$category" != "" } {
  59. @@ -220,7 +232,14 @@
  60. if { $config(notify_header) == "" } {
  61. set config(notify_header) "aMSN"
  62. }
  63. - set title [ string map [list "%email" "$email" ] $config(notify_header) ]
  64. +
  65. + if { $config(show_nick) == 1} {
  66. + set dispname [::abook::getDisplayNick $email]
  67. + } else {
  68. + set dispname $email
  69. + }
  70. +
  71. + set title [ string map [list "%dispname" "$dispname" ] $config(notify_header) ]
  72. #log "plop 1"
  73.  
  74. #log "plop 2"
  75. @@ -320,6 +339,20 @@
  76. exec_notify "$txt" "$email"
  77. }
  78.  
  79. +
  80. + proc new_message {event evpar} {
  81. + variable config
  82. + upvar 2 $evpar newvar
  83. + upvar 2 $newvar(msg) msg
  84. + upvar 2 $newvar(user) user
  85. + set email $user
  86. + if { $config(notify_msg) == 1 && ([focus] == "")} {
  87. + exec_notify "$msg" "$email"
  88. + }
  89. + }
  90. +
  91. +
  92. +
  93. # UNUSED
  94. #proc userConnected { event epvar } {
  95. # log "userConnected called"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement