Square87 thanks for looking at the code. This is a fairly large patch
so near to a release.. I have work today, so I can't do this for you,
but it may be better to split each patch into a separate diff.. Then
it will be easy to review your changes.. I will take time to look at
this, but as I said I can't do it today..
- Tom
On 16 Dec 2007, at 08:02, Youness Alaoui wrote:
> can someone review this.. cause I can't.. it's just too much stuff
> in there...
>
> On Sat, Dec 15, 2007 at 03:29:52PM +0000, square87 wrote:
>> Hello
>> I found some "strange" behaviors in the proc "cmsn_change_state" of
>> protocol.tcl.
>> I write a patch. I (try to) explain what i changed and why.
>>
>> The diff file is the result of "svn diff";
>> The txt file is "the diff file without old differences".
>>
>> --------------
>> In the original version there is:
>>
>> if {$user_name != [::abook::getNick $user]} {
>>
>> So $user_name it's the original name of an user that we receive
>> from the
>> server, we compare it with the "old" nickname. But...
>> [::abook::getNick
>> $user] return a parsed nick that it could be different from the
>> first one,
>> for example: if you are using colored nicks, except when the user
>> delete
>> style from his nick so original nick is equal to parsednick, but
>> then that
>> code is not considered.
>> for this i changed it in:
>> if { $user_name != [::abook::getContactData $user nick]} {
>>
>> ------------
>>
>> Then I commented "set state_no...." because it is not used anymore,
>> it is
>> useless.
>>
>> -----------
>> Then i removed switch cases because they are useless we already
>> have all
>> infos, just add: set status "[trans [::MSN::stateToDescription
>> $substate]]"
>> -----------
>>
>> Then i do some codes clean
>> from: set maxw [expr {([::skin::getKey notifwidth]-53)*2} ]
>> to: when "if" is closed
>> this part of code is necessary only if $status_changed is equal to
>> 1. So
>> just put this check at the top (from: set maxw....)
>>
>> ------
>> Then i did update the "newPic" part.
>> Now there is a strange behavoiur.
>> Before to check if oldpic != newdp
>> there is: ::abook::setContactData $user displaypicfile $newPic
>> it means that you are upgrading the "name" of the actually pic,
>> even if
>> newdp == oldpic... but anyway... look in the code after and think
>> the case:
>> lazypicretrieval is 0 so you can go in the "elseif" condition to
>> update the
>> userDP but you can do it only if you are not hidden else you cannot
>> do
>> nothing... (think when you choose to login as "invisibile"....)
>> Now go online, your user change status so also DP is checked but
>> now $oldpic
>> is equal to $newpic so the DP is not upgraded... until he doesn't
>> change
>> it...
>>
>> So i improve that behavior in particolar "::abook::setContactData
>> $user
>> displaypicfile $newPic " is called only if it is possible to load
>> the newdp
>> and i added a new case: when an user change his DP and you are
>> hidden or he
>> is blocked or whatever -> search first in the cache if there is
>> already that
>> DP load it.
>> --------
>>
>> Ok this was a summary of what i done. If you have problem or
>> question or do
>> you think that something is useless tell me before to commit... if
>> you want
>> to commit :P
>>
>> Sorry for my English
>> Thanks, bye.
>> Square87
>
>> Index: protocol.tcl
>> ===================================================================
>> --- protocol.tcl (revisione 9113)
>> +++ protocol.tcl (copia locale)
>> @@ -4856,11 +4860,9 @@
>> }
>>
>> if {$user_name == ""} {
>> - set user_name [::abook::getNick $user]
>> - }
>> -
>> -
>> - if {$user_name != [::abook::getNick $user]} {
>> + set user_name [::abook::getContactData $user nick]
>> + set nick_changed 0
>> + } elseif { $user_name != [::abook::getContactData $user nick]} {
>> #Nick differs from the one on our list, so change it
>> #in the server list too
>> ::abook::setContactData $user nick $user_name
>> @@ -4889,7 +4891,7 @@
>>
>> set custom_user_name [::abook::getDisplayNick $user]
>>
>> - set state_no [::MSN::stateToNumber $substate ]
>> +# set state_no [::MSN::stateToNumber $substate ] ;#actually this
>> var is never used.
>>
>>
>> #alarm system (that must replace the one that was before) - KNO
>> @@ -4903,115 +4905,63 @@
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all ondisconnect] == 1) } {
>> run_alarm all $user $custom_user_name [trans
>> disconnect
>> $custom_user_name]
>> }
>> -
>> } else {
>> + set status "[trans [::MSN::stateToDescription
>> $substate]]"
>> if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user onstatus] == 1) } {
>> - switch -exact [lindex $recv 1] {
>> - "NLN" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans online]]"
>> - }
>> - "IDL" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans away]]"
>> - }
>> - "BSY" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans busy]]"
>> - }
>> - "BRB" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans rightback]]"
>> - }
>> - "AWY" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans away]]"
>> - }
>> - "PHN" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans onphone]]"
>> - }
>> - "LUN" {
>> - run_alarm $user $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans gonelunch]]"
>> - }
>> - }
>> + run_alarm $user $user $custom_user_name "[trans
>> changestate
>> $custom_user_name $status]"
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all onstatus] == 1)} {
>> - switch -exact [lindex $recv 1] {
>> - "NLN" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans online]]"
>> - }
>> - "IDL" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans away]]"
>> - }
>> - "BSY" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans busy]]"
>> - }
>> - "BRB" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans rightback]]"
>> - }
>> - "AWY" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans away]]"
>> - }
>> - "PHN" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans onphone]]"
>> - }
>> - "LUN" {
>> - run_alarm all $user
>> $custom_user_name "[trans changestate
>> $custom_user_name [trans gonelunch]]"
>> - }
>> - }
>> + run_alarm all $user $custom_user_name "[trans
>> changestate
>> $custom_user_name $status]"
>> }
>> }
>> }
>> #end of alarm system
>>
>> + if { $state_changed } {
>> + set maxw [expr {([::skin::getKey notifwidth]-53)*2} ]
>> + set short_name [trunc $custom_user_name . $maxw splainf]
>>
>> - set maxw [expr {([::skin::getKey notifwidth]-53)*2} ]
>> - set short_name [trunc $custom_user_name . $maxw splainf]
>> -
>> - #User logsout
>> - if {$substate == "FLN"} {
>> -
>> - if { $state_changed } {
>> + #User logsout
>> + if {$substate == "FLN"} {
>> #Register last logout, last seen and notify it in the
>> events
>> ::abook::setAtomicContactData $user [list last_logout
>> last_seen] \
>> - [list [clock format [clock seconds] -format "%D -
>> %H:%M:
>> %S"] [clock format [clock seconds] -format "%D - %H:%M:%S"]]
>> + [list [clock format [clock seconds] -format "%D -
>> %H:%M:%S"]
>> [clock format [clock seconds] -format "%D - %H:%M:%S"]]
>> ::log::event disconnect $custom_user_name
>> - }
>> -
>> - # Added by Yoda-BZH
>> - if { ($remote_auth == 1) && $state_changed } {
>> - set nameToWriteRemote "$user_name ($user)"
>> - write_remote "** $nameToWriteRemote [trans logsout]"
>> event
>> - }
>> -
>> - if { ($state_changed || $nick_changed) &&
>> - (([::config::getKey notifyoffline] == 1 &&
>> - [::abook::getContactData $user notifyoffline -1] != 0) ||
>> - [::abook::getContactData $user notifyoffline -1] == 1) } {
>> - #Show notify window if globally enabled, and not
>> locally
>> disabled, or if just locally enabled
>> - ::amsn::notifyAdd "$short_name\n[trans logsout]." ""
>> offline
>> offline $user
>> - }
>> -
>> - # User was online before, so it's just a status change, and it's
>> not
>> - # an initial state notification
>> - } elseif {[::abook::getVolatileData $user state FLN] != "FLN" &&
>> [lindex $recv 0] != "ILN" } {
>> -
>> - if { $state_changed } {
>> +
>> + # Added by Yoda-BZH
>> + if { $remote_auth == 1 } {
>> + set nameToWriteRemote "$user_name ($user)"
>> + write_remote "** $nameToWriteRemote [trans
>> logsout]" event
>> + }
>> +
>> + if { ([::config::getKey notifyoffline] == 1 &&
>> + [::abook::getContactData $user notifyoffline -1] != 0)
>> ||
>> + [::abook::getContactData $user notifyoffline -1] == 1 }
>> {
>> + #Show notify window if globally enabled, and
>> not locally
>> disabled, or if just locally enabled
>> + ::amsn::notifyAdd "$short_name\n[trans
>> logsout]." "" offline
>> offline $user
>> + }
>> +
>> + # User was online before, so it's just a status change, and
>> it's
>> not
>> + # an initial state notification
>> + } elseif {[::abook::getVolatileData $user state FLN] != "FLN"
>> &&
>> [lindex $recv 0] != "ILN" } {
>> +
>> #Notify in the events
>> ::log::event state $custom_user_name
>> [::MSN::stateToDescription
>> $substate]
>> - }
>> +
>> + # Added by Yoda-BZH
>> + if { $remote_auth == 1 } {
>> + set nameToWriteRemote "$user_name ($user)"
>> + write_remote "** [trans changestate
>> $nameToWriteRemote [trans
>> [::MSN::stateToDescription $substate]]]" event
>> + }
>>
>> - # Added by Yoda-BZH
>> - if { ($remote_auth == 1) && ($state_changed || $nick_changed)
>> } {
>> - set nameToWriteRemote "$user_name ($user)"
>> - write_remote "** [trans changestate $nameToWriteRemote
>> [trans
>> [::MSN::stateToDescription $substate]]]" event
>> - }
>> -
>> - if { ($state_changed || $nick_changed) &&
>> - (([::config::getKey notifystate] == 1 &&
>> - [::abook::getContactData $user notifystatus -1] != 0) ||
>> - [::abook::getContactData $user notifystatus -1] == 1) } {
>> - ::amsn::notifyAdd "$short_name\n[trans
>> statechange]\n[trans
>> [::MSN::stateToDescription $substate]]." \
>> - "::amsn::chatUser $user" state state $user
>> - }
>> -
>> - } elseif {[lindex $recv 0] == "NLN"} { ;# User was offline, now
>> online
>> -
>> - if { $state_changed } {
>> + if {([::config::getKey notifystate] == 1 &&
>> + [::abook::getContactData $user notifystatus -1] != 0) ||
>> + [::abook::getContactData $user notifystatus -1] == 1 } {
>> + ::amsn::notifyAdd "$short_name\n[trans
>> statechange]\n[trans
>> [::MSN::stateToDescription $substate]]." \
>> + "::amsn::chatUser $user" state state $user
>> + }
>> +
>> + } elseif {[lindex $recv 0] == "NLN"} { ;# User was offline,
>> now
>> online
>> +
>> #Register last login and notify it in the events
>> ::abook::setContactData $user last_login [clock format
>> [clock
>> seconds] -format "%D - %H:%M:%S"]
>> ::log::event connect $custom_user_name
>> @@ -5023,23 +4973,20 @@
>> #later on with x-clientcaps
>> ::abook::setContactData $user clientname ""
>> ::plugins::PostEvent UserConnect evPar
>> - }
>> -
>> - # Added by Yoda-BZH
>> - if { ($remote_auth == 1) && $state_changed } {
>> - set nameToWriteRemote "$user_name ($user)"
>> - write_remote "** $nameToWriteRemote [trans logsin]"
>> event
>> - }
>> -
>> - if { ($state_changed || $nick_changed) &&
>> - (([::config::getKey notifyonline] == 1 &&
>> - [::abook::getContactData $user notifyonline -1] != 0) ||
>> - [::abook::getContactData $user notifyonline -1] == 1) } {
>> - ::amsn::notifyAdd "$short_name\n[trans logsin]."
>> "::amsn::chatUser $user" online online $user
>> - }
>> -
>> - if { $state_changed } {
>> - if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user onconnect] == 1)} {
>> +
>> + # Added by Yoda-BZH
>> + if { $remote_auth == 1 } {
>> + set nameToWriteRemote "$user_name ($user)"
>> + write_remote "** $nameToWriteRemote [trans
>> logsin]" event
>> + }
>> +
>> + if { ([::config::getKey notifyonline] == 1 &&
>> + [::abook::getContactData $user notifyonline -1] != 0) ||
>> + [::abook::getContactData $user notifyonline -1] == 1 } {
>> + ::amsn::notifyAdd "$short_name\n[trans
>> logsin]."
>> "::amsn::chatUser $user" online online $user
>> + }
>> +
>> + if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user onconnect] == 1)} {
>> run_alarm $user $user $custom_user_name
>> "$custom_user_name
>> [trans logsin]"
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all onstatus] == 1)} {
>> run_alarm all $user $custom_user_name
>> "$custom_user_name [trans
>> logsin]"
>> @@ -5051,40 +4998,55 @@
>> # set oldmsnobj [::abook::getVolatileData $user msobj]
>> #set list_users [lreplace $list_users $idx $idx [list $user
>> $user_name $state_no $msnobj]]
>>
>> - ::abook::setVolatileData $user state $substate
>> + if {$state_changed} {
>> + ::abook::setVolatileData $user state $substate
>> + }
>> ::abook::setVolatileData $user msnobj $msnobj
>> set oldPic [::abook::getContactData $user displaypicfile]
>> set newPic [::MSNP2P::GetFilenameFromMSNOBJ $msnobj]
>> - ::abook::setContactData $user displaypicfile $newPic
>> -
>> - if { ($oldPic != $newPic) && ($newPic == "") } {
>> - ::skin::getDisplayPicture $user 1
>> - } elseif { $oldPic != $newPic} {
>> - status_log "picture changed for user $user\n" white
>> - if { [::config::getKey lazypicretrieval] ||
>> [::MSN::userIsBlocked $user]} {
>> - global sb_list
>> - foreach sb $sb_list {
>> - set users_in_chat [$sb cget -users]
>> - if { [lsearch $users_in_chat $user] != -1 } {
>> - status_log "User changed image while
>> image in use!! Updating!!
>> \n" white
>> - ::MSNP2P::loadUserPic [::MSN::ChatFor
>> $sb] $user
>> - }
>> - }
>>
>> + if { $oldPic != $newPic } {
>> + set pic_changed 1
>> +
>> + if { $newPic == "" } {
>> + ::skin::getDisplayPicture $user 1
>> } else {
>> - if { [::MSN::myStatusIs] != "FLN" &&
>> [::MSN::myStatusIs] !=
>> "HDN"} {
>> - if { ![file readable "[file join $HOME
>> displaypic cache $
>> {newPic}].png"] } {
>> - set chat_id [::MSN::chatTo $user]
>> - ::MSN::ChatQueue $chat_id [list
>> ::MSNP2P::loadUserPic
>> $chat_id $user]
>> - } else {
>> - #We already have the image so don't
>> open a convo to get it
>> just load it
>> - ::MSNP2P::loadUserPic "" $user
>> + status_log "picture changed for user $user\n" white
>> +
>> + if { [file readable "[file join $HOME displaypic cache
>> $
>> {newPic}].png"] } {
>> + ;#it's possible that the user set again a DP that we
>> already
>> have in our cache so just load it again, even if we are HDN, or the
>> user is blocked.
>> + ::MSNP2P::loadUserPic "" $user
>> + ::abook::setContactData $user displaypicfile
>> $newPic
>> + } elseif { [::config::getKey lazypicretrieval] ||
>> [::MSN::userIsBlocked $user]} {
>> + global sb_list
>> +
>> + foreach sb $sb_list {
>> + set users_in_chat [$sb cget -users]
>> + if { [lsearch $users_in_chat $user] !=
>> -1 } {
>> + status_log "User changed image
>> while image in use!!
>> Updating!!\n" white
>> + ::MSNP2P::loadUserPic
>> [::MSN::ChatFor $sb] $user
>> + ::abook::setContactData $user
>> displaypicfile $newPic
>> + }
>> }
>> + } elseif { [::MSN::myStatusIs] != "FLN" &&
>> [::MSN::myStatusIs] !
>> = "HDN"} {
>> + set chat_id [::MSN::chatTo $user]
>> + ::MSN::ChatQueue $chat_id [list
>> ::MSNP2P::loadUserPic $chat_id
>> $user]
>> + ::abook::setContactData $user displaypicfile
>> $newPic
>> + } else {
>> + set pic_changed 0
>> }
>> }
>> + } else {
>> + set pic_changed 0
>> }
>>
>> + if { $state_changed || $nick_changed || $pic_changed} {
>> + ::MSN::contactListChanged
>> + }
>>
>> - ::MSN::contactListChanged
>> if { $state_changed || $nick_changed } {
>>
>> foreach chat_id [::ChatWindow::getAllChatIds] {
>
>> proc cmsn_change_state {recv} {
>> global remote_auth HOME
>>
>> if {[lindex $recv 0] == "FLN"} {
>> #User is going offline
>> set user [lindex $recv 1]
>> set evpar(user) user
>> set user_name ""
>> set substate "FLN"
>> set evpar(substate) substate
>> set msnobj [::abook::getVolatileData $user msnobj ""]
>> # status_log "contactStateChange in protocol cmsn_change_state
>> FLN"
>> } elseif {[lindex $recv 0] == "ILN"} {
>> #Initial status when we log in
>> set user [lindex $recv 3]
>> set encoded_user_name [lindex $recv 4]
>> set user_name [urldecode [lindex $recv 4]]
>> set substate [lindex $recv 2]
>> set msnobj [urldecode [lindex $recv 6]]
>> #Add clientID to abook
>> add_Clientid $user [lindex $recv 5]
>> #Previous clientname info is now inaccurate
>> ::abook::setContactData $user clientname ""
>> } else {
>> #Coming online or changing state
>> set user [lindex $recv 2]
>> set evpar(user) user
>> set encoded_user_name [lindex $recv 3]
>> set user_name [urldecode [lindex $recv 3]]
>> set substate [lindex $recv 1]
>> set evpar(substate) substate
>> set msnobj [urldecode [lindex $recv 5]]
>> #Add clientID to abook
>> add_Clientid $user [lindex $recv 4]
>>
>> # status_log "contactStateChange in protocol cmsn_change_state
>> $user"
>> }
>>
>> set oldstate [::abook::getVolatileData $user state]
>> if { $oldstate != $substate } {
>> set state_changed 1
>> } else {
>> set state_changed 0
>> }
>>
>> # we shouldn't add ChangeState PostEvent if ILN
>> if { $state_changed } {
>> #an event used by guicontactlist to know when a contact changed
>>
>> state
>> after 500 [list ::Event::fireEvent contactStateChange protocol
>> $user]
>>
>> ::plugins::PostEvent ChangeState evpar
>> }
>>
>>
>> if { $msnobj == "" } {
>> set msnobj -1
>> }
>>
>> if {$user_name == ""} {
>> set user_name [::abook::getContactData $user nick]
>> set nick_changed 0
>> } elseif { $user_name != [::abook::getContactData $user nick]} {
>> #Nick differs from the one on our list, so change it
>> #in the server list too
>> ::abook::setContactData $user nick $user_name
>> # ::MSN::changeName $user [encoding convertto utf-8
>> $encoded_user_name] 1
>>
>> #an event used by guicontactlist to know when we changed our
>> nick
>> ::Event::fireEvent contactNickChange protocol $user
>>
>> set nick_changed 1
>>
>> if {[::config::getKey protocol] == 11} {
>> if {$::msnp13 != 1} {
>> # This check below is because today I received
>> a NLN for a user
>> # who doesn't appear in ANY of my 5 MSN lists
>> (RL,AL,BL,FL,PL)
>> # so amsn just sent the SBP with an empty
>> string for the
>> contactguid,
>> # which resulted in a wrongly formed SBP, which
>> resulted in the
>> msn server disconnecting me... :@
>> if { [::abook::getContactData $user
>> contactguid] != "" } {
>> ::MSN::WriteSB ns "SBP"
>> "[::abook::getContactData $user
>> contactguid] MFN [urlencode $user_name]"
>> }
>> }
>> }
>> ::log::eventnick $user $user_name
>> } else {
>> set nick_changed 0
>> }
>>
>> set custom_user_name [::abook::getDisplayNick $user]
>>
>> # set state_no [::MSN::stateToNumber $substate ] ;#actually this
>> var is never used.
>>
>>
>> #alarm system (that must replace the one that was before) - KNO
>> if {[lindex $recv 0] !="ILN" && $state_changed} {
>>
>> if {[lindex $recv 0] == "FLN"} {
>> #User disconnected
>>
>> if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user ondisconnect] == 1) } {
>> run_alarm $user $user $custom_user_name [trans
>> disconnect
>> $custom_user_name]
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all ondisconnect] == 1) } {
>> run_alarm all $user $custom_user_name [trans
>> disconnect
>> $custom_user_name]
>> }
>> } else {
>> set status "[trans [::MSN::stateToDescription
>> $substate]]"
>> if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user onstatus] == 1) } {
>> run_alarm $user $user $custom_user_name "[trans
>> changestate
>> $custom_user_name $status]"
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all onstatus] == 1)} {
>> run_alarm all $user $custom_user_name "[trans
>> changestate
>> $custom_user_name $status]"
>> }
>> }
>> }
>> #end of alarm system
>>
>> if { $state_changed } {
>> set maxw [expr {([::skin::getKey notifwidth]-53)*2} ]
>> set short_name [trunc $custom_user_name . $maxw splainf]
>>
>> #User logsout
>> if {$substate == "FLN"} {
>> #Register last logout, last seen and notify it in the
>> events
>> ::abook::setAtomicContactData $user [list last_logout
>> last_seen] \
>> [list [clock format [clock seconds] -format "%D -
>> %H:%M:%S"]
>> [clock format [clock seconds] -format "%D - %H:%M:%S"]]
>> ::log::event disconnect $custom_user_name
>>
>> # Added by Yoda-BZH
>> if { $remote_auth == 1 } {
>> set nameToWriteRemote "$user_name ($user)"
>> write_remote "** $nameToWriteRemote [trans
>> logsout]" event
>> }
>>
>> if { ([::config::getKey notifyoffline] == 1 &&
>> [::abook::getContactData $user notifyoffline -1] != 0)
>> ||
>> [::abook::getContactData $user notifyoffline -1] == 1 }
>> {
>> #Show notify window if globally enabled, and
>> not locally
>> disabled, or if just locally enabled
>> ::amsn::notifyAdd "$short_name\n[trans
>> logsout]." "" offline
>> offline $user
>> }
>>
>> # User was online before, so it's just a status change, and
>> it's
>> not
>> # an initial state notification
>> } elseif {[::abook::getVolatileData $user state FLN] != "FLN"
>> &&
>> [lindex $recv 0] != "ILN" } {
>>
>> #Notify in the events
>> ::log::event state $custom_user_name
>> [::MSN::stateToDescription
>> $substate]
>>
>> # Added by Yoda-BZH
>> if { $remote_auth == 1 } {
>> set nameToWriteRemote "$user_name ($user)"
>> write_remote "** [trans changestate
>> $nameToWriteRemote [trans
>> [::MSN::stateToDescription $substate]]]" event
>> }
>>
>> if {([::config::getKey notifystate] == 1 &&
>> [::abook::getContactData $user notifystatus -1] != 0) ||
>> [::abook::getContactData $user notifystatus -1] == 1 } {
>> ::amsn::notifyAdd "$short_name\n[trans
>> statechange]\n[trans
>> [::MSN::stateToDescription $substate]]." \
>> "::amsn::chatUser $user" state state $user
>> }
>>
>> } elseif {[lindex $recv 0] == "NLN"} { ;# User was offline,
>> now
>> online
>>
>> #Register last login and notify it in the events
>> ::abook::setContactData $user last_login [clock format
>> [clock
>> seconds] -format "%D - %H:%M:%S"]
>> ::log::event connect $custom_user_name
>> ::abook::setVolatileData $user PSM ""
>> #Register PostEvent "UserConnect" for Plugins, email =
>> email
>> user_name=custom nick
>> set evPar(user) user
>> set evPar(user_name) custom_user_name
>> #Reset clientname, if it's not M$N it will set it again
>> #later on with x-clientcaps
>> ::abook::setContactData $user clientname ""
>> ::plugins::PostEvent UserConnect evPar
>>
>> # Added by Yoda-BZH
>> if { $remote_auth == 1 } {
>> set nameToWriteRemote "$user_name ($user)"
>> write_remote "** $nameToWriteRemote [trans
>> logsin]" event
>> }
>>
>> if { ([::config::getKey notifyonline] == 1 &&
>> [::abook::getContactData $user notifyonline -1] != 0) ||
>> [::abook::getContactData $user notifyonline -1] == 1 } {
>> ::amsn::notifyAdd "$short_name\n[trans
>> logsin]."
>> "::amsn::chatUser $user" online online $user
>> }
>>
>> if { ( [::alarms::isEnabled $user] == 1 )&&
>> ( [::alarms::getAlarmItem $user onconnect] == 1)} {
>> run_alarm $user $user $custom_user_name
>> "$custom_user_name
>> [trans logsin]"
>> } elseif { ( [::alarms::isEnabled all] == 1 )&&
>> ( [::alarms::getAlarmItem all onstatus] == 1)} {
>> run_alarm all $user $custom_user_name
>> "$custom_user_name [trans
>> logsin]"
>> }
>> }
>> }
>>
>> # Retreive the new display picture if it changed
>> # set oldmsnobj [::abook::getVolatileData $user msobj]
>> #set list_users [lreplace $list_users $idx $idx [list $user
>> $user_name $state_no $msnobj]]
>>
>> if {$state_changed} {
>> ::abook::setVolatileData $user state $substate
>> }
>> ::abook::setVolatileData $user msnobj $msnobj
>> set oldPic [::abook::getContactData $user displaypicfile]
>> set newPic [::MSNP2P::GetFilenameFromMSNOBJ $msnobj]
>>
>> if { $oldPic != $newPic } {
>> set pic_changed 1
>>
>> if { $newPic == "" } {
>> ::skin::getDisplayPicture $user 1
>> } else {
>> status_log "picture changed for user $user\n" white
>>
>> if { [file readable "[file join $HOME displaypic cache
>> $
>> {newPic}].png"] } {
>> ;#it's possible that the user set again a DP that we
>> already
>> have in our cache so just load it again, even if we are HDN, or the
>> user is blocked.
>> ::MSNP2P::loadUserPic "" $user
>> ::abook::setContactData $user displaypicfile
>> $newPic
>> } elseif { [::config::getKey lazypicretrieval] ||
>> [::MSN::userIsBlocked $user]} {
>> global sb_list
>>
>> foreach sb $sb_list {
>> set users_in_chat [$sb cget -users]
>> if { [lsearch $users_in_chat $user] !=
>> -1 } {
>> status_log "User changed image
>> while image in use!! Updating!!
>> \n" white
>> ::MSNP2P::loadUserPic
>> [::MSN::ChatFor $sb] $user
>> ::abook::setContactData $user
>> displaypicfile $newPic
>> }
>> }
>> } elseif { [::MSN::myStatusIs] != "FLN" &&
>> [::MSN::myStatusIs] !
>> = "HDN"} {
>> set chat_id [::MSN::chatTo $user]
>> ::MSN::ChatQueue $chat_id [list
>> ::MSNP2P::loadUserPic $chat_id
>> $user]
>> ::abook::setContactData $user displaypicfile
>> $newPic
>> } else {
>> set pic_changed 0
>> }
>> }
>> } else {
>> set pic_changed 0
>> }
>>
>> if { $state_changed || $nick_changed || $pic_changed} {
>> ::MSN::contactListChanged
>> }
>>
>> if { $state_changed || $nick_changed } {
>>
>> foreach chat_id [::ChatWindow::getAllChatIds] {
>> if { $chat_id == $user } {
>> ::ChatWindow::TopUpdate $chat_id
>> } else {
>> foreach user_in_chat [::MSN::usersInChat
>> $chat_id] {
>> if { $user_in_chat == $user } {
>> ::ChatWindow::TopUpdate $chat_id
>> break
>> }
>> }
>> }
>> }
>> }
>> }
>> -------------------------------------------------------------------------
>> SF.Net email is sponsored by:
>> Check out the new SourceForge.net Marketplace.
>> It's the best place to buy or sell services
>> for just about anything Open Source.
>> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
>> _______________________________________________
>> Amsn-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/amsn-devel
>
>
> -------------------------------------------------------------------------
> SF.Net email is sponsored by:
> Check out the new SourceForge.net Marketplace.
> It's the best place to buy or sell services
> for just about anything Open Source.
> http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
> _______________________________________________
> Amsn-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/amsn-devel
-------------------------------------------------------------------------
SF.Net email is sponsored by:
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services
for just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
Amsn-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/amsn-devel