aMSN Forums
July 18, 2018, 07:04:50 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New forum for aMSN !!
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Sort Contacts by in the list of your contact list or not  (Read 10423 times)
MagicSolution
Newbie

Offline Offline

Posts: 2


View Profile
« on: August 12, 2008, 02:09:37 pm »

Hi,

I have add new sorting command.
This command sorting  your contact list by your are in the list of your contact list or not ( like as your are lock unlock).
If someone think it can by useful I give you my code I don’t know if my code is really good .

Regards,
Magic

aMSN 0.98b SVN 10368

Code:

--- config.tcl Mon Jul 28 16:52:51 2008
+++ config.tcl Mon Aug 11 20:35:43 2008
@@ -310,6 +310,7 @@
  ::config::setKey groupnonim 0 ;# Group non IM contacts in a separate group in the CL
  ::config::setKey showspaces 1 ;# Enable/disable showing of the spaces star in the CL
  ::config::setKey showOfflineGroup 1
+ ::config::setKey sortbylockunlock 1
  ::config::setKey no_blocked_notif 0 ;# No notify windows when a user is blocked
 
  #Advanced options, not in preferences window
--- gui.tcl Mon Jul 21 20:51:10 2008
+++ gui.tcl Mon Aug 11 20:43:10 2008
@@ -4416,6 +4416,11 @@
     -variable [::config::getVar showspaces] -command "::Event::fireEvent changedSorting gui"
  $view add checkbutton -label "[trans showofflinegroup]" -onvalue 1 -offvalue 0  -state disabled \
     -variable [::config::getVar showOfflineGroup] -command "::Event::fireEvent changedSorting gui"
+ #-------------------
+ $view add separator
+ $view add checkbutton -label "[trans sortbylockunlock]" -onvalue 1 -offvalue 0 -state disabled \
+    -variable [::config::getVar sortbylockunlock] -command "::Event::fireEvent changedSorting gui"
+ #-------------------
 
  ###########################
  #Actions menu
@@ -4773,7 +4778,8 @@
  set nonim_idx [$menu index "[trans shownonim]"]
  set spaces_idx [$menu index "[trans showspaces]"]
  set offline_idx [$menu index "[trans showofflinegroup]"]
- enableEntries $menu [list $contact_sorting_idx $email_idx $nick_idx $asc_idx $desc_idx $nonim_idx $spaces_idx $offline_idx]
+ set lockunlock_idx [$menu index "[trans sortbylockunlock]"]
+ enableEntries $menu [list $contact_sorting_idx $email_idx $nick_idx $asc_idx $desc_idx $nonim_idx $spaces_idx $offline_idx $lockunlock_idx]
 
  # Actions menu
  set menu .main_menu.actions
@@ -4851,7 +4857,9 @@
  set nonim_idx [$menu index "[trans shownonim]"]
  set spaces_idx [$menu index "[trans showspaces]"]
  set offline_idx [$menu index "[trans showofflinegroup]"]
- enableEntries $menu [list $contact_sorting_idx $email_idx $nick_idx $asc_idx $desc_idx $nonim_idx $spaces_idx $offline_idx] 0
+ set lockunlock_idx [$menu index "[trans sortbylockunlock]"]
+
+ enableEntries $menu [list $contact_sorting_idx $email_idx $nick_idx $asc_idx $desc_idx $nonim_idx $spaces_idx $offline_idx $lockunlock_idx] 0
 
  # Actions menu
  set menu .main_menu.actions
--- guicontactlist.tcl Thu Jul 31 23:53:44 2008
+++ guicontactlist.tcl Tue Aug 12 13:26:34 2008
@@ -1996,6 +1996,7 @@
  set mode [::config::getKey orderbygroup]
 
  set drawOfflineGroup [::config::getKey showOfflineGroup 1]
+ set sortbylockunlock [::config::getKey sortbylockunlock 1]
  set drawMobileGroup [::config::getKey showMobileGroup 0]
  set drawNoimGroup [::config::getKey groupnonim 0]
 
@@ -2049,7 +2050,7 @@
  } else {
  set groupList [lsort -decreasing -dictionary -index 1 $groupList]
  }
-
+
  # Now we have to add the "individuals" group, translated and as first
  set groupList [linsert $groupList 0 [list 0 [trans nogroup]]]
  }
@@ -2067,6 +2068,7 @@
  if {$drawNoimGroup == 1} {
  lappend groupList [list "nonim" [trans nonimgroup]]
  }
+
 
  return $groupList
  }
--- protocol.tcl Sat Aug 02 08:53:21 2008
+++ protocol.tcl Tue Aug 12 13:41:38 2008
@@ -3269,6 +3269,11 @@
  if { [config::getKey orderusersbystatus 1] } {
  set list_users [lsort -increasing -command ::MSN::CompareState $list_users]
  }
+
+ # Sort the list by lock unlock
+ if {[::config::getKey sortbylockunlock 1 ]} {
+ set list_users [lsort -increasing -command ::MSN::CompareIsIntList $list_users]
+ }
  set last_ordering_options $new_ordering_options
  }
  return $list_users
@@ -3375,7 +3380,21 @@
  return 0
  }
  }
+
+ #Compare if in list or not , for sorting
+ proc CompareIsIntList { item1 item2 } {
+ set state1 [expr {[lsearch [::abook::getLists $item1] RL] == -1}]
+ set state2 [expr {[lsearch [::abook::getLists $item2] RL] == -1}]
 
+ if { $state1 < $state2 } {
+ return -1
+ } elseif { $state1 > $state2 } {
+ return 1
+ } else {
+ return 0
+ }
+ }
+
  #Compare two nicks, for sorting
  proc CompareNick { item1 item2 } {
  set non_im1 [expr {[lsearch [::abook::getContactData $item1 lists] "FL"] == -1}]
--- lang/langen Mon Jul 28 16:52:51 2008
+++ lang/langen Tue Aug 12 12:45:45 2008
@@ -1034,3 +1034,4 @@
 yousay You say
 youwant You want
 zoom Zoom
+sortbylockunlock Order contacts by (not in list)
--- lang/langfr Fri Jul 18 20:55:18 2008
+++ lang/langfr Tue Aug 12 12:35:44 2008
@@ -1034,3 +1034,4 @@
 yousay Vous avez dit
 youwant Vous voulez
 zoom Zoomer
+sortbylockunlock Trier les contacts par (dans leur liste ou non)
[code][/code]
Logged
Phil
Administrator
Super Power User
*****
Offline Offline

Posts: 653


View Profile
« Reply #1 on: August 12, 2008, 03:56:17 pm »

Thanks but I don't think we will integrate it in aMSN tree. That's not really useful for every day use.
Logged

Phil

AMsn is great, and it will be greater :wink:
MagicSolution
Newbie

Offline Offline

Posts: 2


View Profile
« Reply #2 on: August 12, 2008, 04:17:17 pm »

Quote from: "Phil"
Thanks but I don't think we will integrate it in aMSN tree. That's not really useful for every day use.


Thanks Phil,
do you think it’ easy to make an plugging for do this?
I am newbie with tck, I m usually working in c.
Regards,
Magic
Logged
Phil
Administrator
Super Power User
*****
Offline Offline

Posts: 653


View Profile
« Reply #3 on: August 12, 2008, 10:46:09 pm »

Hum I don't think so Sad
Anyway I will make this post sticky
Logged

Phil

AMsn is great, and it will be greater :wink:
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!