Mercurial > pidgin.yaz
comparison libpurple/protocols/oscar/oscar.c @ 29812:365b90fa23cf
This patch comes from the combined work of contributors minstrel, NightFox,
bob007, salieff, and nops (these are their trac usernames). I have made
some minor tweaks to the patch, but these shouldn't be a problem. This patch
needs some TLC before we can merge it anywhere else; it adds API so it must
hit im.pidgin.pidgin.next.minor before hitting im.pidgin.pidgin. Refs #4508.
author | John Bailey <rekkanoryo@rekkanoryo.org> |
---|---|
date | Thu, 13 Nov 2008 17:04:53 +0000 |
parents | dd787f8d5e91 |
children | 297d83036107 |
comparison
equal
deleted
inserted
replaced
24347:f18f37a62971 | 29812:365b90fa23cf |
---|---|
57 #define OSCAR_STATUS_ID_AWAY "away" | 57 #define OSCAR_STATUS_ID_AWAY "away" |
58 #define OSCAR_STATUS_ID_DND "dnd" | 58 #define OSCAR_STATUS_ID_DND "dnd" |
59 #define OSCAR_STATUS_ID_NA "na" | 59 #define OSCAR_STATUS_ID_NA "na" |
60 #define OSCAR_STATUS_ID_OCCUPIED "occupied" | 60 #define OSCAR_STATUS_ID_OCCUPIED "occupied" |
61 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat" | 61 #define OSCAR_STATUS_ID_FREE4CHAT "free4chat" |
62 #define OSCAR_STATUS_ID_EVIL "evil" | |
63 #define OSCAR_STATUS_ID_DEPRESSION "depression" | |
64 #define OSCAR_STATUS_ID_ATHOME "athome" | |
65 #define OSCAR_STATUS_ID_ATWORK "atwork" | |
66 #define OSCAR_STATUS_ID_LUNCH "lunch" | |
62 #define OSCAR_STATUS_ID_CUSTOM "custom" | 67 #define OSCAR_STATUS_ID_CUSTOM "custom" |
63 #define OSCAR_STATUS_ID_MOBILE "mobile" | 68 #define OSCAR_STATUS_ID_MOBILE "mobile" |
64 | 69 |
65 #define AIMHASHDATA "http://pidgin.im/aim_data.php3" | 70 #define AIMHASHDATA "http://pidgin.im/aim_data.php3" |
66 | 71 |
67 #define OSCAR_CONNECT_STEPS 6 | 72 #define OSCAR_CONNECT_STEPS 6 |
68 | 73 |
69 static OscarCapability purple_caps = (OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | | 74 static OscarCapability purple_caps = (OSCAR_CAPABILITY_CHAT | OSCAR_CAPABILITY_BUDDYICON | OSCAR_CAPABILITY_DIRECTIM | |
70 OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | | 75 OSCAR_CAPABILITY_SENDFILE | OSCAR_CAPABILITY_UNICODE | OSCAR_CAPABILITY_INTEROPERATE | |
71 OSCAR_CAPABILITY_SHORTCAPS); | 76 OSCAR_CAPABILITY_SHORTCAPS | OSCAR_CAPABILITY_ICQSERVERRELAY | OSCAR_CAPABILITY_NEWCAPS | OSCAR_CAPABILITY_XTRAZ); |
72 | 77 |
73 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02}; | 78 static guint8 features_aim[] = {0x01, 0x01, 0x01, 0x02}; |
74 static guint8 features_icq[] = {0x01, 0x06}; | 79 static guint8 features_icq[] = {0x01, 0x06}; |
75 static guint8 features_icq_offline[] = {0x01}; | 80 static guint8 features_icq_offline[] = {0x01}; |
76 static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; | 81 static guint8 ck[] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; |
668 tmp = _("Send File"); | 673 tmp = _("Send File"); |
669 break; | 674 break; |
670 case OSCAR_CAPABILITY_GAMES: | 675 case OSCAR_CAPABILITY_GAMES: |
671 case OSCAR_CAPABILITY_GAMES2: | 676 case OSCAR_CAPABILITY_GAMES2: |
672 tmp = _("Games"); | 677 tmp = _("Games"); |
678 case OSCAR_CAPABILITY_XTRAZ: | |
679 case OSCAR_CAPABILITY_NEWCAPS: | |
680 tmp = _("ICQ Xtraz"); | |
673 break; | 681 break; |
674 case OSCAR_CAPABILITY_ADDINS: | 682 case OSCAR_CAPABILITY_ADDINS: |
675 tmp = _("Add-Ins"); | 683 tmp = _("Add-Ins"); |
676 break; | 684 break; |
677 case OSCAR_CAPABILITY_SENDBUDDYLIST: | 685 case OSCAR_CAPABILITY_SENDBUDDYLIST: |
748 return g_strdup_printf(_("Occupied")); | 756 return g_strdup_printf(_("Occupied")); |
749 else if (state & AIM_ICQ_STATE_AWAY) | 757 else if (state & AIM_ICQ_STATE_AWAY) |
750 return g_strdup_printf(_("Away")); | 758 return g_strdup_printf(_("Away")); |
751 else if (state & AIM_ICQ_STATE_WEBAWARE) | 759 else if (state & AIM_ICQ_STATE_WEBAWARE) |
752 return g_strdup_printf(_("Web Aware")); | 760 return g_strdup_printf(_("Web Aware")); |
753 else if (state & AIM_ICQ_STATE_INVISIBLE) | 761 else if (state & AIM_ICQ_STATE_EVIL) |
754 return g_strdup_printf(_("Invisible")); | 762 return g_strdup_printf(_("Evil")); |
755 else | 763 else if (state & AIM_ICQ_STATE_DEPRESSION) |
764 return g_strdup_printf(_("Depression")); | |
765 else if (state & AIM_ICQ_STATE_ATHOME) | |
766 return g_strdup_printf(_("At home")); | |
767 else if (state & AIM_ICQ_STATE_ATWORK) | |
768 return g_strdup_printf(_("At work")); | |
769 else if (state & AIM_ICQ_STATE_LUNCH) | |
770 return g_strdup_printf(_("At lunch")); | |
771 else | |
756 return g_strdup_printf(_("Online")); | 772 return g_strdup_printf(_("Online")); |
757 } | 773 } |
758 | 774 |
759 static void | 775 static void |
760 oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value) | 776 oscar_user_info_add_pair(PurpleNotifyUserInfo *user_info, const char *name, const char *value) |
1990 status_id = OSCAR_STATUS_ID_OCCUPIED; | 2006 status_id = OSCAR_STATUS_ID_OCCUPIED; |
1991 else if (type & AIM_ICQ_STATE_AWAY) | 2007 else if (type & AIM_ICQ_STATE_AWAY) |
1992 status_id = OSCAR_STATUS_ID_AWAY; | 2008 status_id = OSCAR_STATUS_ID_AWAY; |
1993 else if (type & AIM_ICQ_STATE_INVISIBLE) | 2009 else if (type & AIM_ICQ_STATE_INVISIBLE) |
1994 status_id = OSCAR_STATUS_ID_INVISIBLE; | 2010 status_id = OSCAR_STATUS_ID_INVISIBLE; |
2011 else if (type & AIM_ICQ_STATE_EVIL) | |
2012 status_id = OSCAR_STATUS_ID_EVIL; | |
2013 else if (type & AIM_ICQ_STATE_DEPRESSION) | |
2014 status_id = OSCAR_STATUS_ID_DEPRESSION; | |
2015 else if (type & AIM_ICQ_STATE_ATHOME) | |
2016 status_id = OSCAR_STATUS_ID_ATHOME; | |
2017 else if (type & AIM_ICQ_STATE_ATWORK) | |
2018 status_id = OSCAR_STATUS_ID_ATWORK; | |
2019 else if (type & AIM_ICQ_STATE_LUNCH) | |
2020 status_id = OSCAR_STATUS_ID_LUNCH; | |
1995 else | 2021 else |
1996 status_id = OSCAR_STATUS_ID_AVAILABLE; | 2022 status_id = OSCAR_STATUS_ID_AVAILABLE; |
1997 } else { | 2023 } else { |
1998 if (type & AIM_ICQ_STATE_INVISIBLE) | 2024 if (type & AIM_ICQ_STATE_INVISIBLE) |
1999 status_id = OSCAR_STATUS_ID_INVISIBLE; | 2025 status_id = OSCAR_STATUS_ID_INVISIBLE; |
2306 static int | 2332 static int |
2307 incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args) | 2333 incomingim_chan2(OscarData *od, FlapConnection *conn, aim_userinfo_t *userinfo, IcbmArgsCh2 *args) |
2308 { | 2334 { |
2309 PurpleConnection *gc; | 2335 PurpleConnection *gc; |
2310 PurpleAccount *account; | 2336 PurpleAccount *account; |
2337 PurpleMessageFlags flags = 0; | |
2311 char *message = NULL; | 2338 char *message = NULL; |
2339 char *rtfmsg = NULL; | |
2312 | 2340 |
2313 g_return_val_if_fail(od != NULL, 0); | 2341 g_return_val_if_fail(od != NULL, 0); |
2314 g_return_val_if_fail(od->gc != NULL, 0); | 2342 g_return_val_if_fail(od->gc != NULL, 0); |
2315 | 2343 |
2316 gc = od->gc; | 2344 gc = od->gc; |
2336 if (g_utf8_validate(args->msg, args->msglen, NULL)) | 2364 if (g_utf8_validate(args->msg, args->msglen, NULL)) |
2337 message = g_strdup(args->msg); | 2365 message = g_strdup(args->msg); |
2338 } | 2366 } |
2339 } | 2367 } |
2340 | 2368 |
2369 | |
2370 if (args->info.rtfmsg.rtfmsg != NULL) | |
2371 { | |
2372 if (args->encoding != NULL) | |
2373 { | |
2374 char *encoding = NULL; | |
2375 encoding = oscar_encoding_extract(args->encoding); | |
2376 rtfmsg = oscar_encoding_to_utf8(account, encoding, args->info.rtfmsg.rtfmsg, | |
2377 strlen(args->info.rtfmsg.rtfmsg)); | |
2378 g_free(encoding); | |
2379 } else { | |
2380 if (g_utf8_validate(args->info.rtfmsg.rtfmsg, strlen(args->info.rtfmsg.rtfmsg), NULL)) | |
2381 rtfmsg = g_strdup(args->info.rtfmsg.rtfmsg); | |
2382 } | |
2383 } | |
2341 if (args->type & OSCAR_CAPABILITY_CHAT) | 2384 if (args->type & OSCAR_CAPABILITY_CHAT) |
2342 { | 2385 { |
2343 char *encoding, *utf8name, *tmp; | 2386 char *encoding, *utf8name, *tmp; |
2344 GHashTable *components; | 2387 GHashTable *components; |
2345 | 2388 |
2423 | 2466 |
2424 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) | 2467 else if (args->type & OSCAR_CAPABILITY_ICQSERVERRELAY) |
2425 { | 2468 { |
2426 purple_debug_error("oscar", "Got an ICQ Server Relay message of " | 2469 purple_debug_error("oscar", "Got an ICQ Server Relay message of " |
2427 "type %d\n", args->info.rtfmsg.msgtype); | 2470 "type %d\n", args->info.rtfmsg.msgtype); |
2471 purple_debug_error("oscar", "Sending X-Status Reply\n"); | |
2472 | |
2473 if(args->info.rtfmsg.msgtype == 26) | |
2474 icq_relay_xstatus(od, userinfo->sn, args->cookie); | |
2475 | |
2476 if(args->info.rtfmsg.msgtype == 1) | |
2477 { | |
2478 if(rtfmsg) | |
2479 serv_got_im(gc, userinfo->sn, rtfmsg, flags, | |
2480 time(NULL)); | |
2481 else | |
2482 serv_got_im(gc, userinfo->sn, args->info.rtfmsg.rtfmsg, flags, | |
2483 time(NULL)); | |
2484 | |
2485 } | |
2428 } | 2486 } |
2429 | 2487 |
2430 else | 2488 else |
2431 { | 2489 { |
2432 purple_debug_error("oscar", "Unknown request class %hu\n", | 2490 purple_debug_error("oscar", "Unknown request class %hu\n", |
2826 case 4: { /* ICQ */ | 2884 case 4: { /* ICQ */ |
2827 struct aim_incomingim_ch4_args *args; | 2885 struct aim_incomingim_ch4_args *args; |
2828 args = va_arg(ap, struct aim_incomingim_ch4_args *); | 2886 args = va_arg(ap, struct aim_incomingim_ch4_args *); |
2829 ret = incomingim_chan4(od, conn, userinfo, args, 0); | 2887 ret = incomingim_chan4(od, conn, userinfo, args, 0); |
2830 } break; | 2888 } break; |
2831 | |
2832 default: { | 2889 default: { |
2833 purple_debug_warning("oscar", | 2890 purple_debug_warning("oscar", |
2834 "ICBM received on unsupported channel (channel " | 2891 "ICBM received on unsupported channel (channel " |
2835 "0x%04hx).", channel); | 2892 "0x%04hx).", channel); |
2836 } break; | 2893 } break; |
2974 purple_notify_userinfo(gc, who, user_info, NULL, NULL); | 3031 purple_notify_userinfo(gc, who, user_info, NULL, NULL); |
2975 purple_notify_user_info_destroy(user_info); | 3032 purple_notify_user_info_destroy(user_info); |
2976 | 3033 |
2977 } break; | 3034 } break; |
2978 | 3035 |
3036 case 0x0006: { /* Reply from an ICQ status message request */ | |
3037 char *statusmsg, **splitmsg; | |
3038 PurpleNotifyUserInfo *user_info; | |
3039 | |
3040 /* Split at (carriage return/newline)'s, then rejoin later with BRs between. */ | |
3041 statusmsg = oscar_icqstatus(state); | |
3042 splitmsg = g_strsplit(msg, "\r\n", 0); | |
3043 | |
3044 user_info = purple_notify_user_info_new(); | |
3045 | |
3046 purple_notify_user_info_add_pair(user_info, _("UIN"), who); | |
3047 purple_notify_user_info_add_pair(user_info, _("Status"), statusmsg); | |
3048 purple_notify_user_info_add_section_break(user_info); | |
3049 purple_notify_user_info_add_pair(user_info, NULL, g_strjoinv("<BR>", splitmsg)); | |
3050 | |
3051 g_free(statusmsg); | |
3052 g_strfreev(splitmsg); | |
3053 | |
3054 purple_notify_userinfo(gc, who, user_info, NULL, NULL); | |
3055 purple_notify_user_info_destroy(user_info); | |
3056 | |
3057 } break; | |
2979 default: { | 3058 default: { |
2980 purple_debug_warning("oscar", | 3059 purple_debug_warning("oscar", |
2981 "Received an unknown client auto-response from %s. " | 3060 "Received an unknown client auto-response from %s. " |
2982 "Type 0x%04hx\n", who, reason); | 3061 "Type 0x%04hx\n", who, reason); |
2983 } break; | 3062 } break; |
4627 data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; | 4706 data |= AIM_ICQ_STATE_AWAY | AIM_ICQ_STATE_BUSY; |
4628 else if (!strcmp(status_id, OSCAR_STATUS_ID_FREE4CHAT)) | 4707 else if (!strcmp(status_id, OSCAR_STATUS_ID_FREE4CHAT)) |
4629 data |= AIM_ICQ_STATE_CHAT; | 4708 data |= AIM_ICQ_STATE_CHAT; |
4630 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) | 4709 else if (!strcmp(status_id, OSCAR_STATUS_ID_INVISIBLE)) |
4631 data |= AIM_ICQ_STATE_INVISIBLE; | 4710 data |= AIM_ICQ_STATE_INVISIBLE; |
4711 else if (!strcmp(status_id, OSCAR_STATUS_ID_EVIL)) | |
4712 data |= AIM_ICQ_STATE_EVIL; | |
4713 else if (!strcmp(status_id, OSCAR_STATUS_ID_DEPRESSION)) | |
4714 data |= AIM_ICQ_STATE_DEPRESSION; | |
4715 else if (!strcmp(status_id, OSCAR_STATUS_ID_ATWORK)) | |
4716 data |= AIM_ICQ_STATE_ATWORK; | |
4717 else if (!strcmp(status_id, OSCAR_STATUS_ID_ATHOME)) | |
4718 data |= AIM_ICQ_STATE_ATHOME; | |
4719 else if (!strcmp(status_id, OSCAR_STATUS_ID_LUNCH)) | |
4720 data |= AIM_ICQ_STATE_LUNCH; | |
4632 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) | 4721 else if (!strcmp(status_id, OSCAR_STATUS_ID_CUSTOM)) |
4633 data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; | 4722 data |= AIM_ICQ_STATE_OUT | AIM_ICQ_STATE_AWAY; |
4634 | 4723 |
4724 | |
4635 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL); | 4725 aim_srv_setextrainfo(od, TRUE, data, FALSE, NULL, NULL); |
4726 | |
4636 } | 4727 } |
4637 | 4728 |
4638 static void | 4729 static void |
4639 oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, | 4730 oscar_set_info_and_status(PurpleAccount *account, gboolean setinfo, const char *rawinfo, |
4640 gboolean setstatus, PurpleStatus *status) | 4731 gboolean setstatus, PurpleStatus *status) |
5775 return "hiptop"; | 5866 return "hiptop"; |
5776 if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM) | 5867 if (userinfo->capabilities & OSCAR_CAPABILITY_SECUREIM) |
5777 return "secure"; | 5868 return "secure"; |
5778 if (userinfo->icqinfo.status & AIM_ICQ_STATE_BIRTHDAY) | 5869 if (userinfo->icqinfo.status & AIM_ICQ_STATE_BIRTHDAY) |
5779 return "birthday"; | 5870 return "birthday"; |
5871 return aim_get_custom_icon_filename(userinfo->customicon); | |
5780 } | 5872 } |
5781 return NULL; | 5873 return NULL; |
5782 } | 5874 } |
5783 | 5875 |
5784 void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) | 5876 void oscar_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
5996 purple_value_new(PURPLE_TYPE_STRING), | 6088 purple_value_new(PURPLE_TYPE_STRING), |
5997 "itmsurl", _("iTunes Music Store Link"), | 6089 "itmsurl", _("iTunes Music Store Link"), |
5998 purple_value_new(PURPLE_TYPE_STRING), NULL); | 6090 purple_value_new(PURPLE_TYPE_STRING), NULL); |
5999 status_types = g_list_prepend(status_types, type); | 6091 status_types = g_list_prepend(status_types, type); |
6000 | 6092 |
6001 type = purple_status_type_new_full(PURPLE_STATUS_AVAILABLE, | 6093 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, |
6002 OSCAR_STATUS_ID_FREE4CHAT, | 6094 OSCAR_STATUS_ID_FREE4CHAT, |
6003 _("Free For Chat"), TRUE, is_icq, FALSE); | 6095 _("Free For Chat"), TRUE, is_icq, FALSE, |
6096 "message", _("Message"), | |
6097 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6098 | |
6099 status_types = g_list_prepend(status_types, type); | |
6100 | |
6101 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
6102 OSCAR_STATUS_ID_EVIL, | |
6103 _("Evil"), TRUE, is_icq, FALSE, | |
6104 "message", _("Message"), | |
6105 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6106 status_types = g_list_prepend(status_types, type); | |
6107 | |
6108 | |
6109 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
6110 OSCAR_STATUS_ID_DEPRESSION, | |
6111 _("Depression"), TRUE, is_icq, FALSE, | |
6112 "message", _("Message"), | |
6113 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6114 status_types = g_list_prepend(status_types, type); | |
6115 | |
6116 | |
6117 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
6118 OSCAR_STATUS_ID_ATHOME, | |
6119 _("At home"), TRUE, is_icq, FALSE, | |
6120 "message", _("Message"), | |
6121 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6122 status_types = g_list_prepend(status_types, type); | |
6123 | |
6124 | |
6125 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
6126 OSCAR_STATUS_ID_ATWORK, | |
6127 _("At work"), TRUE, is_icq, FALSE, | |
6128 "message", _("Message"), | |
6129 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6130 | |
6131 status_types = g_list_prepend(status_types, type); | |
6132 | |
6133 | |
6134 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, | |
6135 OSCAR_STATUS_ID_LUNCH, | |
6136 _("Lunch"), TRUE, is_icq, FALSE, | |
6137 "message", _("Message"), | |
6138 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6139 | |
6004 status_types = g_list_prepend(status_types, type); | 6140 status_types = g_list_prepend(status_types, type); |
6005 | 6141 |
6006 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, | 6142 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, |
6007 OSCAR_STATUS_ID_AWAY, | 6143 OSCAR_STATUS_ID_AWAY, |
6008 NULL, TRUE, TRUE, FALSE, | 6144 NULL, TRUE, TRUE, FALSE, |
6009 "message", _("Message"), | 6145 "message", _("Message"), |
6010 purple_value_new(PURPLE_TYPE_STRING), NULL); | 6146 purple_value_new(PURPLE_TYPE_STRING), NULL); |
6011 status_types = g_list_prepend(status_types, type); | 6147 status_types = g_list_prepend(status_types, type); |
6012 | 6148 |
6013 type = purple_status_type_new_full(PURPLE_STATUS_INVISIBLE, | 6149 type = purple_status_type_new_with_attrs(PURPLE_STATUS_INVISIBLE, |
6014 OSCAR_STATUS_ID_INVISIBLE, | 6150 OSCAR_STATUS_ID_INVISIBLE, |
6015 NULL, TRUE, TRUE, FALSE); | 6151 NULL, TRUE, TRUE, FALSE, |
6152 "message", _("Message"), | |
6153 purple_value_new(PURPLE_TYPE_STRING), NULL); | |
6154 | |
6016 status_types = g_list_prepend(status_types, type); | 6155 status_types = g_list_prepend(status_types, type); |
6017 | 6156 |
6018 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE); | 6157 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, OSCAR_STATUS_ID_MOBILE, NULL, FALSE, FALSE, TRUE); |
6019 status_types = g_list_prepend(status_types, type); | 6158 status_types = g_list_prepend(status_types, type); |
6020 | 6159 |
6178 gc = purple_account_get_connection(buddy->account); | 6317 gc = purple_account_get_connection(buddy->account); |
6179 | 6318 |
6180 aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003); | 6319 aim_locate_getinfoshort(gc->proto_data, purple_buddy_get_name(buddy), 0x00000003); |
6181 } | 6320 } |
6182 | 6321 |
6322 static void oscar_get_icqxstatusmsg (PurpleBlistNode *node, gpointer ignore) | |
6323 { | |
6324 PurpleBuddy *buddy; | |
6325 PurpleConnection *gc; | |
6326 PurpleAccount *account; | |
6327 | |
6328 | |
6329 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | |
6330 | |
6331 buddy = (PurpleBuddy *)node; | |
6332 gc = purple_account_get_connection(buddy->account); | |
6333 account = purple_connection_get_account(gc); | |
6334 purple_debug_info("oscar", "Manual X-Status Get From %s to %s:\n", purple_buddy_get_name(buddy), account->username); | |
6335 | |
6336 icq_im_xstatus_request(gc->proto_data, purple_buddy_get_name(buddy)); | |
6337 } | |
6338 | |
6183 static GList * | 6339 static GList * |
6184 oscar_buddy_menu(PurpleBuddy *buddy) { | 6340 oscar_buddy_menu(PurpleBuddy *buddy) { |
6185 | 6341 |
6186 PurpleConnection *gc; | 6342 PurpleConnection *gc; |
6187 OscarData *od; | 6343 OscarData *od; |
6205 act = purple_menu_action_new(_("Edit Buddy Comment"), | 6361 act = purple_menu_action_new(_("Edit Buddy Comment"), |
6206 PURPLE_CALLBACK(oscar_buddycb_edit_comment), | 6362 PURPLE_CALLBACK(oscar_buddycb_edit_comment), |
6207 NULL, NULL); | 6363 NULL, NULL); |
6208 menu = g_list_prepend(menu, act); | 6364 menu = g_list_prepend(menu, act); |
6209 | 6365 |
6210 #if 0 | |
6211 if (od->icq) | 6366 if (od->icq) |
6212 { | 6367 { |
6213 act = purple_menu_action_new(_("Get Status Msg"), | 6368 act = purple_menu_action_new(_("Get X-Status Msg"), |
6214 PURPLE_CALLBACK(oscar_get_icqstatusmsg), | 6369 PURPLE_CALLBACK(oscar_get_icqxstatusmsg), |
6215 NULL, NULL); | 6370 NULL, NULL); |
6216 menu = g_list_prepend(menu, act); | 6371 menu = g_list_prepend(menu, act); |
6217 } | 6372 } |
6218 #endif | 6373 |
6219 | 6374 |
6220 if (userinfo && | 6375 if (userinfo && |
6221 aim_sncmp(purple_account_get_username(buddy->account), buddy->name) && | 6376 aim_sncmp(purple_account_get_username(buddy->account), buddy->name) && |
6222 PURPLE_BUDDY_IS_ONLINE(buddy)) | 6377 PURPLE_BUDDY_IS_ONLINE(buddy)) |
6223 { | 6378 { |
6597 purple_xfer_request_accepted(xfer, file); | 6752 purple_xfer_request_accepted(xfer, file); |
6598 else | 6753 else |
6599 purple_xfer_request(xfer); | 6754 purple_xfer_request(xfer); |
6600 } | 6755 } |
6601 | 6756 |
6757 static void | |
6758 oscar_show_icq_custom_icons_cb(PurpleConnection *gc, PurpleRequestFields *fields) { | |
6759 OscarData *od = gc->proto_data; | |
6760 PurpleAccount *account = purple_connection_get_account(gc); | |
6761 PurpleRequestField *f; | |
6762 GList *l; | |
6763 | |
6764 f = purple_request_fields_get_field(fields, "customicon"); | |
6765 l = purple_request_field_list_get_selected(f); | |
6766 | |
6767 if (l) { | |
6768 gpointer d = purple_request_field_list_get_data(f, l->data); | |
6769 purple_account_set_int(account, "customicon", GPOINTER_TO_INT(d)); | |
6770 } | |
6771 | |
6772 aim_locate_setcaps(od, purple_caps); | |
6773 } | |
6774 | |
6775 static void | |
6776 oscar_show_icq_custom_icons(PurplePluginAction *action) | |
6777 { | |
6778 guint32 i; | |
6779 gint32 customicon; | |
6780 PurpleConnection *gc = (PurpleConnection *) action->context; | |
6781 PurpleAccount *account = purple_connection_get_account(gc); | |
6782 PurpleRequestFields *fields; | |
6783 PurpleRequestFieldGroup *g; | |
6784 PurpleRequestField *f; | |
6785 char* na_fn; | |
6786 | |
6787 customicon = purple_account_get_int(account, "customicon", 0); | |
6788 | |
6789 fields = purple_request_fields_new(); | |
6790 | |
6791 g = purple_request_field_group_new(NULL); | |
6792 | |
6793 f = purple_request_field_list_new("customicon", _("XStatus")); | |
6794 | |
6795 purple_request_field_list_set_pixbuf(f, TRUE); | |
6796 | |
6797 na_fn = g_build_filename("pixmaps", "pidgin", "emblems", "16", "not-authorized.png", NULL); | |
6798 | |
6799 purple_request_field_list_add_icon(f, _("None"), na_fn, GINT_TO_POINTER(-1)); | |
6800 if (customicon == 0) | |
6801 purple_request_field_list_add_selected(f, _("None")); | |
6802 | |
6803 g_free(na_fn); | |
6804 | |
6805 for (i = 1; i < aim_get_custom_icons_count(); i++) { | |
6806 char* icon_path = g_strdup_printf("%s.png", aim_get_custom_icon_filename(i)); | |
6807 char* filename = g_build_filename("pixmaps", "pidgin", "emblems", "16", icon_path, NULL); | |
6808 | |
6809 purple_request_field_list_add_icon(f, _(aim_get_custom_icon_descriptivename(i)), filename, GINT_TO_POINTER(i)); | |
6810 | |
6811 if (customicon == i) | |
6812 purple_request_field_list_add_selected(f, _(aim_get_custom_icon_descriptivename(i))); | |
6813 | |
6814 g_free(filename); | |
6815 g_free(icon_path); | |
6816 } | |
6817 purple_request_field_group_add_field(g, f); | |
6818 | |
6819 purple_request_fields_add_group(fields, g); | |
6820 | |
6821 purple_request_fields(gc, _("Set Custom Icon"), _("Set Custom Icon"), | |
6822 NULL, fields, | |
6823 _("OK"), G_CALLBACK(oscar_show_icq_custom_icons_cb), | |
6824 _("Cancel"), NULL, | |
6825 purple_connection_get_account(gc), NULL, NULL, | |
6826 gc); | |
6827 } | |
6828 | |
6829 | |
6602 GList * | 6830 GList * |
6603 oscar_actions(PurplePlugin *plugin, gpointer context) | 6831 oscar_actions(PurplePlugin *plugin, gpointer context) |
6604 { | 6832 { |
6605 PurpleConnection *gc = (PurpleConnection *) context; | 6833 PurpleConnection *gc = (PurpleConnection *) context; |
6606 OscarData *od = gc->proto_data; | 6834 OscarData *od = gc->proto_data; |
6638 if (od->icq) | 6866 if (od->icq) |
6639 { | 6867 { |
6640 /* ICQ actions */ | 6868 /* ICQ actions */ |
6641 act = purple_plugin_action_new(_("Set Privacy Options..."), | 6869 act = purple_plugin_action_new(_("Set Privacy Options..."), |
6642 oscar_show_icq_privacy_opts); | 6870 oscar_show_icq_privacy_opts); |
6871 menu = g_list_prepend(menu, act); | |
6872 | |
6873 act = purple_plugin_action_new(_("Set Custom Icon..."), | |
6874 oscar_show_icq_custom_icons); | |
6643 menu = g_list_prepend(menu, act); | 6875 menu = g_list_prepend(menu, act); |
6644 } | 6876 } |
6645 else | 6877 else |
6646 { | 6878 { |
6647 /* AIM actions */ | 6879 /* AIM actions */ |