Hello. This is my aMSNLogPlus plugin, version 1. What does it do? It logs: - short nicks instead of long nicks - nick changing - psm changing - status changing - music changing
I have others ideas but for the moment i want to know if my diffs will accepted, then i want to fix some possible bugs. In diffs.txt there is the code relative to event plugins. I have tried to make my plugin translatable but it's not work, please can someone check the reason? Thanks. Square87
Index: protocol.tcl
===================================================================
--- protocol.tcl (revision 8074)
+++ protocol.tcl (working copy)
@@ -1174,6 +1174,7 @@
save_config
::abook::saveToDisk
# ::Event::fireEvent myPSMChange protocol
$userlogin
+ ::plugins::PostEvent myPSMChange evPar
}
} else {
#Do nothing
@@ -1192,6 +1193,7 @@
if {$enabled == 1} {
set currentMedia "aMSN\\0$type\\01\\0$format\\0[join
$args \\0]\\0"
+ ::plugins::PostEvent changeCurrentMedia evPar
} else {
set currentMedia ""
}
@@ -3744,6 +3746,8 @@
send_dock STATUS [::MSN::myStatusIs]
#an event used by guicontactlist to
know when we changed our nick
::Event::fireEvent myNickChange protocol
+ #an event plugin used by amsnlogplus
+ ::plugins::PostEvent myNickChanged evPar
}
::abook::saveToDisk
}
@@ -3771,9 +3775,19 @@
set psm ""
set currentMedia ""
}
- ::abook::setVolatileData $contact PSM [::sxml::replacexml
[encoding convertfrom utf-8 $psm]]
- ::abook::setVolatileData $contact currentMedia
[::sxml::replacexml [encoding convertfrom utf-8 $currentMedia]]
+ if {$psm != [::abook::getVolatileData $contact PSM]} { ;#it
means: if newpsm != oldpsm
+ ::abook::setVolatileData $contact PSM
[::sxml::replacexml [encoding convertfrom utf-8 $psm]]
+ }
+
+ set mediachanged 0
+ set old_media [::abook::getVolatileData $contact currentMedia]
+ set currentMedia [encoding convertfrom utf-8 $currentMedia]
+ if {$currentMedia != $old_media} {
+ ::abook::setVolatileData $contact currentMedia
[::sxml::replacexml $currentMedia]
+ set mediachanged 1
+ }
+
foreach chat_id [::ChatWindow::getAllChatIds] {
if { $chat_id == $contact } {
::ChatWindow::TopUpdate $chat_id
@@ -3787,6 +3801,9 @@
}
}
::Event::fireEvent contactPSMChange protocol $contact
+ set evPar(mediachanged) mediachanged
+ set evPar(contact) contact
+ ::plugins::PostEvent contactPSMChanged evPar
}
method handleNOT { command payload } {
Index: loging.tcl
===================================================================
--- loging.tcl (revision 8074)
+++ loging.tcl (working copy)
@@ -250,6 +250,10 @@
puts -nonewline [LogArray $email get]
"\|\"LRED\[[trans luclosedwin [clock format [clock seconds] -format "%d %b %Y
%T"]]\]\n\n"
}
close [LogArray $email get]
+
+ set evPar(who) who
+ set evPar(email) email
+ ::plugins::PostEvent stoplog evPar
}
LogArray $email unset
ConfArray $email unset
@@ -277,6 +281,15 @@
set user [trans deliverfail]
}
+ set evPar(chatid) chatid
+ set evPar(user) user
+ set evPar(msg) msg
+ set evPar(fontformat) fontformat
+ set evPar(failed) failed
+ set evPar(color) color
+ set evPar(OIMStamp) OIMStamp
+ ::plugins::PostEvent put_log evPar
+
if {[::OIM_GUI::IsOIM $chatid] || $OIMStamp != 0 } {
::log::WriteLog $chatid "\|\"LITA$user :\|\"L$color
$msg\n" 0 $chatid $OIMStamp
} else {
@@ -341,10 +354,13 @@
if { $fileid != 0 } {
if {[::OIM_GUI::IsOIM $email] || $OIMStamp !=
0} {
puts -nonewline $fileid
"\|\"LRED\[[trans lconvstartedOIM [clock format [clock seconds] -format "%d %b
%Y %T"]]\]\n"
+ startlog_plus $email $fileid
} elseif { $conf == 0 } {
puts -nonewline $fileid
"\|\"LRED\[[trans lconvstarted [clock format [clock seconds] -format "%d %b %Y
%T"]]\]\n"
+ startlog_plus $email $fileid
} else {
puts -nonewline $fileid
"\|\"LRED\[[trans lenteredconf $email [clock format [clock seconds] -format "%d
%b %Y %T"]] \(${users}\) \]\n"
+ startlog_plus $user_list $fileid
}
if {$OIMStamp == 0 } {
puts -nonewline $fileid
"\|\"LGRA[timestamp] $txt"
@@ -355,6 +371,12 @@
}
}
+ #this proc is used for amsnlogplus plugin
+ proc startlog_plus {email fileid} {
+ set evPar(email) email
+ set evPar(fileid) fileid
+ ::plugins::PostEvent start_log evPar
+ }
#///////////////////////////////////////////////////////////////////////////////
# LeavesConf (usr_name user_list)
@@ -368,7 +390,10 @@
foreach user_info $user_list {
set fileid [LogArray [lindex $user_info 0] get]
if { $fileid != 0 } {
+ set usr_name2 $usr_name ;#because
amsnlogplus changes the usr_name value
+ set evPar(usr_name) usr_name
puts -nonewline $fileid
"\|\"LRED\[[trans lleftconf $usr_name]\]\n"
+ set usr_name $usr_name2
}
if { [llength $user_list] == 1 } {
ConfArray [lindex $user_info 0] set 3
@@ -393,7 +418,11 @@
set login [lindex $user_info 0]
set fileid [LogArray $login get]
if { $login != $usr_name && $fileid != 0} {
+ set usr_name2 $usr_name ;#because
amsnlogplus changes the usr_name value
+ set evPar(usr_name) usr_name
+ ::plugins::PostEvent joins_conf evPar
puts -nonewline $fileid
"\|\"LRED\[[trans ljoinedconf $usr_name]\]\n"
+ set usr_name $usr_name2
}
}
}
@@ -1559,6 +1588,7 @@
set fileid [LogArray $email get]
if { $fileid != 0 } {
puts -nonewline $fileid
"\|\"LRED\[[trans lconvstarted [clock format [clock seconds] -format "%d %b %Y
%T"]]\]\n"
+ startlog_plus $email $fileid
puts -nonewline $fileid
"\|\"LGRA[timestamp]\|\"LGRE $txt\n"
}
} else {
Index: gui.tcl
===================================================================
--- gui.tcl (revision 8074)
+++ gui.tcl (working copy)
@@ -5330,7 +5330,7 @@
#///////////////////////////////////////////////////////////////////////
proc change_name_ok {} {
set new_name [.change_name.f.nick_entry get]
- if {$new_name != ""} {
+ if {$new_name != "" && [::abook::getContactData myself MFN] !=
$new_name} {
if { [string length $new_name] > 130} {
set answer [::amsn::messageBox [trans longnick] yesno
question [trans confirm]]
if { $answer == "no" } {
Index: abook.tcl
===================================================================
--- abook.tcl (revision 8074)
+++ abook.tcl (working copy)
@@ -431,6 +431,7 @@
set user_data(raw_nick) $data
#post event for amsnplus
set evPar(data) data
+ set evPar(user_login) user_login
::plugins::PostEvent parse_nick evPar
set user_data(nick) $data
amsnlogplus.tar.gz
Description: GNU Zip compressed data
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Amsn-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/amsn-devel
