From: Tom J. <bl...@us...> - 2006-01-26 20:33:12
|
Update of /cvsroot/amsn/msn In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3489 Modified Files: contactlist.tcl Log Message: Added SearchContacts method. returns list of contacts with $pattern in their nick/psm. Will be used for filter/search feature. Index: contactlist.tcl =================================================================== RCS file: /cvsroot/amsn/msn/contactlist.tcl,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** contactlist.tcl 26 Jan 2006 19:45:23 -0000 1.13 --- contactlist.tcl 26 Jan 2006 20:32:59 -0000 1.14 *************** *** 204,208 **** array set stateid {{} {}} ! # Arrays to store nicknames, psms, music and states in (for the truncation procs to refer to) array set nick {{} {}} array set psm {{} {}} --- 204,208 ---- array set stateid {{} {}} ! # Arrays to store nicknames, psms, music and states in (for the truncation and other methods to refer to) array set nick {{} {}} array set psm {{} {}} *************** *** 500,503 **** --- 500,518 ---- } + method SearchContacts { pattern } { + set matches {} + foreach groupid $groups { + foreach id [contentmanager children $cl $groupid] { + if { [string equal $id head] } { + continue + } + if { [string first $pattern $nick($groupid.$id)] != -1 || [string first $pattern $psm($groupid.$id)] != -1 } { + lappend matches $id + } + } + } + return $matches + } + method AddContact { groupid id {nicktext {}} {psmtext {}} {musictext {}} {statetext {}} } { # Create canvas items (pic, nick, psm, music, state) |