comparison libpurple/protocols/oscar/oscar.c @ 15524:84b3ab83df35

Use the status API to handle mobileness, and convert AIM to use it. This makes mobile buddies prioritze lower in Perons, and ensures the UI is notified of changes in mobileness. Other protocols to follow.
author Sean Egan <seanegan@gmail.com>
date Sun, 04 Feb 2007 02:31:04 +0000
parents 0b6f337a46d5
children a7b4a4c2cfcf
comparison
equal deleted inserted replaced
15523:ccbdf500f13a 15524:84b3ab83df35
56 #define OSCAR_STATUS_ID_DND "dnd" 56 #define OSCAR_STATUS_ID_DND "dnd"
57 #define OSCAR_STATUS_ID_NA "na" 57 #define OSCAR_STATUS_ID_NA "na"
58 #define OSCAR_STATUS_ID_OCCUPIED "occupied" 58 #define OSCAR_STATUS_ID_OCCUPIED "occupied"
59 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat" 59 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat"
60 #define OSCAR_STATUS_ID_CUSTOM "custom" 60 #define OSCAR_STATUS_ID_CUSTOM "custom"
61 #define OSCAR_STATUS_ID_MOBILE "mobile"
61 62
62 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3" 63 #define AIMHASHDATA "http://gaim.sourceforge.net/aim_data.php3"
63 64
64 #define OSCAR_CONNECT_STEPS 6 65 #define OSCAR_CONNECT_STEPS 6
65 66
1765 if (info->status[0] != '\0') 1766 if (info->status[0] != '\0')
1766 message = oscar_encoding_to_utf8(info->status_encoding, 1767 message = oscar_encoding_to_utf8(info->status_encoding,
1767 info->status, info->status_len); 1768 info->status, info->status_len);
1768 } 1769 }
1769 1770
1771 if (info->flags & AIM_FLAG_WIRELESS || info->capabilities & OSCAR_CAPABILITY_HIPTOP)
1772 {
1773 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_MOBILE, NULL);
1774 } else {
1775 gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
1776 }
1777
1770 if (have_status_message) 1778 if (have_status_message)
1771 { 1779 {
1772 gaim_prpl_got_user_status(account, info->sn, status_id, 1780 gaim_prpl_got_user_status(account, info->sn, status_id,
1773 "message", message, NULL); 1781 "message", message, NULL);
1774 g_free(message); 1782 g_free(message);
1879 va_start(ap, fr); 1887 va_start(ap, fr);
1880 info = va_arg(ap, aim_userinfo_t *); 1888 info = va_arg(ap, aim_userinfo_t *);
1881 va_end(ap); 1889 va_end(ap);
1882 1890
1883 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL); 1891 gaim_prpl_got_user_status(account, info->sn, OSCAR_STATUS_ID_OFFLINE, NULL);
1884 1892 gaim_prpl_got_user_status_deactive(account, info->sn, OSCAR_STATUS_ID_MOBILE);
1885 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn)); 1893 g_hash_table_remove(od->buddyinfo, gaim_normalize(gc->account, info->sn));
1886 1894
1887 return 1; 1895 return 1;
1888 } 1896 }
1889 1897
5429 } 5437 }
5430 5438
5431 if (userinfo != NULL ) { 5439 if (userinfo != NULL ) {
5432 if (userinfo->flags & AIM_FLAG_ADMINISTRATOR) 5440 if (userinfo->flags & AIM_FLAG_ADMINISTRATOR)
5433 return "admin"; 5441 return "admin";
5434 if (userinfo->flags & AIM_FLAG_WIRELESS)
5435 return "mobile";
5436 if (userinfo->capabilities & OSCAR_CAPABILITY_HIPTOP)
5437 return "mobile";
5438 if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY) 5442 if (userinfo->flags & AIM_FLAG_ACTIVEBUDDY)
5439 return "bot"; 5443 return "bot";
5440 if (userinfo->flags & AIM_FLAG_AOL) 5444 if (userinfo->flags & AIM_FLAG_AOL)
5441 return "aolclient"; 5445 return "aolclient";
5442 if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM) 5446 if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM)
5716 type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE, 5720 type = gaim_status_type_new_full(GAIM_STATUS_INVISIBLE,
5717 OSCAR_STATUS_ID_INVISIBLE, 5721 OSCAR_STATUS_ID_INVISIBLE,
5718 NULL, TRUE, TRUE, FALSE); 5722 NULL, TRUE, TRUE, FALSE);
5719 status_types = g_list_prepend(status_types, type); 5723 status_types = g_list_prepend(status_types, type);
5720 5724
5725 type = gaim_status_type_new_full(GAIM_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE);
5726 status_types = g_list_prepend(status_types, type);
5727
5721 /* ICQ-specific status types */ 5728 /* ICQ-specific status types */
5722 type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE, 5729 type = gaim_status_type_new_with_attrs(GAIM_STATUS_UNAVAILABLE,
5723 OSCAR_STATUS_ID_OCCUPIED, 5730 OSCAR_STATUS_ID_OCCUPIED,
5724 _("Occupied"), TRUE, is_icq, FALSE, 5731 _("Occupied"), TRUE, is_icq, FALSE,
5725 "message", _("Message"), 5732 "message", _("Message"),