Hi !

In the file abook.tcl , the proc setContactData on line 340, what about re-create another procedure named « setContactDataFast ». It should be the same that « setContactData » but without the condition «  # An event used by guicontactlist to know when a user changed his nick (or state) ». Then, you could change the function that is loading the XML file ( loadXMLContact on line 892 ) to use that procedure instead of the « normal » procedure. You could save about 5 or 6 micro-seconds when executing aMSN ?

I don't think we need to advise guicontactlist that a user change his nick or state during the loading of the xml file.

Here is the new procedure setContactData :

-----------------------------------------------------------------------------------------
    proc setContactDataFast { user_login field data } {
        puts stdout $user_login
        puts stdout $field
        puts stdout $data
        global pgc
        variable users_data

        set field [string tolower $field]
       
        # There can't be double arrays, so users_data(user) is just a
        # list like {entry1 data1 entry2 data2 ...}
        if { [info exists users_data($user_login)] } {
            #We convert the list to an array, to make it easier
            array set user_data $users_data($user_login)
        } else {
            array set user_data [list]
        }

        if { $data != "" } {
            #post event for amsnplus
            set evPar(data) data
            ::plugins::PostEvent parse_nick evPar

            set user_data($field) $data
        }
       
        set users_data($user_login) [array get user_data]
       
        #We make this to notify preferences > groups to be refreshed
        set pgc 1
    }
-----------------------------------------------------------------------------------------

Here is the new procedure loadXMLContact :

-----------------------------------------------------------------------------------------
proc loadXMLContact {cstack cdata saved_data cattr saved_attr args } {
        variable users_data
        upvar $saved_data sdata
        upvar $saved_attr sattr
       
        array set attr $cattr
       
        set parentlen [string length $cstack]
        foreach child [array names sattr] {
            if { $child == "_dummy_" } {
                continue
            }
            set fieldname [string range $child [expr {$parentlen+1}] end]
            #Remove this. Only leave it for some days to remove old ::abook stored data

            # BTW could we remove those lines ?

            #if { $fieldname == "field" } {
            #    continue
            #}

            # Here is the line changed.
            setContactDataFast $attr(name) $fieldname $sdata($child)
        }
       
        return 0   
       
    }
-----------------------------------------------------------------------------------------
--
Benjamin
[EMAIL PROTECTED]
-------------------------------------------------------------------------
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
Amsn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/amsn-devel

Reply via email to