comparison finch/gntblist.c @ 17240:29b3dc9cc8c5

It's valid for different types to be compared. In that case, use existing positions.
author Richard Nelson <wabz@pidgin.im>
date Fri, 25 May 2007 02:06:06 +0000
parents 0d9fba04fc85
children 995f31f5432a
comparison
equal deleted inserted replaced
17239:99a2add7c4f2 17240:29b3dc9cc8c5
1871 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2) 1871 blist_node_compare_text(PurpleBlistNode *n1, PurpleBlistNode *n2)
1872 { 1872 {
1873 const char *s1, *s2; 1873 const char *s1, *s2;
1874 char *us1, *us2; 1874 char *us1, *us2;
1875 int ret; 1875 int ret;
1876 1876
1877 g_return_val_if_fail(n1->type == n2->type, -1); 1877 if (n1->type != n2->type)
1878 1878 return blist_node_compare_position(n1, n2);
1879
1879 switch (n1->type) 1880 switch (n1->type)
1880 { 1881 {
1881 case PURPLE_BLIST_CHAT_NODE: 1882 case PURPLE_BLIST_CHAT_NODE:
1882 s1 = purple_chat_get_name((PurpleChat*)n1); 1883 s1 = purple_chat_get_name((PurpleChat*)n1);
1883 s2 = purple_chat_get_name((PurpleChat*)n2); 1884 s2 = purple_chat_get_name((PurpleChat*)n2);
1906 static int 1907 static int
1907 blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2) 1908 blist_node_compare_status(PurpleBlistNode *n1, PurpleBlistNode *n2)
1908 { 1909 {
1909 int ret; 1910 int ret;
1910 1911
1911 g_return_val_if_fail(n1->type == n2->type, -1); 1912 if (n1->type != n2->type)
1913 return blist_node_compare_position(n1, n2);
1912 1914
1913 switch (n1->type) { 1915 switch (n1->type) {
1914 case PURPLE_BLIST_CONTACT_NODE: 1916 case PURPLE_BLIST_CONTACT_NODE:
1915 n1 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n1); 1917 n1 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n1);
1916 n2 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n2); 1918 n2 = (PurpleBlistNode*)purple_contact_get_priority_buddy((PurpleContact*)n2);
1950 blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2) 1952 blist_node_compare_log(PurpleBlistNode *n1, PurpleBlistNode *n2)
1951 { 1953 {
1952 int ret; 1954 int ret;
1953 PurpleBuddy *b1, *b2; 1955 PurpleBuddy *b1, *b2;
1954 1956
1955 g_return_val_if_fail(n1->type == n2->type, -1); 1957 if (n1->type != n2->type)
1958 return blist_node_compare_position(n1, n2);
1956 1959
1957 switch (n1->type) { 1960 switch (n1->type) {
1958 case PURPLE_BLIST_BUDDY_NODE: 1961 case PURPLE_BLIST_BUDDY_NODE:
1959 b1 = (PurpleBuddy*)n1; 1962 b1 = (PurpleBuddy*)n1;
1960 b2 = (PurpleBuddy*)n2; 1963 b2 = (PurpleBuddy*)n2;