Wed, 12 Sep 2007 19:11:38 +0000
propagate from branch 'im.pidgin.pidgin' (head 447ebf410d618d48003894dc348f9f0e1616e1e7)
to branch 'org.maemo.garage.pidgin.pidgin.dialog-transience' (head 3f641641f3d6a62f9e576bca75c065e619a97a29)
| 2681 | 1 | /* |
| 15884 | 2 | * purple |
| 2681 | 3 | * |
| 15884 | 4 | * Purple is the legal property of its developers, whose names are too numerous |
| 8046 | 5 | * to list here. Please refer to the COPYRIGHT file distributed with this |
| 6 | * source distribution. | |
| 2681 | 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify | |
| 9 | * it under the terms of the GNU General Public License as published by | |
| 10 | * the Free Software Foundation; either version 2 of the License, or | |
| 11 | * (at your option) any later version. | |
| 12 | * | |
| 13 | * This program is distributed in the hope that it will be useful, | |
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 16 | * GNU General Public License for more details. | |
| 17 | * | |
| 18 | * You should have received a copy of the GNU General Public License | |
| 19 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19850
diff
changeset
|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 2681 | 21 | * |
| 22 | */ | |
| 9369 | 23 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
24 | #include "internal.h" |
| 2681 | 25 | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
26 | #include "account.h" |
|
5638
53e752c88ea1
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5590
diff
changeset
|
27 | #include "accountopt.h" |
| 6760 | 28 | #include "blist.h" |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
29 | #include "cipher.h" |
| 10119 | 30 | #include "cmds.h" |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
31 | #include "core.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
32 | #include "debug.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
33 | #include "notify.h" |
| 6760 | 34 | #include "privacy.h" |
| 2681 | 35 | #include "prpl.h" |
| 36 | #include "proxy.h" | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
37 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
38 | #include "server.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
39 | #include "util.h" |
| 9943 | 40 | #include "version.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
41 | |
| 6513 | 42 | #include "yahoo.h" |
| 6729 | 43 | #include "yahoochat.h" |
|
19058
9facc10e1c01
Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents:
19053
diff
changeset
|
44 | #include "yahoo_aliases.h" |
| 8349 | 45 | #include "yahoo_auth.h" |
|
12417
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
46 | #include "yahoo_crypt.h" |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
47 | #include "yahoo_doodle.h" |
|
12417
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
48 | #include "yahoo_filexfer.h" |
|
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
49 | #include "yahoo_friend.h" |
|
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
50 | #include "yahoo_packet.h" |
|
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
51 | #include "yahoo_picture.h" |
|
ad19b5a4b41d
[gaim-migrate @ 14724]
Richard Laager <rlaager@pidgin.im>
parents:
12378
diff
changeset
|
52 | #include "ycht.h" |
|
2795
b2e15894ab75
[gaim-migrate @ 2808]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2786
diff
changeset
|
53 | |
|
5493
f30de3b116ea
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
54 | /* #define YAHOO_DEBUG */ |
| 2681 | 55 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
56 | /* #define TRY_WEBMESSENGER_LOGIN 0 */ |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
57 | |
| 15884 | 58 | static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *, PurpleGroup *); |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
59 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 15884 | 60 | static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
61 | #endif |
| 15884 | 62 | static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status); |
| 9306 | 63 | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
64 | static void |
| 15884 | 65 | yahoo_add_permit(PurpleConnection *gc, const char *who) |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
66 | { |
| 15884 | 67 | purple_debug_info("yahoo", |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
68 | "Permitting ID %s local contact rights for account %s\n", who, gc->account); |
| 15884 | 69 | purple_privacy_permit_add(gc->account,who,TRUE); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
70 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
71 | |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
72 | static void |
| 15884 | 73 | yahoo_rem_permit(PurpleConnection *gc, const char *who) |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
74 | { |
| 15884 | 75 | purple_debug_info("yahoo", |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
76 | "Denying ID %s local contact rights for account %s\n", who, gc->account); |
| 15884 | 77 | purple_privacy_permit_remove(gc->account,who,TRUE); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
78 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
79 | |
| 16527 | 80 | gboolean |
| 81 | yahoo_privacy_check(PurpleConnection *gc, const char *who) | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
82 | { |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
83 | /* returns TRUE if allowed through, FALSE otherwise */ |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
84 | gboolean permitted; |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
85 | |
| 15884 | 86 | permitted = purple_privacy_check(gc->account, who); |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
87 | |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
88 | /* print some debug info */ |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
89 | if (!permitted) { |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
90 | char *deb = NULL; |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
91 | switch (gc->account->perm_deny) |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
92 | { |
| 15884 | 93 | case PURPLE_PRIVACY_DENY_ALL: |
| 94 | deb = "PURPLE_PRIVACY_DENY_ALL"; | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
95 | break; |
| 15884 | 96 | case PURPLE_PRIVACY_DENY_USERS: |
| 97 | deb = "PURPLE_PRIVACY_DENY_USERS"; | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
98 | break; |
| 15884 | 99 | case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
| 100 | deb = "PURPLE_PRIVACY_ALLOW_BUDDYLIST"; | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
101 | break; |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
102 | } |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
103 | if(deb) |
| 15884 | 104 | purple_debug_info("yahoo", |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
105 | "%s blocked data received from %s (%s)\n", |
|
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
106 | gc->account->username,who, deb); |
| 15884 | 107 | } else if (gc->account->perm_deny == PURPLE_PRIVACY_ALLOW_USERS) { |
| 108 | purple_debug_info("yahoo", | |
| 109 | "%s allowed data received from %s (PURPLE_PRIVACY_ALLOW_USERS)\n", | |
|
11111
4621d9b973a4
[gaim-migrate @ 13163]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11109
diff
changeset
|
110 | gc->account->username,who); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
111 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
112 | |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
113 | return permitted; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
114 | } |
| 6784 | 115 | |
| 15884 | 116 | static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) |
| 6784 | 117 | { |
| 9983 | 118 | char *status = NULL; |
| 6840 | 119 | |
| 15884 | 120 | if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) |
| 6784 | 121 | return; |
| 122 | ||
| 6840 | 123 | if (f->status == YAHOO_STATUS_OFFLINE) |
|
11250
f541803353ed
[gaim-migrate @ 13419]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11188
diff
changeset
|
124 | { |
|
f541803353ed
[gaim-migrate @ 13419]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11188
diff
changeset
|
125 | return; |
|
f541803353ed
[gaim-migrate @ 13419]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11188
diff
changeset
|
126 | } |
| 6840 | 127 | |
| 9983 | 128 | switch (f->status) { |
| 129 | case YAHOO_STATUS_AVAILABLE: | |
| 10373 | 130 | status = YAHOO_STATUS_TYPE_AVAILABLE; |
| 9983 | 131 | break; |
| 132 | case YAHOO_STATUS_BRB: | |
| 10373 | 133 | status = YAHOO_STATUS_TYPE_BRB; |
| 9983 | 134 | break; |
| 135 | case YAHOO_STATUS_BUSY: | |
| 10373 | 136 | status = YAHOO_STATUS_TYPE_BUSY; |
| 9983 | 137 | break; |
| 138 | case YAHOO_STATUS_NOTATHOME: | |
| 10373 | 139 | status = YAHOO_STATUS_TYPE_NOTATHOME; |
| 9983 | 140 | break; |
| 141 | case YAHOO_STATUS_NOTATDESK: | |
| 10373 | 142 | status = YAHOO_STATUS_TYPE_NOTATDESK; |
| 9983 | 143 | break; |
| 144 | case YAHOO_STATUS_NOTINOFFICE: | |
| 10373 | 145 | status = YAHOO_STATUS_TYPE_NOTINOFFICE; |
| 9983 | 146 | break; |
| 147 | case YAHOO_STATUS_ONPHONE: | |
| 10373 | 148 | status = YAHOO_STATUS_TYPE_ONPHONE; |
| 9983 | 149 | break; |
| 150 | case YAHOO_STATUS_ONVACATION: | |
| 10373 | 151 | status = YAHOO_STATUS_TYPE_ONVACATION; |
| 9983 | 152 | break; |
| 153 | case YAHOO_STATUS_OUTTOLUNCH: | |
| 10373 | 154 | status = YAHOO_STATUS_TYPE_OUTTOLUNCH; |
| 9983 | 155 | break; |
| 156 | case YAHOO_STATUS_STEPPEDOUT: | |
| 10373 | 157 | status = YAHOO_STATUS_TYPE_STEPPEDOUT; |
| 9983 | 158 | break; |
| 159 | case YAHOO_STATUS_INVISIBLE: /* this should never happen? */ | |
| 10373 | 160 | status = YAHOO_STATUS_TYPE_INVISIBLE; |
| 9983 | 161 | break; |
| 162 | case YAHOO_STATUS_CUSTOM: | |
|
13688
240e5b90adb4
[gaim-migrate @ 16089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13559
diff
changeset
|
163 | case YAHOO_STATUS_IDLE: |
| 9983 | 164 | if (!f->away) |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
165 | status = YAHOO_STATUS_TYPE_AVAILABLE; |
| 9983 | 166 | else |
| 10373 | 167 | status = YAHOO_STATUS_TYPE_AWAY; |
| 9983 | 168 | break; |
| 169 | default: | |
| 15884 | 170 | purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); |
| 9983 | 171 | break; |
| 172 | } | |
| 173 | ||
| 174 | if (status) { | |
| 175 | if (f->status == YAHOO_STATUS_CUSTOM) | |
| 15884 | 176 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", |
| 9983 | 177 | yahoo_friend_get_status_message(f), NULL); |
| 178 | else | |
| 15884 | 179 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); |
| 9983 | 180 | } |
| 181 | ||
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
182 | if (f->idle != 0) |
| 15884 | 183 | purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle); |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
184 | else |
| 15884 | 185 | purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); |
| 15589 | 186 | |
| 187 | if (f->sms) | |
| 15884 | 188 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); |
| 15589 | 189 | else |
| 15884 | 190 | purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); |
| 6784 | 191 | } |
| 192 | ||
| 15884 | 193 | static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 194 | { |
| 15884 | 195 | PurpleAccount *account = purple_connection_get_account(gc); |
| 2681 | 196 | struct yahoo_data *yd = gc->proto_data; |
| 197 | GSList *l = pkt->hash; | |
| 9278 | 198 | YahooFriend *f = NULL; |
| 2681 | 199 | char *name = NULL; |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
200 | gboolean unicode = FALSE; |
|
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
201 | char *message = NULL; |
| 6784 | 202 | |
| 7892 | 203 | if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { |
| 8383 | 204 | gc->wants_to_die = TRUE; |
| 15884 | 205 | purple_connection_error(gc, _("You have signed on from another location.")); |
| 7892 | 206 | return; |
| 207 | } | |
| 6686 | 208 | |
| 2681 | 209 | while (l) { |
| 210 | struct yahoo_pair *pair = l->data; | |
| 211 | ||
| 212 | switch (pair->key) { | |
| 213 | case 0: /* we won't actually do anything with this */ | |
| 214 | break; | |
| 215 | case 1: /* we don't get the full buddy list here. */ | |
|
2805
31c7645db097
[gaim-migrate @ 2818]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2795
diff
changeset
|
216 | if (!yd->logged_in) { |
| 15884 | 217 | purple_connection_set_display_name(gc, pair->value); |
| 218 | purple_connection_set_state(gc, PURPLE_CONNECTED); | |
|
2805
31c7645db097
[gaim-migrate @ 2818]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2795
diff
changeset
|
219 | yd->logged_in = TRUE; |
| 9306 | 220 | if (yd->picture_upload_todo) { |
| 221 | yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); | |
| 222 | yd->picture_upload_todo = NULL; | |
| 223 | } | |
| 15884 | 224 | yahoo_set_status(account, purple_account_get_active_status(account)); |
| 2681 | 225 | |
| 3147 | 226 | /* this requests the list. i have a feeling that this is very evil |
| 227 | * | |
| 6686 | 228 | * scs.yahoo.com sends you the list before this packet without it being |
| 3147 | 229 | * requested |
| 230 | * | |
| 231 | * do_import(gc, NULL); | |
| 232 | * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0); | |
| 10392 | 233 | * yahoo_packet_send_and_free(newpkt, yd); |
| 3147 | 234 | */ |
| 235 | ||
| 236 | } | |
| 2681 | 237 | break; |
| 238 | case 8: /* how many online buddies we have */ | |
| 239 | break; | |
| 240 | case 7: /* the current buddy */ | |
|
19609
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
241 | /* update the previous buddy before changing the variables */ |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
242 | if (f) { |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
243 | if (message) |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
244 | yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
245 | if (name) |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
246 | yahoo_update_status(gc, name, f); |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
247 | } |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
248 | name = message = NULL; |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
249 | f = NULL; |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
250 | if (pair->value && g_utf8_validate(pair->value, -1, NULL)) { |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
251 | name = pair->value; |
| 9886 | 252 | f = yahoo_friend_find_or_new(gc, name); |
| 9888 | 253 | } |
| 2681 | 254 | break; |
| 255 | case 10: /* state */ | |
| 6784 | 256 | if (!f) |
| 257 | break; | |
| 258 | ||
| 259 | f->status = strtol(pair->value, NULL, 10); | |
| 260 | if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT)) | |
| 261 | f->away = 1; | |
| 262 | else | |
| 263 | f->away = 0; | |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
264 | |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
265 | if (f->status == YAHOO_STATUS_IDLE) { |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
266 | /* Idle may have already been set in a more precise way in case 137 */ |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
267 | if (f->idle == 0) |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
268 | f->idle = time(NULL); |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
269 | } else |
| 6804 | 270 | f->idle = 0; |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
271 | |
| 9283 | 272 | if (f->status != YAHOO_STATUS_CUSTOM) |
| 273 | yahoo_friend_set_status_message(f, NULL); | |
| 6847 | 274 | |
| 275 | f->sms = 0; | |
| 2681 | 276 | break; |
| 277 | case 19: /* custom message */ | |
| 9283 | 278 | if (f) |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
279 | message = pair->value; |
| 2681 | 280 | break; |
| 6686 | 281 | case 11: /* this is the buddy's session id */ |
| 2681 | 282 | break; |
| 283 | case 17: /* in chat? */ | |
| 284 | break; | |
| 6784 | 285 | case 47: /* is custom status away or not? 2=idle*/ |
| 286 | if (!f) | |
| 287 | break; | |
| 8441 | 288 | |
| 289 | /* I have no idea what it means when this is | |
| 290 | * set when someone's available, but it doesn't | |
| 291 | * mean idle. */ | |
| 292 | if (f->status == YAHOO_STATUS_AVAILABLE) | |
| 293 | break; | |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
294 | |
| 6784 | 295 | f->away = strtol(pair->value, NULL, 10); |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
296 | if (f->away == 2) { |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
297 | /* Idle may have already been set in a more precise way in case 137 */ |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
298 | if (f->idle == 0) |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
299 | f->idle = time(NULL); |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
300 | } |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
301 | |
| 6686 | 302 | break; |
| 6784 | 303 | case 138: /* either we're not idle, or we are but won't say how long */ |
| 304 | if (!f) | |
| 305 | break; | |
| 306 | ||
| 307 | if (f->idle) | |
| 308 | f->idle = -1; | |
| 309 | break; | |
| 310 | case 137: /* usually idle time in seconds, sometimes login time */ | |
| 311 | if (!f) | |
| 312 | break; | |
| 313 | ||
| 314 | if (f->status != YAHOO_STATUS_AVAILABLE) | |
| 315 | f->idle = time(NULL) - strtol(pair->value, NULL, 10); | |
| 6686 | 316 | break; |
| 317 | case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ | |
| 6784 | 318 | if (strtol(pair->value, NULL, 10) == 0) { |
| 319 | if (f) | |
| 320 | f->status = YAHOO_STATUS_OFFLINE; | |
| 15589 | 321 | if (name) { |
| 15884 | 322 | purple_prpl_got_user_status(account, name, "offline", NULL); |
| 323 | purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); | |
| 15589 | 324 | } |
|
2807
fe1ea0453890
[gaim-migrate @ 2820]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2805
diff
changeset
|
325 | break; |
|
2805
31c7645db097
[gaim-migrate @ 2818]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2795
diff
changeset
|
326 | } |
| 6784 | 327 | break; |
| 328 | case 60: /* SMS */ | |
| 329 | if (f) { | |
| 330 | f->sms = strtol(pair->value, NULL, 10); | |
| 331 | yahoo_update_status(gc, name, f); | |
|
2771
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
332 | } |
|
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
333 | break; |
| 9292 | 334 | case 197: /* Avatars */ |
| 9277 | 335 | { |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
336 | guchar *decoded; |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
337 | char *tmp; |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
338 | gsize len; |
| 9277 | 339 | |
| 340 | if (pair->value) { | |
| 15884 | 341 | decoded = purple_base64_decode(pair->value, &len); |
| 9277 | 342 | if (len) { |
| 15884 | 343 | tmp = purple_str_binary_to_ascii(decoded, len); |
| 344 | purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); | |
| 9277 | 345 | g_free(tmp); |
| 346 | } | |
| 347 | g_free(decoded); | |
| 348 | } | |
| 349 | break; | |
| 350 | } | |
| 9292 | 351 | case 192: /* Pictures, aka Buddy Icons, checksum */ |
| 352 | { | |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16007
diff
changeset
|
353 | /* FIXME: Please, if you know this protocol, |
|
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16007
diff
changeset
|
354 | * FIXME: fix up the strtol() stuff if possible. */ |
| 9292 | 355 | int cksum = strtol(pair->value, NULL, 10); |
|
16606
b31fca4f6f60
Thanks to Bleeter, yahoo will not crash for non-existent buddyicons anymore.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16545
diff
changeset
|
356 | const char *locksum = NULL; |
| 15884 | 357 | PurpleBuddy *b; |
| 9292 | 358 | |
| 359 | if (!name) | |
| 360 | break; | |
| 361 | ||
| 15884 | 362 | b = purple_find_buddy(gc->account, name); |
| 9325 | 363 | |
| 9292 | 364 | if (!cksum || (cksum == -1)) { |
| 9325 | 365 | if (f) |
| 366 | yahoo_friend_set_buddy_icon_need_request(f, TRUE); | |
|
16534
2ab9e23f99d9
Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@pidgin.im>
parents:
16007
diff
changeset
|
367 | purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); |
| 9292 | 368 | break; |
| 369 | } | |
| 370 | ||
| 371 | if (!f) | |
| 372 | break; | |
| 9325 | 373 | |
| 9292 | 374 | yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
|
17151
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
375 | if (b) { |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
376 | locksum = purple_buddy_icons_get_checksum_for_user(b); |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
377 | if (!locksum || (cksum != strtol(locksum, NULL, 10))) |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
378 | yahoo_send_picture_request(gc, name); |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
379 | } |
| 9292 | 380 | |
| 381 | break; | |
| 382 | } | |
| 2979 | 383 | case 16: /* Custom error message */ |
| 7827 | 384 | { |
| 385 | char *tmp = yahoo_string_decode(gc, pair->value, TRUE); | |
| 15884 | 386 | purple_notify_error(gc, NULL, tmp, NULL); |
| 7827 | 387 | g_free(tmp); |
| 388 | } | |
| 2951 | 389 | break; |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
390 | case 97: /* Unicode status message */ |
|
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
391 | unicode = !strcmp(pair->value, "1"); |
|
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
392 | break; |
|
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
393 | |
| 2681 | 394 | default: |
| 15884 | 395 | purple_debug(PURPLE_DEBUG_ERROR, "yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
396 | "Unknown status key %d\n", pair->key); |
| 2681 | 397 | break; |
| 398 | } | |
| 399 | ||
| 400 | l = l->next; | |
| 401 | } | |
| 10553 | 402 | |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
403 | if (message && f) |
|
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
404 | yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
405 | |
| 10553 | 406 | if (name && f) /* update the last buddy */ |
| 407 | yahoo_update_status(gc, name, f); | |
| 2681 | 408 | } |
| 409 | ||
| 15884 | 410 | static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) |
| 6820 | 411 | { |
| 15884 | 412 | PurpleBuddy *b; |
| 413 | PurpleGroup *g; | |
| 6820 | 414 | GSList *list, *i; |
| 415 | gboolean onlist = 0; | |
| 416 | char *oname = NULL; | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
417 | char **oname_p = &oname; |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
418 | GSList **list_p = &list; |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
419 | |
| 15884 | 420 | if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) |
| 421 | list = purple_find_buddies(account, name); | |
| 6820 | 422 | else |
| 423 | g_hash_table_steal(ht, name); | |
| 424 | ||
| 425 | for (i = list; i; i = i->next) { | |
| 426 | b = i->data; | |
| 15884 | 427 | g = purple_buddy_get_group(b); |
| 428 | if (!purple_utf8_strcasecmp(group, g->name)) { | |
| 429 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", | |
| 6820 | 430 | "Oh good, %s is in the right group (%s).\n", name, group); |
| 431 | list = g_slist_delete_link(list, i); | |
| 432 | onlist = 1; | |
| 433 | break; | |
| 434 | } | |
| 435 | } | |
| 436 | ||
| 437 | if (!onlist) { | |
| 15884 | 438 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
| 6820 | 439 | "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); |
| 15884 | 440 | if (!(g = purple_find_group(group))) { |
| 441 | g = purple_group_new(group); | |
| 442 | purple_blist_add_group(g, NULL); | |
| 6820 | 443 | } |
| 15884 | 444 | b = purple_buddy_new(account, name, NULL); |
| 445 | purple_blist_add_buddy(b, NULL, g, NULL); | |
| 6820 | 446 | } |
| 447 | ||
| 448 | if (list) { | |
| 449 | if (!oname) | |
| 15884 | 450 | oname = g_strdup(purple_normalize(account, name)); |
| 6820 | 451 | g_hash_table_insert(ht, oname, list); |
| 452 | } else if (oname) | |
| 453 | g_free(oname); | |
| 454 | } | |
| 455 | ||
| 456 | static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) | |
| 457 | { | |
| 458 | char *name = key; | |
| 459 | GSList *list = value, *i; | |
| 15884 | 460 | PurpleBuddy *b; |
| 461 | PurpleGroup *g; | |
| 6820 | 462 | |
| 463 | for (i = list; i; i = i->next) { | |
| 464 | b = i->data; | |
| 15884 | 465 | g = purple_buddy_get_group(b); |
| 466 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name); | |
| 467 | purple_blist_remove_buddy(b); | |
| 6820 | 468 | } |
| 469 | } | |
| 470 | ||
| 7651 | 471 | static char *_getcookie(char *rawcookie) |
| 472 | { | |
| 473 | char *cookie = NULL; | |
| 474 | char *tmpcookie; | |
| 475 | char *cookieend; | |
| 476 | ||
| 477 | if (strlen(rawcookie) < 2) | |
| 478 | return NULL; | |
| 479 | tmpcookie = g_strdup(rawcookie+2); | |
| 480 | cookieend = strchr(tmpcookie, ';'); | |
| 481 | ||
| 482 | if (cookieend) | |
| 483 | *cookieend = '\0'; | |
| 484 | ||
| 485 | cookie = g_strdup(tmpcookie); | |
| 486 | g_free(tmpcookie); | |
| 487 | ||
| 488 | return cookie; | |
| 489 | } | |
| 490 | ||
| 491 | static void yahoo_process_cookie(struct yahoo_data *yd, char *c) | |
| 492 | { | |
| 493 | if (c[0] == 'Y') { | |
| 494 | if (yd->cookie_y) | |
| 495 | g_free(yd->cookie_y); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
496 | yd->cookie_y = _getcookie(c); |
| 7651 | 497 | } else if (c[0] == 'T') { |
| 498 | if (yd->cookie_t) | |
| 499 | g_free(yd->cookie_t); | |
| 500 | yd->cookie_t = _getcookie(c); | |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
501 | } else |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
502 | purple_debug_info("yahoo", "Ignoring unrecognized cookie '%c'\n", c[0]); |
| 7651 | 503 | } |
| 504 | ||
| 15884 | 505 | static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 14320 | 506 | { |
| 507 | GSList *l = pkt->hash; | |
| 508 | ||
| 15884 | 509 | PurpleAccount *account = purple_connection_get_account(gc); |
| 14320 | 510 | GHashTable *ht; |
| 511 | char *grp = NULL; | |
| 512 | char *norm_bud = NULL; | |
| 14362 | 513 | YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
| 514 | /* But what if you had no friends? */ | |
| 15884 | 515 | PurpleBuddy *b; |
| 516 | PurpleGroup *g; | |
| 14362 | 517 | |
| 14320 | 518 | |
| 519 | ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); | |
| 520 | ||
| 521 | while (l) { | |
| 522 | struct yahoo_pair *pair = l->data; | |
| 523 | l = l->next; | |
| 524 | ||
| 525 | switch (pair->key) { | |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
526 | case 302: |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
527 | /* This is always 318 before a group, 319 before the first s/n in a group, 320 before any ignored s/n. |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
528 | * It is not sent for s/n's in a group after the first. |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
529 | * All ignored s/n's are listed last, so when we see a 320 we clear the group and begin marking the |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
530 | * s/n's as ignored. It is always followed by an identical 300 key. |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
531 | */ |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
532 | if (pair->value && !strcmp(pair->value, "320")) { |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
533 | /* No longer in any group; this indicates the start of the ignore list. */ |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
534 | g_free(grp); |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
535 | grp = NULL; |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
536 | } |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
537 | |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
538 | break; |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
539 | case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
540 | break; |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
541 | case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ |
| 14320 | 542 | break; |
| 543 | case 65: /* This is the group */ | |
| 544 | g_free(grp); | |
| 545 | grp = yahoo_string_decode(gc, pair->value, FALSE); | |
| 546 | break; | |
| 547 | case 7: /* buddy's s/n */ | |
| 548 | g_free(norm_bud); | |
| 15884 | 549 | norm_bud = g_strdup(purple_normalize(account, pair->value)); |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
550 | |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
551 | if (grp) { |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
552 | /* This buddy is in a group */ |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
553 | f = yahoo_friend_find_or_new(gc, norm_bud); |
| 15884 | 554 | if (!(b = purple_find_buddy(account, norm_bud))) { |
| 555 | if (!(g = purple_find_group(grp))) { | |
| 556 | g = purple_group_new(grp); | |
| 557 | purple_blist_add_group(g, NULL); | |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
558 | } |
| 15884 | 559 | b = purple_buddy_new(account, norm_bud, NULL); |
| 560 | purple_blist_add_buddy(b, NULL, g, NULL); | |
| 14320 | 561 | } |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
562 | yahoo_do_group_check(account, ht, norm_bud, grp); |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
563 | |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
564 | } else { |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
565 | /* This buddy is on the ignore list (and therefore in no group) */ |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
566 | purple_privacy_deny_add(account, norm_bud, 1); |
| 14320 | 567 | } |
| 568 | break; | |
| 14346 | 569 | case 241: /* another protocol user */ |
| 14362 | 570 | if (f) { |
| 14346 | 571 | f->protocol = strtol(pair->value, NULL, 10); |
| 15884 | 572 | purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol); |
| 14362 | 573 | } |
| 14320 | 574 | break; |
|
19538
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
575 | case 317: /* Stealth Setting */ |
|
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
576 | if (f && (strtol(pair->value, NULL, 10) == 2)) { |
|
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
577 | f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
|
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
578 | } |
|
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
579 | break; |
| 14320 | 580 | /* case 242: */ /* this seems related to 241 */ |
| 581 | /* break; */ | |
| 582 | } | |
| 583 | } | |
| 584 | ||
| 585 | g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); | |
| 586 | g_hash_table_destroy(ht); | |
| 587 | g_free(grp); | |
| 588 | g_free(norm_bud); | |
| 589 | } | |
| 590 | ||
| 15884 | 591 | static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 592 | { |
| 593 | GSList *l = pkt->hash; | |
| 594 | gboolean export = FALSE; | |
| 6760 | 595 | gboolean got_serv_list = FALSE; |
| 15884 | 596 | PurpleBuddy *b; |
| 597 | PurpleGroup *g; | |
| 9278 | 598 | YahooFriend *f = NULL; |
| 15884 | 599 | PurpleAccount *account = purple_connection_get_account(gc); |
| 6784 | 600 | struct yahoo_data *yd = gc->proto_data; |
| 6820 | 601 | GHashTable *ht; |
| 6784 | 602 | |
| 603 | char **lines; | |
| 604 | char **split; | |
| 605 | char **buddies; | |
| 7823 | 606 | char **tmp, **bud, *norm_bud; |
| 7827 | 607 | char *grp = NULL; |
| 2681 | 608 | |
| 7651 | 609 | if (pkt->id) |
| 610 | yd->session_id = pkt->id; | |
| 611 | ||
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
612 | while (l) { |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
613 | struct yahoo_pair *pair = l->data; |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
614 | l = l->next; |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
615 | |
| 6760 | 616 | switch (pair->key) { |
| 617 | case 87: | |
| 6784 | 618 | if (!yd->tmp_serv_blist) |
| 619 | yd->tmp_serv_blist = g_string_new(pair->value); | |
| 620 | else | |
| 621 | g_string_append(yd->tmp_serv_blist, pair->value); | |
| 6760 | 622 | break; |
| 623 | case 88: | |
| 6784 | 624 | if (!yd->tmp_serv_ilist) |
| 625 | yd->tmp_serv_ilist = g_string_new(pair->value); | |
| 626 | else | |
| 627 | g_string_append(yd->tmp_serv_ilist, pair->value); | |
| 6760 | 628 | break; |
| 7651 | 629 | case 59: /* cookies, yum */ |
| 630 | yahoo_process_cookie(yd, pair->value); | |
| 631 | break; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
632 | case YAHOO_SERVICE_PRESENCE_PERM: |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
633 | if (!yd->tmp_serv_plist) |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
634 | yd->tmp_serv_plist = g_string_new(pair->value); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
635 | else |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
636 | g_string_append(yd->tmp_serv_plist, pair->value); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
637 | break; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
638 | } |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
639 | } |
| 2681 | 640 | |
| 6784 | 641 | if (pkt->status != 0) |
| 642 | return; | |
| 643 | ||
| 644 | if (yd->tmp_serv_blist) { | |
| 6820 | 645 | ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); |
| 646 | ||
| 6784 | 647 | lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1); |
| 648 | for (tmp = lines; *tmp; tmp++) { | |
| 649 | split = g_strsplit(*tmp, ":", 2); | |
| 650 | if (!split) | |
| 651 | continue; | |
| 652 | if (!split[0] || !split[1]) { | |
| 653 | g_strfreev(split); | |
| 654 | continue; | |
| 655 | } | |
| 7827 | 656 | grp = yahoo_string_decode(gc, split[0], FALSE); |
| 6784 | 657 | buddies = g_strsplit(split[1], ",", -1); |
| 658 | for (bud = buddies; bud && *bud; bud++) { | |
| 15884 | 659 | norm_bud = g_strdup(purple_normalize(account, *bud)); |
| 9279 | 660 | f = yahoo_friend_find_or_new(gc, norm_bud); |
| 661 | ||
| 15884 | 662 | if (!(b = purple_find_buddy(account, norm_bud))) { |
| 663 | if (!(g = purple_find_group(grp))) { | |
| 664 | g = purple_group_new(grp); | |
| 665 | purple_blist_add_group(g, NULL); | |
| 6784 | 666 | } |
| 15884 | 667 | b = purple_buddy_new(account, norm_bud, NULL); |
| 668 | purple_blist_add_buddy(b, NULL, g, NULL); | |
| 6784 | 669 | export = TRUE; |
| 6820 | 670 | } |
| 6784 | 671 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
672 | yahoo_do_group_check(account, ht, norm_bud, grp); |
| 7823 | 673 | g_free(norm_bud); |
| 6784 | 674 | } |
| 675 | g_strfreev(buddies); | |
| 676 | g_strfreev(split); | |
| 7827 | 677 | g_free(grp); |
| 6784 | 678 | } |
| 679 | g_strfreev(lines); | |
| 680 | ||
| 681 | g_string_free(yd->tmp_serv_blist, TRUE); | |
| 682 | yd->tmp_serv_blist = NULL; | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
683 | g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); |
| 6820 | 684 | g_hash_table_destroy(ht); |
| 6784 | 685 | } |
| 686 | ||
| 687 | if (yd->tmp_serv_ilist) { | |
| 688 | buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); | |
| 689 | for (bud = buddies; bud && *bud; bud++) { | |
| 690 | /* The server is already ignoring the user */ | |
| 691 | got_serv_list = TRUE; | |
| 15884 | 692 | purple_privacy_deny_add(gc->account, *bud, 1); |
| 6784 | 693 | } |
| 694 | g_strfreev(buddies); | |
| 695 | ||
| 696 | g_string_free(yd->tmp_serv_ilist, TRUE); | |
| 697 | yd->tmp_serv_ilist = NULL; | |
| 698 | } | |
| 699 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
700 | if (got_serv_list && |
| 15884 | 701 | ((gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && |
| 702 | (gc->account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && | |
| 703 | (gc->account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
704 | { |
| 15884 | 705 | gc->account->perm_deny = PURPLE_PRIVACY_DENY_USERS; |
| 706 | purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
707 | gc->account->username); |
| 6784 | 708 | } |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
709 | |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
710 | if (yd->tmp_serv_plist) { |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
711 | buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
712 | for (bud = buddies; bud && *bud; bud++) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
713 | f = yahoo_friend_find(gc, *bud); |
|
12138
fcf3d84824d7
[gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12088
diff
changeset
|
714 | if (f) { |
| 15884 | 715 | purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", |
|
12138
fcf3d84824d7
[gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12088
diff
changeset
|
716 | gc->account->username, *bud); |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
717 | f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
|
12138
fcf3d84824d7
[gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12088
diff
changeset
|
718 | } |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
719 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
720 | g_strfreev(buddies); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
721 | g_string_free(yd->tmp_serv_plist, TRUE); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
722 | yd->tmp_serv_plist = NULL; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
723 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
724 | } |
|
19058
9facc10e1c01
Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents:
19053
diff
changeset
|
725 | /* Now that we've got the list, request aliases */ |
|
9facc10e1c01
Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents:
19053
diff
changeset
|
726 | yahoo_fetch_aliases(gc); |
| 2681 | 727 | } |
| 728 | ||
| 15884 | 729 | static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2993 | 730 | { |
| 731 | char *msg = NULL; | |
| 732 | char *from = NULL; | |
| 3019 | 733 | char *stat = NULL; |
| 734 | char *game = NULL; | |
| 9278 | 735 | YahooFriend *f = NULL; |
| 2993 | 736 | GSList *l = pkt->hash; |
| 6784 | 737 | |
| 2993 | 738 | while (l) { |
| 739 | struct yahoo_pair *pair = l->data; | |
| 740 | if (pair->key == 4) | |
| 741 | from = pair->value; | |
| 742 | if (pair->key == 49) | |
| 743 | msg = pair->value; | |
| 3001 | 744 | if (pair->key == 13) |
| 3019 | 745 | stat = pair->value; |
| 746 | if (pair->key == 14) | |
| 747 | game = pair->value; | |
| 2993 | 748 | l = l->next; |
| 749 | } | |
| 3640 | 750 | |
| 6784 | 751 | if (!from || !msg) |
| 3640 | 752 | return; |
| 6686 | 753 | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
754 | if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
755 | && (yahoo_privacy_check(gc, from))) { |
| 3019 | 756 | if (*stat == '1') |
| 15884 | 757 | serv_got_typing(gc, from, 0, PURPLE_TYPING); |
| 3019 | 758 | else |
| 759 | serv_got_typing_stopped(gc, from); | |
| 4793 | 760 | } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
| 15884 | 761 | PurpleBuddy *bud = purple_find_buddy(gc->account, from); |
| 6784 | 762 | |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
763 | if (!bud) { |
| 15884 | 764 | purple_debug(PURPLE_DEBUG_WARNING, "yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
765 | "%s is playing a game, and doesn't want " |
|
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
766 | "you to know.\n", from); |
|
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
767 | } |
|
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
768 | |
| 9279 | 769 | f = yahoo_friend_find(gc, from); |
| 6784 | 770 | if (!f) |
| 771 | return; /* if they're not on the list, don't bother */ | |
| 772 | ||
| 9283 | 773 | yahoo_friend_set_game(f, NULL); |
| 6784 | 774 | |
| 3019 | 775 | if (*stat == '1') { |
| 9283 | 776 | yahoo_friend_set_game(f, game); |
| 3020 | 777 | if (bud) |
| 6784 | 778 | yahoo_update_status(gc, from, f); |
| 3019 | 779 | } |
|
19545
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
780 | } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { |
|
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
781 | PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, gc->account); |
|
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
782 | char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from); |
|
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
783 | purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL)); |
|
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
784 | g_free(buf); |
| 3019 | 785 | } |
|
19609
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
786 | |
| 2993 | 787 | } |
| 788 | ||
| 7827 | 789 | |
| 790 | struct _yahoo_im { | |
| 791 | char *from; | |
| 792 | int time; | |
| 793 | int utf8; | |
| 9284 | 794 | int buddy_icon; |
| 7827 | 795 | char *msg; |
| 796 | }; | |
| 797 | ||
| 15884 | 798 | static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 799 | { |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
800 | struct yahoo_data *yd = gc->proto_data; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
801 | GSList *l = pkt->hash; |
| 7827 | 802 | GSList *list = NULL; |
| 803 | struct _yahoo_im *im = NULL; | |
| 11608 | 804 | |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
805 | const char *imv = NULL; |
| 6069 | 806 | |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
807 | if (pkt->status <= 1 || pkt->status == 5) { |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11897
diff
changeset
|
808 | while (l != NULL) { |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
809 | struct yahoo_pair *pair = l->data; |
| 7827 | 810 | if (pair->key == 4) { |
| 811 | im = g_new0(struct _yahoo_im, 1); | |
| 812 | list = g_slist_append(list, im); | |
| 813 | im->from = pair->value; | |
| 814 | im->time = time(NULL); | |
| 815 | } | |
| 816 | if (pair->key == 97) | |
| 817 | if (im) | |
| 818 | im->utf8 = strtol(pair->value, NULL, 10); | |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
819 | if (pair->key == 15) |
| 7827 | 820 | if (im) |
| 821 | im->time = strtol(pair->value, NULL, 10); | |
| 9284 | 822 | if (pair->key == 206) |
| 823 | if (im) | |
| 824 | im->buddy_icon = strtol(pair->value, NULL, 10); | |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
825 | if (pair->key == 14) { |
| 7827 | 826 | if (im) |
| 827 | im->msg = pair->value; | |
| 6687 | 828 | } |
|
11801
c19b37ac661b
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
829 | /* IMV key */ |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
830 | if (pair->key == 63) |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
831 | { |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
832 | imv = pair->value; |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
833 | } |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
834 | l = l->next; |
| 6687 | 835 | } |
| 2681 | 836 | } else if (pkt->status == 2) { |
| 15884 | 837 | purple_notify_error(gc, NULL, |
|
10386
6fcc45a26a16
[gaim-migrate @ 11612]
Daniel Atallah <datallah@pidgin.im>
parents:
10379
diff
changeset
|
838 | _("Your Yahoo! message did not get sent."), NULL); |
| 2681 | 839 | } |
| 11608 | 840 | |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
841 | /** TODO: It seems that this check should be per IM, not global */ |
|
11801
c19b37ac661b
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
842 | /* Check for the Doodle IMV */ |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
843 | if (im != NULL && imv!= NULL && im->from != NULL) |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
844 | { |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
845 | g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv)); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
846 | |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
847 | if (strstr(imv, "doodle;") != NULL) |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
848 | { |
| 15884 | 849 | PurpleWhiteboard *wb; |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
850 | |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
851 | if (!yahoo_privacy_check(gc, im->from)) { |
| 15884 | 852 | purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
853 | return; |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
854 | } |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
855 | |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
856 | /* I'm not sure the following ever happens -DAA */ |
|
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
857 | |
| 15884 | 858 | wb = purple_whiteboard_get_session(gc->account, im->from); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
859 | |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
860 | /* If a Doodle session doesn't exist between this user */ |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
861 | if(wb == NULL) |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
862 | { |
| 15884 | 863 | wb = purple_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
864 | |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
865 | yahoo_doodle_command_send_request(gc, im->from); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
866 | yahoo_doodle_command_send_ready(gc, im->from); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
867 | } |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
868 | } |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
869 | } |
| 7827 | 870 | |
| 871 | for (l = list; l; l = l->next) { | |
| 9306 | 872 | YahooFriend *f; |
| 7827 | 873 | char *m, *m2; |
| 874 | im = l->data; | |
| 875 | ||
| 876 | if (!im->from || !im->msg) { | |
| 877 | g_free(im); | |
| 878 | continue; | |
| 879 | } | |
| 880 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
881 | if (!yahoo_privacy_check(gc, im->from)) { |
| 15884 | 882 | purple_debug_info("yahoo", "Message from %s dropped.\n", im->from); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
883 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
884 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
885 | |
| 7827 | 886 | m = yahoo_string_decode(gc, im->msg, im->utf8); |
|
12994
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
887 | /* This may actually not be necessary, but it appears |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
888 | * that at least at one point some clients were sending |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
889 | * "\r\n" as line delimiters, so we want to avoid double |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
890 | * lines. */ |
| 15884 | 891 | m2 = purple_strreplace(m, "\r\n", "\n"); |
|
12994
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
892 | g_free(m); |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
893 | m = m2; |
| 15884 | 894 | purple_util_chrreplace(m, '\r', '\n'); |
| 8375 | 895 | |
| 896 | if (!strcmp(m, "<ding>")) { | |
|
16007
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
897 | PurpleBuddy *buddy; |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
898 | PurpleAccount *account; |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
899 | PurpleConversation *c; |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
900 | char *username, *str; |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
901 | |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
902 | str = NULL; |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
903 | |
|
16007
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
904 | account = purple_connection_get_account(gc); |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
905 | c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, im->from); |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
906 | |
|
16007
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
907 | if ((buddy = purple_find_buddy(account, im->from)) != NULL) |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
908 | username = g_markup_escape_text(purple_buddy_get_alias(buddy), -1); |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
909 | else |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
910 | username = g_markup_escape_text(im->from, -1); |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
911 | |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
912 | serv_got_attention(gc, username, YAHOO_BUZZ); |
|
16007
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
913 | |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
914 | g_free(username); |
|
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
915 | g_free(str); |
| 8375 | 916 | g_free(m); |
| 917 | g_free(im); | |
| 918 | continue; | |
| 919 | } | |
| 920 | ||
| 7827 | 921 | m2 = yahoo_codes_to_html(m); |
| 922 | g_free(m); | |
| 923 | serv_got_im(gc, im->from, m2, 0, im->time); | |
| 924 | g_free(m2); | |
| 9284 | 925 | |
| 926 | if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { | |
| 927 | if (yahoo_friend_get_buddy_icon_need_request(f)) { | |
| 9310 | 928 | yahoo_send_picture_request(gc, im->from); |
| 9284 | 929 | yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
| 930 | } | |
| 931 | } | |
| 932 | ||
| 7827 | 933 | g_free(im); |
| 934 | } | |
| 935 | g_slist_free(list); | |
| 2681 | 936 | } |
| 937 | ||
| 15884 | 938 | static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 7865 | 939 | { |
| 940 | GSList *l = pkt->hash; | |
|
17044
47fd0afbe505
Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17041
diff
changeset
|
941 | char *prim, *me = NULL, *msg = NULL; |
| 7865 | 942 | |
| 943 | while (l) { | |
| 944 | struct yahoo_pair *pair = l->data; | |
| 945 | ||
| 946 | if (pair->key == 5) | |
| 947 | me = pair->value; | |
| 948 | if (pair->key == 14) | |
| 949 | msg = pair->value; | |
| 950 | ||
| 951 | l = l->next; | |
| 952 | } | |
| 953 | ||
| 10070 | 954 | if (!msg || !g_utf8_validate(msg, -1, NULL)) |
| 7865 | 955 | return; |
| 956 | ||
| 957 | prim = g_strdup_printf(_("Yahoo! system message for %s:"), | |
| 15884 | 958 | me?me:purple_connection_get_display_name(gc)); |
|
17044
47fd0afbe505
Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
17041
diff
changeset
|
959 | purple_notify_info(NULL, NULL, prim, msg); |
| 7865 | 960 | g_free(prim); |
| 961 | } | |
| 962 | ||
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
963 | struct yahoo_add_request { |
| 15884 | 964 | PurpleConnection *gc; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
965 | char *id; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
966 | char *who; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
967 | int protocol; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
968 | }; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
969 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
970 | static void |
|
19335
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
971 | yahoo_buddy_add_authorize_cb(gpointer data) { |
|
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
972 | struct yahoo_add_request *add_req = data; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
973 | |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
974 | struct yahoo_packet *pkt; |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
975 | struct yahoo_data *yd = add_req->gc->proto_data; |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
976 | |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
977 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0); |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
978 | yahoo_packet_hash(pkt, "ssiii", 1, add_req->id, 5, add_req->who, 241, add_req->protocol, |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
979 | 13, 1, 334, 0); |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
980 | yahoo_packet_send_and_free(pkt, yd); |
|
19538
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
981 | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
982 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
983 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
984 | g_free(add_req); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
985 | } |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
986 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
987 | static void |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
988 | yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) { |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
989 | struct yahoo_packet *pkt; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
990 | char *encoded_msg = NULL; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
991 | struct yahoo_data *yd = add_req->gc->proto_data; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
992 | PurpleAccount *account = purple_connection_get_account(add_req->gc); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
993 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
994 | if (msg && *msg) |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
995 | encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
996 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
997 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
998 | YAHOO_STATUS_AVAILABLE, 0); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
999 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1000 | yahoo_packet_hash(pkt, "ssiiis", |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1001 | 1, purple_normalize(account, purple_account_get_username(account)), |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1002 | 5, add_req->who, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1003 | 13, 2, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1004 | 334, 0, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1005 | 97, 1, |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1006 | 14, encoded_msg ? encoded_msg : ""); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1007 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1008 | yahoo_packet_send_and_free(pkt, yd); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1009 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1010 | g_free(encoded_msg); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1011 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1012 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1013 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1014 | g_free(add_req); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1015 | } |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1016 | |
| 15119 | 1017 | static void |
| 1018 | yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg) | |
| 1019 | { | |
| 1020 | yahoo_buddy_add_deny_cb(add_req, NULL); | |
| 1021 | } | |
| 1022 | ||
| 1023 | static void | |
|
19335
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
1024 | yahoo_buddy_add_deny_reason_cb(gpointer data) { |
|
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
1025 | struct yahoo_add_request *add_req = data; |
| 15884 | 1026 | purple_request_input(add_req->gc, NULL, _("Authorization denied message:"), |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
1027 | NULL, _("No reason given."), TRUE, FALSE, NULL, |
| 15119 | 1028 | _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
1029 | _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb), |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
1030 | purple_connection_get_account(add_req->gc), add_req->who, NULL, |
|
19280
75c489043716
Adding hints to yahoo yahoo.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19064
diff
changeset
|
1031 | "blist", add_req); |
| 15119 | 1032 | } |
| 1033 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1034 | static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1035 | { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1036 | char *notify_msg; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1037 | struct yahoo_data *yd = gc->proto_data; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1038 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1039 | if (who == NULL) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1040 | return; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1041 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1042 | if (reason != NULL) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1043 | char *msg2 = yahoo_string_decode(gc, reason, FALSE); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1044 | notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1045 | g_free(msg2); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1046 | } else |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1047 | notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list."), who); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1048 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1049 | purple_notify_info(gc, NULL, _("Add buddy rejected"), notify_msg); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1050 | g_free(notify_msg); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1051 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1052 | g_hash_table_remove(yd->friends, who); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1053 | purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1054 | /* TODO: Shouldn't we remove the buddy from our local list? */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1055 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1056 | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1057 | static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1058 | GSList *l = pkt->hash; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1059 | const char *msg = NULL; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1060 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1061 | /* Buddy authorized/declined our addition */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1062 | if (pkt->status == 1) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1063 | const char *who = NULL; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1064 | int response = 0; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1065 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1066 | while (l) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1067 | struct yahoo_pair *pair = l->data; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1068 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1069 | switch (pair->key) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1070 | case 4: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1071 | who = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1072 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1073 | case 13: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1074 | response = strtol(pair->value, NULL, 10); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1075 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1076 | case 14: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1077 | msg = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1078 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1079 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1080 | l = l->next; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1081 | } |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1082 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1083 | if (response == 1) /* Authorized */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1084 | purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1085 | else if (response == 2) { /* Declined */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1086 | purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)"); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1087 | yahoo_buddy_denied_our_add(gc, who, msg); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1088 | } else |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1089 | purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)"); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1090 | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1091 | } |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1092 | /* Buddy requested authorization to add us. */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1093 | else if (pkt->status == 3) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1094 | struct yahoo_add_request *add_req; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1095 | const char *firstname = NULL, *lastname = NULL; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1096 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1097 | add_req = g_new0(struct yahoo_add_request, 1); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1098 | add_req->gc = gc; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1099 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1100 | while (l) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1101 | struct yahoo_pair *pair = l->data; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1102 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1103 | switch (pair->key) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1104 | case 4: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1105 | add_req->who = g_strdup(pair->value); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1106 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1107 | case 5: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1108 | add_req->id = g_strdup(pair->value); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1109 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1110 | case 14: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1111 | msg = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1112 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1113 | case 216: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1114 | firstname = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1115 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1116 | case 241: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1117 | add_req->protocol = strtol(pair->value, NULL, 10); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1118 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1119 | case 254: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1120 | lastname = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1121 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1122 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1123 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1124 | l = l->next; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1125 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1126 | |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1127 | if (add_req->id && add_req->who) { |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1128 | char *alias = NULL, *dec_msg = NULL; |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1129 | |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1130 | if (!yahoo_privacy_check(gc, add_req->who)) { |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1131 | purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1132 | add_req->who); |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1133 | yahoo_buddy_add_deny_cb(add_req, NULL); |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1134 | return; |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1135 | } |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1136 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1137 | if (msg) |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1138 | dec_msg = yahoo_string_decode(gc, msg, FALSE); |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1139 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1140 | if (firstname && lastname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1141 | alias = g_strdup_printf("%s %s", firstname, lastname); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1142 | else if (firstname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1143 | alias = g_strdup(firstname); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1144 | else if (lastname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1145 | alias = g_strdup(lastname); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1146 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1147 | /* DONE! this is almost exactly the same as what MSN does, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1148 | * this should probably be moved to the core. |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1149 | */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1150 | purple_account_request_authorization(purple_connection_get_account(gc), add_req->who, add_req->id, |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1151 | alias, dec_msg, purple_find_buddy(purple_connection_get_account(gc), add_req->who) != NULL, |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1152 | yahoo_buddy_add_authorize_cb, |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1153 | yahoo_buddy_add_deny_reason_cb, |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1154 | add_req); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1155 | g_free(alias); |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1156 | g_free(dec_msg); |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1157 | } else { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1158 | g_free(add_req->id); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1159 | g_free(add_req->who); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1160 | g_free(add_req); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1161 | } |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1162 | } else { |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1163 | purple_debug_error("yahoo", "Received authorization of unknown status (%d).\n", pkt->status); |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1164 | } |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1165 | } |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1166 | |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1167 | /* I don't think this happens anymore in Version 15 */ |
| 15884 | 1168 | static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1169 | struct yahoo_add_request *add_req; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1170 | char *msg = NULL; |
| 2681 | 1171 | GSList *l = pkt->hash; |
| 1172 | ||
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1173 | add_req = g_new0(struct yahoo_add_request, 1); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1174 | add_req->gc = gc; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1175 | |
| 2681 | 1176 | while (l) { |
| 1177 | struct yahoo_pair *pair = l->data; | |
| 6686 | 1178 | |
| 1179 | switch (pair->key) { | |
| 1180 | case 1: | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1181 | add_req->id = g_strdup(pair->value); |
| 6686 | 1182 | break; |
| 1183 | case 3: | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1184 | add_req->who = g_strdup(pair->value); |
| 6686 | 1185 | break; |
| 1186 | case 15: /* time, for when they add us and we're offline */ | |
| 1187 | break; | |
| 1188 | case 14: | |
| 2681 | 1189 | msg = pair->value; |
| 6686 | 1190 | break; |
| 1191 | } | |
| 2681 | 1192 | l = l->next; |
| 1193 | } | |
| 1194 | ||
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1195 | if (add_req->id && add_req->who) { |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1196 | char *dec_msg = NULL; |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1197 | |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1198 | if (!yahoo_privacy_check(gc, add_req->who)) { |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1199 | purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n", |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1200 | add_req->who); |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1201 | yahoo_buddy_add_deny_cb(add_req, NULL); |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1202 | return; |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1203 | } |
|
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1204 | |
| 7827 | 1205 | if (msg) |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1206 | dec_msg = yahoo_string_decode(gc, msg, FALSE); |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1207 | |
| 15119 | 1208 | /* DONE! this is almost exactly the same as what MSN does, |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1209 | * this should probably be moved to the core. |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1210 | */ |
| 15884 | 1211 | purple_account_request_authorization(purple_connection_get_account(gc), add_req->who, add_req->id, |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1212 | NULL, dec_msg, purple_find_buddy(purple_connection_get_account(gc),add_req->who) != NULL, |
|
19335
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
1213 | yahoo_buddy_add_authorize_cb, |
|
4613b53d5741
Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <datallah@pidgin.im>
parents:
19329
diff
changeset
|
1214 | yahoo_buddy_add_deny_reason_cb, |
| 15119 | 1215 | add_req); |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1216 | g_free(dec_msg); |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1217 | } else { |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1218 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1219 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1220 | g_free(add_req); |
| 7827 | 1221 | } |
| 6686 | 1222 | } |
| 1223 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1224 | /* I have no idea if this every gets called in version 15 */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1225 | static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6686 | 1226 | { |
| 1227 | char *who = NULL; | |
| 1228 | char *msg = NULL; | |
| 1229 | GSList *l = pkt->hash; | |
| 1230 | ||
| 1231 | while (l) { | |
| 1232 | struct yahoo_pair *pair = l->data; | |
| 1233 | ||
| 1234 | switch (pair->key) { | |
| 1235 | case 3: | |
| 1236 | who = pair->value; | |
| 1237 | break; | |
| 1238 | case 14: | |
| 1239 | msg = pair->value; | |
| 1240 | break; | |
| 1241 | } | |
| 1242 | l = l->next; | |
| 1243 | } | |
| 1244 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1245 | yahoo_buddy_denied_our_add(gc, who, msg); |
| 6686 | 1246 | } |
| 1247 | ||
| 15884 | 1248 | static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6686 | 1249 | { |
| 1250 | switch (pkt->status) { | |
| 1251 | case 1: | |
| 1252 | yahoo_process_status(gc, pkt); | |
| 1253 | return; | |
| 1254 | case 3: | |
| 1255 | yahoo_buddy_added_us(gc, pkt); | |
| 1256 | break; | |
| 1257 | case 7: | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1258 | yahoo_buddy_denied_our_add_old(gc, pkt); |
| 6686 | 1259 | break; |
| 1260 | default: | |
| 1261 | break; | |
|
2683
06507dfdd96c
[gaim-migrate @ 2696]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2682
diff
changeset
|
1262 | } |
| 2681 | 1263 | } |
| 1264 | ||
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1265 | #define OUT_CHARSET "utf-8" |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1266 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1267 | static char *yahoo_decode(const char *text) |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1268 | { |
| 9221 | 1269 | char *converted = NULL; |
| 8125 | 1270 | char *n, *new; |
| 1271 | const char *end, *p; | |
| 8616 | 1272 | int i, k; |
| 8125 | 1273 | |
| 7771 | 1274 | n = new = g_malloc(strlen (text) + 1); |
|
8118
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
1275 | end = text + strlen(text); |
|
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
1276 | |
| 8125 | 1277 | for (p = text; p < end; p++, n++) { |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1278 | if (*p == '\\') { |
| 9064 | 1279 | if (p[1] >= '0' && p[1] <= '7') { |
| 1280 | p += 1; | |
| 1281 | for (i = 0, k = 0; k < 3; k += 1) { | |
| 1282 | char c = p[k]; | |
| 9065 | 1283 | if (c < '0' || c > '7') break; |
| 9064 | 1284 | i *= 8; |
| 1285 | i += c - '0'; | |
| 1286 | } | |
| 1287 | *n = i; | |
| 1288 | p += k - 1; | |
| 1289 | } else { /* bug 959248 */ | |
| 1290 | /* If we see a \ not followed by an octal number, | |
| 1291 | * it means that it is actually a \\ with one \ | |
| 1292 | * already eaten by some unknown function. | |
| 1293 | * This is arguably broken. | |
| 1294 | * | |
| 1295 | * I think wing is wrong here, there is no function | |
| 1296 | * called that I see that could have done it. I guess | |
| 1297 | * it is just really sending single \'s. That's yahoo | |
| 1298 | * for you. | |
| 1299 | */ | |
| 1300 | *n = *p; | |
| 1301 | } | |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1302 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1303 | else |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1304 | *n = *p; |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1305 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1306 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1307 | *n = '\0'; |
| 8125 | 1308 | |
| 9221 | 1309 | if (strstr(text, "\033$B")) |
| 1310 | converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL); | |
| 1311 | if (!converted) | |
| 1312 | converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL); | |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1313 | g_free(new); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1314 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1315 | return converted; |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1316 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1317 | |
| 15884 | 1318 | static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 1319 | { |
| 15884 | 1320 | PurpleAccount *account = purple_connection_get_account(gc); |
| 9221 | 1321 | struct yahoo_data *yd = gc->proto_data; |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
1322 | const char *who = NULL; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
1323 | const char *email = NULL; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
1324 | const char *subj = NULL; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
1325 | const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
| 2681 | 1326 | int count = 0; |
| 1327 | GSList *l = pkt->hash; | |
| 1328 | ||
| 15884 | 1329 | if (!purple_account_get_check_mail(account)) |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1330 | return; |
|
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1331 | |
| 2681 | 1332 | while (l) { |
| 1333 | struct yahoo_pair *pair = l->data; | |
| 1334 | if (pair->key == 9) | |
| 1335 | count = strtol(pair->value, NULL, 10); | |
| 1336 | else if (pair->key == 43) | |
| 1337 | who = pair->value; | |
| 1338 | else if (pair->key == 42) | |
| 1339 | email = pair->value; | |
| 1340 | else if (pair->key == 18) | |
| 1341 | subj = pair->value; | |
| 1342 | l = l->next; | |
| 1343 | } | |
| 1344 | ||
| 4001 | 1345 | if (who && subj && email && *email) { |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1346 | char *dec_who = yahoo_decode(who); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1347 | char *dec_subj = yahoo_decode(subj); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1348 | char *from = g_strdup_printf("%s (%s)", dec_who, email); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1349 | |
| 15884 | 1350 | purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), |
| 9221 | 1351 | yahoo_mail_url, NULL, NULL); |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1352 | |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1353 | g_free(dec_who); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1354 | g_free(dec_subj); |
| 2850 | 1355 | g_free(from); |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1356 | } else if (count > 0) { |
| 15884 | 1357 | const char *to = purple_account_get_username(account); |
| 9221 | 1358 | const char *url = yahoo_mail_url; |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1359 | |
| 15884 | 1360 | purple_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url, |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1361 | NULL, NULL); |
|
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1362 | } |
| 2681 | 1363 | } |
| 3147 | 1364 | /* This is the y64 alphabet... it's like base64, but has a . and a _ */ |
|
14904
cab89db4854c
[gaim-migrate @ 17611]
Henning Norén <henning.noren@gmail.com>
parents:
14899
diff
changeset
|
1365 | static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; |
| 3147 | 1366 | |
| 1367 | /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function | |
| 1368 | * in util.c, but it has a bug I don't feel like finding right now ;) */ | |
|
11897
10853b830964
[gaim-migrate @ 14188]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11838
diff
changeset
|
1369 | static void to_y64(char *out, const unsigned char *in, gsize inlen) |
| 3147 | 1370 | /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ |
| 1371 | { | |
| 1372 | for (; inlen >= 3; inlen -= 3) | |
| 1373 | { | |
| 1374 | *out++ = base64digits[in[0] >> 2]; | |
| 1375 | *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; | |
| 1376 | *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; | |
| 1377 | *out++ = base64digits[in[2] & 0x3f]; | |
| 1378 | in += 3; | |
| 1379 | } | |
| 1380 | if (inlen > 0) | |
| 1381 | { | |
| 1382 | unsigned char fragment; | |
| 1383 | ||
| 1384 | *out++ = base64digits[in[0] >> 2]; | |
| 1385 | fragment = (in[0] << 4) & 0x30; | |
| 1386 | if (inlen > 1) | |
| 1387 | fragment |= in[1] >> 4; | |
| 1388 | *out++ = base64digits[fragment]; | |
| 1389 | *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; | |
| 1390 | *out++ = '-'; | |
| 1391 | } | |
| 1392 | *out = '\0'; | |
| 1393 | } | |
| 1394 | ||
| 15884 | 1395 | static void yahoo_process_auth_old(PurpleConnection *gc, const char *seed) |
| 6986 | 1396 | { |
| 1397 | struct yahoo_packet *pack; | |
| 15884 | 1398 | PurpleAccount *account = purple_connection_get_account(gc); |
| 1399 | const char *name = purple_normalize(account, purple_account_get_username(account)); | |
| 1400 | const char *pass = purple_connection_get_password(gc); | |
| 6986 | 1401 | struct yahoo_data *yd = gc->proto_data; |
| 1402 | ||
| 1403 | /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly | |
| 1404 | * will soon do so in the rest of the world. | |
| 1405 | * | |
| 1406 | * The new clients use this authentication method. I warn you in advance, it's | |
|
8735
01248ea222d3
[gaim-migrate @ 9490]
Jonathan Champ <royanee@users.sourceforge.net>
parents:
8713
diff
changeset
|
1407 | * bizarre, convoluted, inordinately complicated. It's also no more secure than |
| 6986 | 1408 | * crypt() was. The only purpose this scheme could serve is to prevent third |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1409 | * party clients from connecting to their servers. |
| 6986 | 1410 | * |
| 1411 | * Sorry, Yahoo. | |
| 1412 | */ | |
| 9277 | 1413 | |
| 15884 | 1414 | PurpleCipher *cipher; |
| 1415 | PurpleCipherContext *context; | |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1416 | guchar digest[16]; |
| 9277 | 1417 | |
| 6986 | 1418 | char *crypt_result; |
| 1419 | char password_hash[25]; | |
| 1420 | char crypt_hash[25]; | |
| 1421 | char *hash_string_p = g_malloc(50 + strlen(name)); | |
| 1422 | char *hash_string_c = g_malloc(50 + strlen(name)); | |
| 9277 | 1423 | |
| 6986 | 1424 | char checksum; |
| 9277 | 1425 | |
| 6986 | 1426 | int sv; |
| 9277 | 1427 | |
| 6986 | 1428 | char result6[25]; |
| 1429 | char result96[25]; | |
| 1430 | ||
| 1431 | sv = seed[15]; | |
| 1432 | sv = sv % 8; | |
| 1433 | ||
| 15884 | 1434 | cipher = purple_ciphers_find_cipher("md5"); |
| 1435 | context = purple_cipher_context_new(cipher, NULL); | |
| 1436 | ||
| 1437 | purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); | |
| 1438 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1439 | |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1440 | to_y64(password_hash, digest, 16); |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1441 | |
| 9277 | 1442 | crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$"); |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1443 | |
| 15884 | 1444 | purple_cipher_context_reset(context, NULL); |
| 1445 | purple_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result)); | |
| 1446 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1447 | to_y64(crypt_hash, digest, 16); |
| 6986 | 1448 | |
| 1449 | switch (sv) { | |
| 1450 | case 1: | |
| 1451 | case 6: | |
| 1452 | checksum = seed[seed[9] % 16]; | |
| 1453 | g_snprintf(hash_string_p, strlen(name) + 50, | |
| 1454 | "%c%s%s%s", checksum, name, seed, password_hash); | |
| 1455 | g_snprintf(hash_string_c, strlen(name) + 50, | |
| 1456 | "%c%s%s%s", checksum, name, seed, crypt_hash); | |
| 1457 | break; | |
| 1458 | case 2: | |
| 1459 | case 7: | |
| 1460 | checksum = seed[seed[15] % 16]; | |
| 1461 | g_snprintf(hash_string_p, strlen(name) + 50, | |
| 1462 | "%c%s%s%s", checksum, seed, password_hash, name); | |
| 1463 | g_snprintf(hash_string_c, strlen(name) + 50, | |
| 1464 | "%c%s%s%s", checksum, seed, crypt_hash, name); | |
| 1465 | break; | |
| 1466 | case 3: | |
| 1467 | checksum = seed[seed[1] % 16]; | |
| 1468 | g_snprintf(hash_string_p, strlen(name) + 50, | |
| 1469 | "%c%s%s%s", checksum, name, password_hash, seed); | |
| 1470 | g_snprintf(hash_string_c, strlen(name) + 50, | |
| 1471 | "%c%s%s%s", checksum, name, crypt_hash, seed); | |
| 1472 | break; | |
| 1473 | case 4: | |
| 1474 | checksum = seed[seed[3] % 16]; | |
| 1475 | g_snprintf(hash_string_p, strlen(name) + 50, | |
| 1476 | "%c%s%s%s", checksum, password_hash, seed, name); | |
| 1477 | g_snprintf(hash_string_c, strlen(name) + 50, | |
| 1478 | "%c%s%s%s", checksum, crypt_hash, seed, name); | |
| 1479 | break; | |
| 1480 | case 0: | |
| 1481 | case 5: | |
| 1482 | checksum = seed[seed[7] % 16]; | |
| 1483 | g_snprintf(hash_string_p, strlen(name) + 50, | |
| 1484 | "%c%s%s%s", checksum, password_hash, name, seed); | |
| 1485 | g_snprintf(hash_string_c, strlen(name) + 50, | |
| 1486 | "%c%s%s%s", checksum, crypt_hash, name, seed); | |
| 1487 | break; | |
| 1488 | } | |
| 9277 | 1489 | |
| 15884 | 1490 | purple_cipher_context_reset(context, NULL); |
| 1491 | purple_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p)); | |
| 1492 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1493 | to_y64(result6, digest, 16); |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1494 | |
| 15884 | 1495 | purple_cipher_context_reset(context, NULL); |
| 1496 | purple_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c)); | |
| 1497 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 1498 | purple_cipher_context_destroy(context); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1499 | to_y64(result96, digest, 16); |
| 6986 | 1500 | |
| 1501 | pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 1502 | yahoo_packet_hash(pack, "ssss", 0, name, 6, result6, 96, result96, 1, name); |
| 10392 | 1503 | yahoo_packet_send_and_free(pack, yd); |
| 9277 | 1504 | |
| 6986 | 1505 | g_free(hash_string_p); |
| 1506 | g_free(hash_string_c); | |
| 1507 | } | |
| 1508 | ||
| 6998 | 1509 | /* I'm dishing out some uber-mad props to Cerulean Studios for cracking this |
| 1510 | * and sending the fix! Thanks guys. */ | |
| 1511 | ||
| 15884 | 1512 | static void yahoo_process_auth_new(PurpleConnection *gc, const char *seed) |
| 6986 | 1513 | { |
| 1514 | struct yahoo_packet *pack = NULL; | |
| 15884 | 1515 | PurpleAccount *account = purple_connection_get_account(gc); |
| 1516 | const char *name = purple_normalize(account, purple_account_get_username(account)); | |
| 1517 | const char *pass = purple_connection_get_password(gc); | |
|
14108
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1518 | char *enc_pass; |
| 6986 | 1519 | struct yahoo_data *yd = gc->proto_data; |
| 9277 | 1520 | |
| 15884 | 1521 | PurpleCipher *md5_cipher; |
| 1522 | PurpleCipherContext *md5_ctx; | |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
1523 | guchar md5_digest[16]; |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1524 | |
| 15884 | 1525 | PurpleCipher *sha1_cipher; |
| 1526 | PurpleCipherContext *sha1_ctx1; | |
| 1527 | PurpleCipherContext *sha1_ctx2; | |
| 9277 | 1528 | |
| 8349 | 1529 | char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ"; |
| 1530 | char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop"; | |
| 1531 | ||
| 1532 | char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5"; | |
| 1533 | char *operand_lookup = "+|&%/*^-"; | |
| 1534 | char *delimit_lookup = ",;"; | |
| 1535 | ||
| 1536 | char *password_hash = (char *)g_malloc(25); | |
| 1537 | char *crypt_hash = (char *)g_malloc(25); | |
| 1538 | char *crypt_result = NULL; | |
| 1539 | ||
|
11144
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
1540 | unsigned char pass_hash_xor1[64]; |
|
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
1541 | unsigned char pass_hash_xor2[64]; |
|
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
1542 | unsigned char crypt_hash_xor1[64]; |
|
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
1543 | unsigned char crypt_hash_xor2[64]; |
| 8349 | 1544 | char resp_6[100]; |
| 1545 | char resp_96[100]; | |
| 1546 | ||
| 1547 | unsigned char digest1[20]; | |
| 1548 | unsigned char digest2[20]; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1549 | unsigned char comparison_src[20]; |
| 8349 | 1550 | unsigned char magic_key_char[4]; |
|
11144
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
1551 | const char *magic_ptr; |
| 8349 | 1552 | |
| 1553 | unsigned int magic[64]; | |
| 1554 | unsigned int magic_work = 0; | |
| 1555 | unsigned int magic_4 = 0; | |
| 1556 | ||
| 1557 | int x; | |
| 1558 | int y; | |
| 1559 | int cnt = 0; | |
| 1560 | int magic_cnt = 0; | |
| 1561 | int magic_len; | |
| 1562 | ||
| 1563 | memset(password_hash, 0, 25); | |
| 1564 | memset(crypt_hash, 0, 25); | |
| 6986 | 1565 | memset(&pass_hash_xor1, 0, 64); |
| 1566 | memset(&pass_hash_xor2, 0, 64); | |
| 1567 | memset(&crypt_hash_xor1, 0, 64); | |
| 1568 | memset(&crypt_hash_xor2, 0, 64); | |
| 1569 | memset(&digest1, 0, 20); | |
| 1570 | memset(&digest2, 0, 20); | |
| 1571 | memset(&magic, 0, 64); | |
| 1572 | memset(&resp_6, 0, 100); | |
| 1573 | memset(&resp_96, 0, 100); | |
| 1574 | memset(&magic_key_char, 0, 4); | |
| 8349 | 1575 | memset(&comparison_src, 0, 20); |
| 6986 | 1576 | |
| 15884 | 1577 | md5_cipher = purple_ciphers_find_cipher("md5"); |
| 1578 | md5_ctx = purple_cipher_context_new(md5_cipher, NULL); | |
| 1579 | ||
| 1580 | sha1_cipher = purple_ciphers_find_cipher("sha1"); | |
| 1581 | sha1_ctx1 = purple_cipher_context_new(sha1_cipher, NULL); | |
| 1582 | sha1_ctx2 = purple_cipher_context_new(sha1_cipher, NULL); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1583 | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1584 | /* |
| 8349 | 1585 | * Magic: Phase 1. Generate what seems to be a 30 byte value (could change if base64 |
| 1586 | * ends up differently? I don't remember and I'm tired, so use a 64 byte buffer. | |
| 6986 | 1587 | */ |
| 9277 | 1588 | |
| 6986 | 1589 | magic_ptr = seed; |
| 8375 | 1590 | |
| 6986 | 1591 | while (*magic_ptr != (int)NULL) { |
| 8349 | 1592 | char *loc; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1593 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1594 | /* Ignore parentheses. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1595 | |
| 6986 | 1596 | if (*magic_ptr == '(' || *magic_ptr == ')') { |
| 1597 | magic_ptr++; | |
| 1598 | continue; | |
| 1599 | } | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1600 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1601 | /* Characters and digits verify against the challenge lookup. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1602 | |
| 6986 | 1603 | if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) { |
| 1604 | loc = strchr(challenge_lookup, *magic_ptr); | |
| 1605 | if (!loc) { | |
| 8349 | 1606 | /* SME XXX Error - disconnect here */ |
| 6986 | 1607 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1608 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1609 | /* Get offset into lookup table and shl 3. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1610 | |
| 6986 | 1611 | magic_work = loc - challenge_lookup; |
| 1612 | magic_work <<= 3; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1613 | |
| 6986 | 1614 | magic_ptr++; |
| 1615 | continue; | |
| 1616 | } else { | |
| 8349 | 1617 | unsigned int local_store; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1618 | |
| 6986 | 1619 | loc = strchr(operand_lookup, *magic_ptr); |
| 1620 | if (!loc) { | |
| 8349 | 1621 | /* SME XXX Disconnect */ |
| 6986 | 1622 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1623 | |
| 6986 | 1624 | local_store = loc - operand_lookup; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1625 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1626 | /* Oops; how did this happen? */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1627 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1628 | if (magic_cnt >= 64) |
| 6986 | 1629 | break; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1630 | |
| 6986 | 1631 | magic[magic_cnt++] = magic_work | local_store; |
| 1632 | magic_ptr++; | |
| 1633 | continue; | |
| 1634 | } | |
| 8349 | 1635 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1636 | |
| 6986 | 1637 | magic_len = magic_cnt; |
| 1638 | magic_cnt = 0; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1639 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1640 | /* Magic: Phase 2. Take generated magic value and sprinkle fairy |
|
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1641 | * dust on the values. |
| 8349 | 1642 | */ |
| 1643 | ||
| 6986 | 1644 | for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) { |
| 8349 | 1645 | unsigned char byte1; |
| 1646 | unsigned char byte2; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1647 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1648 | /* Bad. Abort. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1649 | |
| 8349 | 1650 | if ((magic_cnt + 1 > magic_len) || (magic_cnt > magic_len)) |
| 6986 | 1651 | break; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1652 | |
| 6986 | 1653 | byte1 = magic[magic_cnt]; |
| 1654 | byte2 = magic[magic_cnt+1]; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1655 | |
| 6986 | 1656 | byte1 *= 0xcd; |
| 1657 | byte1 ^= byte2; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1658 | |
| 6986 | 1659 | magic[magic_cnt+1] = byte1; |
| 8349 | 1660 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1661 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1662 | /* |
| 8349 | 1663 | * Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic |
| 1664 | * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key | |
| 1665 | * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets | |
| 1666 | * into particular functions we'll later call to potentially alter the magic key. | |
| 1667 | * | |
| 1668 | * %-) | |
| 1669 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1670 | |
| 8349 | 1671 | magic_cnt = 1; |
| 1672 | x = 0; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1673 | |
| 8349 | 1674 | do { |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1675 | unsigned int bl = 0; |
| 8349 | 1676 | unsigned int cl = magic[magic_cnt++]; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1677 | |
| 8349 | 1678 | if (magic_cnt >= magic_len) |
| 1679 | break; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1680 | |
| 8349 | 1681 | if (cl > 0x7F) { |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1682 | if (cl < 0xe0) |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1683 | bl = cl = (cl & 0x1f) << 6; |
| 8349 | 1684 | else { |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1685 | bl = magic[magic_cnt++]; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1686 | cl = (cl & 0x0f) << 6; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1687 | bl = ((bl & 0x3f) + cl) << 6; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1688 | } |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1689 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1690 | cl = magic[magic_cnt++]; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1691 | bl = (cl & 0x3f) + bl; |
| 8349 | 1692 | } else |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1693 | bl = cl; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1694 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1695 | comparison_src[x++] = (bl & 0xff00) >> 8; |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1696 | comparison_src[x++] = bl & 0xff; |
| 8349 | 1697 | } while (x < 20); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1698 | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1699 | /* First four bytes are magic key. */ |
| 8349 | 1700 | memcpy(&magic_key_char[0], comparison_src, 4); |
|
8482
75fc0de5be78
[gaim-migrate @ 9215]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8441
diff
changeset
|
1701 | magic_4 = magic_key_char[0] | (magic_key_char[1]<<8) | (magic_key_char[2]<<16) | (magic_key_char[3]<<24); |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1702 | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1703 | /* |
| 8349 | 1704 | * Magic: Phase 4. Determine what function to use later by getting outside/inside |
| 1705 | * loop values until we match our previous buffer. | |
| 1706 | */ | |
| 1707 | for (x = 0; x < 65535; x++) { | |
| 1708 | int leave = 0; | |
| 1709 | ||
| 1710 | for (y = 0; y < 5; y++) { | |
| 1711 | unsigned char test[3]; | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1712 | |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1713 | /* Calculate buffer. */ |
| 8349 | 1714 | test[0] = x; |
| 1715 | test[1] = x >> 8; | |
| 1716 | test[2] = y; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1717 | |
| 15884 | 1718 | purple_cipher_context_reset(md5_ctx, NULL); |
| 1719 | purple_cipher_context_append(md5_ctx, magic_key_char, 4); | |
| 1720 | purple_cipher_context_append(md5_ctx, test, 3); | |
| 1721 | purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), | |
| 10687 | 1722 | md5_digest, NULL); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1723 | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1724 | if (!memcmp(md5_digest, comparison_src+4, 16)) { |
| 8349 | 1725 | leave = 1; |
| 1726 | break; | |
| 1727 | } | |
| 1728 | } | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1729 | |
| 8349 | 1730 | if (leave == 1) |
| 1731 | break; | |
| 6986 | 1732 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1733 | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1734 | /* If y != 0, we need some help. */ |
| 8349 | 1735 | if (y != 0) { |
| 1736 | unsigned int updated_key; | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1737 | |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1738 | /* Update magic stuff. |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1739 | * Call it twice because Yahoo's encryption is super bad ass. |
| 8349 | 1740 | */ |
| 1741 | updated_key = yahoo_auth_finalCountdown(magic_4, 0x60, y, x); | |
| 1742 | updated_key = yahoo_auth_finalCountdown(updated_key, 0x60, y, x); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1743 | |
|
8482
75fc0de5be78
[gaim-migrate @ 9215]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8441
diff
changeset
|
1744 | magic_key_char[0] = updated_key & 0xff; |
|
75fc0de5be78
[gaim-migrate @ 9215]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8441
diff
changeset
|
1745 | magic_key_char[1] = (updated_key >> 8) & 0xff; |
|
75fc0de5be78
[gaim-migrate @ 9215]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8441
diff
changeset
|
1746 | magic_key_char[2] = (updated_key >> 16) & 0xff; |
|
75fc0de5be78
[gaim-migrate @ 9215]
Andrew Wellington <proton@users.sourceforge.net>
parents:
8441
diff
changeset
|
1747 | magic_key_char[3] = (updated_key >> 24) & 0xff; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1748 | } |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1749 | |
|
14108
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1750 | enc_pass = yahoo_string_encode(gc, pass, NULL); |
|
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1751 | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1752 | /* Get password and crypt hashes as per usual. */ |
| 15884 | 1753 | purple_cipher_context_reset(md5_ctx, NULL); |
| 1754 | purple_cipher_context_append(md5_ctx, (const guchar *)enc_pass, strlen(enc_pass)); | |
| 1755 | purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), | |
| 10687 | 1756 | md5_digest, NULL); |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1757 | to_y64(password_hash, md5_digest, 16); |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1758 | |
|
14108
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1759 | crypt_result = yahoo_crypt(enc_pass, "$1$_2S43d5f$"); |
|
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1760 | |
|
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1761 | g_free(enc_pass); |
|
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1762 | enc_pass = NULL; |
|
8f4414c9827b
[gaim-migrate @ 16658]
Daniel Atallah <datallah@pidgin.im>
parents:
14030
diff
changeset
|
1763 | |
| 15884 | 1764 | purple_cipher_context_reset(md5_ctx, NULL); |
| 1765 | purple_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result)); | |
| 1766 | purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), | |
| 10687 | 1767 | md5_digest, NULL); |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1768 | to_y64(crypt_hash, md5_digest, 16); |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1769 | |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1770 | /* Our first authentication response is based off of the password hash. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1771 | for (x = 0; x < (int)strlen(password_hash); x++) |
| 6986 | 1772 | pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1773 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1774 | if (cnt < 64) |
| 6986 | 1775 | memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt); |
| 8349 | 1776 | |
| 6986 | 1777 | cnt = 0; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1778 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1779 | for (x = 0; x < (int)strlen(password_hash); x++) |
| 6986 | 1780 | pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1781 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1782 | if (cnt < 64) |
| 6986 | 1783 | memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1784 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1785 | /* |
| 8349 | 1786 | * The first context gets the password hash XORed with 0x36 plus a magic value |
| 1787 | * which we previously extrapolated from our challenge. | |
| 1788 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1789 | |
| 15884 | 1790 | purple_cipher_context_append(sha1_ctx1, pass_hash_xor1, 64); |
| 9382 | 1791 | if (y >= 3) |
| 15884 | 1792 | purple_cipher_context_set_option(sha1_ctx1, "sizeLo", GINT_TO_POINTER(0x1ff)); |
| 1793 | purple_cipher_context_append(sha1_ctx1, magic_key_char, 4); | |
| 1794 | purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1795 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1796 | /* |
| 8349 | 1797 | * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest |
| 1798 | * of the first context. | |
| 1799 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1800 | |
| 15884 | 1801 | purple_cipher_context_append(sha1_ctx2, pass_hash_xor2, 64); |
| 1802 | purple_cipher_context_append(sha1_ctx2, digest1, 20); | |
| 1803 | purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1804 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1805 | /* |
| 8349 | 1806 | * Now that we have digest2, use it to fetch characters from an alphabet to construct |
| 1807 | * our first authentication response. | |
| 1808 | */ | |
| 1809 | ||
| 6986 | 1810 | for (x = 0; x < 20; x += 2) { |
| 8349 | 1811 | unsigned int val = 0; |
| 1812 | unsigned int lookup = 0; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1813 | |
| 8349 | 1814 | char byte[6]; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1815 | |
| 6986 | 1816 | memset(&byte, 0, 6); |
| 8349 | 1817 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1818 | /* First two bytes of digest stuffed together. */ |
| 9277 | 1819 | |
| 6986 | 1820 | val = digest2[x]; |
| 1821 | val <<= 8; | |
| 1822 | val += digest2[x+1]; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1823 | |
| 6986 | 1824 | lookup = (val >> 0x0b); |
| 1825 | lookup &= 0x1f; | |
| 1826 | if (lookup >= strlen(alphabet1)) | |
| 1827 | break; | |
| 1828 | sprintf(byte, "%c", alphabet1[lookup]); | |
| 1829 | strcat(resp_6, byte); | |
| 1830 | strcat(resp_6, "="); | |
| 8349 | 1831 | |
| 6986 | 1832 | lookup = (val >> 0x06); |
| 1833 | lookup &= 0x1f; | |
| 1834 | if (lookup >= strlen(alphabet2)) | |
| 1835 | break; | |
| 1836 | sprintf(byte, "%c", alphabet2[lookup]); | |
| 1837 | strcat(resp_6, byte); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1838 | |
| 6986 | 1839 | lookup = (val >> 0x01); |
| 1840 | lookup &= 0x1f; | |
| 1841 | if (lookup >= strlen(alphabet2)) | |
| 1842 | break; | |
| 1843 | sprintf(byte, "%c", alphabet2[lookup]); | |
| 1844 | strcat(resp_6, byte); | |
| 8349 | 1845 | |
| 6986 | 1846 | lookup = (val & 0x01); |
| 1847 | if (lookup >= strlen(delimit_lookup)) | |
| 1848 | break; | |
| 1849 | sprintf(byte, "%c", delimit_lookup[lookup]); | |
| 1850 | strcat(resp_6, byte); | |
| 1851 | } | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1852 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1853 | /* Our second authentication response is based off of the crypto hash. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1854 | |
| 6986 | 1855 | cnt = 0; |
| 1856 | memset(&digest1, 0, 20); | |
| 1857 | memset(&digest2, 0, 20); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1858 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1859 | for (x = 0; x < (int)strlen(crypt_hash); x++) |
| 6986 | 1860 | crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1861 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1862 | if (cnt < 64) |
| 6986 | 1863 | memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt); |
| 8349 | 1864 | |
| 6986 | 1865 | cnt = 0; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1866 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1867 | for (x = 0; x < (int)strlen(crypt_hash); x++) |
| 6986 | 1868 | crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1869 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1870 | if (cnt < 64) |
| 6986 | 1871 | memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1872 | |
| 15884 | 1873 | purple_cipher_context_reset(sha1_ctx1, NULL); |
| 1874 | purple_cipher_context_reset(sha1_ctx2, NULL); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1875 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1876 | /* |
| 8349 | 1877 | * The first context gets the password hash XORed with 0x36 plus a magic value |
| 1878 | * which we previously extrapolated from our challenge. | |
| 1879 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1880 | |
| 15884 | 1881 | purple_cipher_context_append(sha1_ctx1, crypt_hash_xor1, 64); |
| 10687 | 1882 | if (y >= 3) { |
| 15884 | 1883 | purple_cipher_context_set_option(sha1_ctx1, "sizeLo", |
| 10687 | 1884 | GINT_TO_POINTER(0x1ff)); |
| 1885 | } | |
| 15884 | 1886 | purple_cipher_context_append(sha1_ctx1, magic_key_char, 4); |
| 1887 | purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1888 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1889 | /* |
| 8349 | 1890 | * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest |
| 1891 | * of the first context. | |
| 1892 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1893 | |
| 15884 | 1894 | purple_cipher_context_append(sha1_ctx2, crypt_hash_xor2, 64); |
| 1895 | purple_cipher_context_append(sha1_ctx2, digest1, 20); | |
| 1896 | purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1897 | |
|
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1898 | /* |
| 8349 | 1899 | * Now that we have digest2, use it to fetch characters from an alphabet to construct |
| 1900 | * our first authentication response. | |
| 1901 | */ | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1902 | |
| 6986 | 1903 | for (x = 0; x < 20; x += 2) { |
| 8349 | 1904 | unsigned int val = 0; |
| 1905 | unsigned int lookup = 0; | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1906 | |
| 8349 | 1907 | char byte[6]; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1908 | |
| 6986 | 1909 | memset(&byte, 0, 6); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1910 | |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1911 | /* First two bytes of digest stuffed together. */ |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1912 | |
| 6986 | 1913 | val = digest2[x]; |
| 1914 | val <<= 8; | |
| 1915 | val += digest2[x+1]; | |
| 8349 | 1916 | |
| 6986 | 1917 | lookup = (val >> 0x0b); |
| 1918 | lookup &= 0x1f; | |
| 1919 | if (lookup >= strlen(alphabet1)) | |
| 1920 | break; | |
| 1921 | sprintf(byte, "%c", alphabet1[lookup]); | |
| 1922 | strcat(resp_96, byte); | |
| 1923 | strcat(resp_96, "="); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1924 | |
| 6986 | 1925 | lookup = (val >> 0x06); |
| 1926 | lookup &= 0x1f; | |
| 1927 | if (lookup >= strlen(alphabet2)) | |
| 1928 | break; | |
| 1929 | sprintf(byte, "%c", alphabet2[lookup]); | |
| 1930 | strcat(resp_96, byte); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1931 | |
| 6986 | 1932 | lookup = (val >> 0x01); |
| 1933 | lookup &= 0x1f; | |
| 1934 | if (lookup >= strlen(alphabet2)) | |
| 1935 | break; | |
| 1936 | sprintf(byte, "%c", alphabet2[lookup]); | |
| 1937 | strcat(resp_96, byte); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1938 | |
| 6986 | 1939 | lookup = (val & 0x01); |
| 1940 | if (lookup >= strlen(delimit_lookup)) | |
| 1941 | break; | |
| 1942 | sprintf(byte, "%c", delimit_lookup[lookup]); | |
| 1943 | strcat(resp_96, byte); | |
| 1944 | } | |
| 15884 | 1945 | purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); |
| 10400 | 1946 | pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0); |
| 10394 | 1947 | yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1, |
| 1948 | name, 135, "6,0,0,1710"); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1949 | if (yd->picture_checksum) |
| 10394 | 1950 | yahoo_packet_hash_int(pack, 192, yd->picture_checksum); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1951 | |
| 10392 | 1952 | yahoo_packet_send_and_free(pack, yd); |
| 6986 | 1953 | |
| 15884 | 1954 | purple_cipher_context_destroy(md5_ctx); |
| 1955 | purple_cipher_context_destroy(sha1_ctx1); | |
| 1956 | purple_cipher_context_destroy(sha1_ctx2); | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
1957 | |
| 7424 | 1958 | g_free(password_hash); |
| 1959 | g_free(crypt_hash); | |
| 6986 | 1960 | } |
| 1961 | ||
| 15884 | 1962 | static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 3147 | 1963 | { |
| 1964 | char *seed = NULL; | |
| 1965 | char *sn = NULL; | |
| 1966 | GSList *l = pkt->hash; | |
| 7010 | 1967 | int m = 0; |
| 9277 | 1968 | gchar *buf; |
| 1969 | ||
| 3147 | 1970 | while (l) { |
| 1971 | struct yahoo_pair *pair = l->data; | |
| 1972 | if (pair->key == 94) | |
| 1973 | seed = pair->value; | |
| 1974 | if (pair->key == 1) | |
| 1975 | sn = pair->value; | |
| 6986 | 1976 | if (pair->key == 13) |
| 1977 | m = atoi(pair->value); | |
| 3147 | 1978 | l = l->next; |
| 1979 | } | |
| 9277 | 1980 | |
| 3147 | 1981 | if (seed) { |
| 6986 | 1982 | switch (m) { |
| 1983 | case 0: | |
| 1984 | yahoo_process_auth_old(gc, seed); | |
| 1985 | break; | |
| 3147 | 1986 | case 1: |
| 14320 | 1987 | case 2: /* This case seems to work, could probably use testing */ |
| 6986 | 1988 | yahoo_process_auth_new(gc, seed); |
| 3147 | 1989 | break; |
| 6986 | 1990 | default: |
|
7043
b79933739678
[gaim-migrate @ 7606]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7015
diff
changeset
|
1991 | buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " |
|
15444
b793ef258d23
I think this changes every user-visible string that contains 'Gaim.' We probably want the UI to be able
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1992 | "authentication method. You will probably not be able " |
| 15884 | 1993 | "to successfully sign on to Yahoo. Check %s for updates."), PURPLE_WEBSITE); |
| 1994 | purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), | |
|
7043
b79933739678
[gaim-migrate @ 7606]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7015
diff
changeset
|
1995 | buf); |
|
b79933739678
[gaim-migrate @ 7606]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
7015
diff
changeset
|
1996 | g_free(buf); |
| 6986 | 1997 | yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */ |
| 3147 | 1998 | } |
| 1999 | } | |
| 2000 | } | |
| 2681 | 2001 | |
| 15884 | 2002 | static void ignore_buddy(PurpleBuddy *buddy) { |
| 2003 | PurpleGroup *group; | |
| 2004 | PurpleAccount *account; | |
| 6760 | 2005 | gchar *name; |
| 2006 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
2007 | if (!buddy) |
| 6792 | 2008 | return; |
| 6760 | 2009 | |
| 15884 | 2010 | group = purple_buddy_get_group(buddy); |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
2011 | name = g_strdup(buddy->name); |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
2012 | account = buddy->account; |
| 6760 | 2013 | |
| 15884 | 2014 | purple_debug(PURPLE_DEBUG_INFO, "blist", |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
2015 | "Removing '%s' from buddy list.\n", buddy->name); |
| 15884 | 2016 | purple_account_remove_buddy(account, buddy, group); |
| 2017 | purple_blist_remove_buddy(buddy); | |
| 6760 | 2018 | |
| 6792 | 2019 | serv_add_deny(account->gc, name); |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
2020 | |
| 6760 | 2021 | g_free(name); |
| 2022 | } | |
| 2023 | ||
| 15884 | 2024 | static void keep_buddy(PurpleBuddy *b) { |
| 2025 | purple_privacy_deny_remove(b->account, b->name, 1); | |
| 6760 | 2026 | } |
| 2027 | ||
| 15884 | 2028 | static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { |
| 2029 | PurpleBuddy *b; | |
| 6760 | 2030 | GSList *l; |
| 2031 | gchar *who = NULL; | |
| 2032 | gchar *sn = NULL; | |
| 2033 | gchar buf[BUF_LONG]; | |
| 2034 | gint ignore = 0; | |
| 2035 | gint status = 0; | |
| 2036 | ||
| 2037 | for (l = pkt->hash; l; l = l->next) { | |
| 2038 | struct yahoo_pair *pair = l->data; | |
| 2039 | switch (pair->key) { | |
| 2040 | case 0: | |
| 2041 | who = pair->value; | |
| 2042 | break; | |
| 2043 | case 1: | |
| 2044 | sn = pair->value; | |
| 2045 | break; | |
| 2046 | case 13: | |
| 2047 | ignore = strtol(pair->value, NULL, 10); | |
| 2048 | break; | |
| 2049 | case 66: | |
| 2050 | status = strtol(pair->value, NULL, 10); | |
| 2051 | break; | |
| 2052 | default: | |
| 2053 | break; | |
| 2054 | } | |
| 2055 | } | |
| 2056 | ||
| 2057 | switch (status) { | |
| 2058 | case 12: | |
| 15884 | 2059 | b = purple_find_buddy(gc->account, who); |
| 6760 | 2060 | g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " |
| 2061 | "user is on your buddy list. Clicking \"Yes\" " | |
| 2062 | "will remove and ignore the buddy."), who); | |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
2063 | purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
2064 | gc->account, who, NULL, |
|
19280
75c489043716
Adding hints to yahoo yahoo.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19064
diff
changeset
|
2065 | "blist", b, |
| 6760 | 2066 | G_CALLBACK(ignore_buddy), |
| 2067 | G_CALLBACK(keep_buddy)); | |
| 2068 | break; | |
| 2069 | case 2: | |
| 2070 | case 3: | |
| 2071 | case 0: | |
| 2072 | default: | |
| 2073 | break; | |
| 2074 | } | |
| 2075 | } | |
| 2076 | ||
| 15884 | 2077 | static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6761 | 2078 | { |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2079 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 9410 | 2080 | struct yahoo_data *yd = gc->proto_data; |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2081 | #endif |
| 6761 | 2082 | GSList *l = pkt->hash; |
| 2083 | int err = 0; | |
| 2084 | char *msg; | |
| 7865 | 2085 | char *url = NULL; |
| 2086 | char *fullmsg; | |
|
18946
36989fd1718f
make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@pidgin.im>
parents:
18940
diff
changeset
|
2087 | PurpleAccount *account = gc->account; |
| 6761 | 2088 | |
| 2089 | while (l) { | |
| 2090 | struct yahoo_pair *pair = l->data; | |
| 2091 | ||
| 2092 | if (pair->key == 66) | |
| 2093 | err = strtol(pair->value, NULL, 10); | |
| 7865 | 2094 | if (pair->key == 20) |
| 2095 | url = pair->value; | |
| 6761 | 2096 | |
| 2097 | l = l->next; | |
| 2098 | } | |
| 2099 | ||
| 2100 | switch (err) { | |
| 2101 | case 3: | |
|
15062
78e3c1c8c4f4
[gaim-migrate @ 17779]
Richard Laager <rlaager@pidgin.im>
parents:
14904
diff
changeset
|
2102 | msg = g_strdup(_("Invalid screen name.")); |
| 6761 | 2103 | break; |
| 2104 | case 13: | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2105 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 9410 | 2106 | if (!yd->wm) { |
| 15884 | 2107 | PurpleUtilFetchUrlData *url_data; |
| 9410 | 2108 | yd->wm = TRUE; |
| 2109 | if (yd->fd >= 0) | |
| 2110 | close(yd->fd); | |
| 2111 | if (gc->inpa) | |
| 15884 | 2112 | purple_input_remove(gc->inpa); |
| 2113 | url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, | |
| 2114 | "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2115 | if (url_data != NULL) |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2116 | yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
| 9410 | 2117 | return; |
| 2118 | } | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2119 | #endif |
|
18946
36989fd1718f
make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@pidgin.im>
parents:
18940
diff
changeset
|
2120 | if (!purple_account_get_remember_password(account)) |
|
36989fd1718f
make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@pidgin.im>
parents:
18940
diff
changeset
|
2121 | purple_account_set_password(account, NULL); |
|
36989fd1718f
make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@pidgin.im>
parents:
18940
diff
changeset
|
2122 | |
| 7865 | 2123 | msg = g_strdup(_("Incorrect password.")); |
| 2124 | break; | |
| 2125 | case 14: | |
| 9280 | 2126 | msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website.")); |
| 6761 | 2127 | break; |
| 2128 | default: | |
| 9280 | 2129 | msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err); |
| 6761 | 2130 | } |
| 7865 | 2131 | |
| 2132 | if (url) | |
| 2133 | fullmsg = g_strdup_printf("%s\n%s", msg, url); | |
| 2134 | else | |
| 2135 | fullmsg = g_strdup(msg); | |
| 2136 | ||
| 9280 | 2137 | gc->wants_to_die = TRUE; |
| 15884 | 2138 | purple_connection_error(gc, fullmsg); |
| 7865 | 2139 | g_free(msg); |
| 2140 | g_free(fullmsg); | |
| 6761 | 2141 | } |
| 2142 | ||
| 15884 | 2143 | static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6840 | 2144 | { |
| 2145 | int err = 0; | |
| 2146 | char *who = NULL; | |
| 2147 | char *group = NULL; | |
| 7827 | 2148 | char *decoded_group; |
| 6840 | 2149 | char *buf; |
| 9278 | 2150 | YahooFriend *f; |
| 6840 | 2151 | GSList *l = pkt->hash; |
| 2152 | ||
| 2153 | while (l) { | |
| 2154 | struct yahoo_pair *pair = l->data; | |
| 2155 | ||
| 2156 | switch (pair->key) { | |
| 2157 | case 66: | |
| 2158 | err = strtol(pair->value, NULL, 10); | |
| 2159 | break; | |
| 2160 | case 7: | |
| 2161 | who = pair->value; | |
| 2162 | break; | |
| 2163 | case 65: | |
| 2164 | group = pair->value; | |
| 2165 | break; | |
| 2166 | } | |
| 2167 | ||
| 2168 | l = l->next; | |
| 2169 | } | |
| 2170 | ||
| 2171 | if (!who) | |
| 2172 | return; | |
| 2173 | if (!group) | |
| 2174 | group = ""; | |
| 2175 | ||
| 2176 | if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ | |
| 9279 | 2177 | f = yahoo_friend_find_or_new(gc, who); |
| 2178 | yahoo_update_status(gc, who, f); | |
| 6840 | 2179 | return; |
| 2180 | } | |
| 2181 | ||
| 7827 | 2182 | decoded_group = yahoo_string_decode(gc, group, FALSE); |
| 6840 | 2183 | buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."), |
| 15884 | 2184 | who, decoded_group, purple_connection_get_display_name(gc)); |
| 2185 | if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) | |
| 2186 | purple_notify_error(gc, NULL, _("Could not add buddy to server list"), buf); | |
| 6840 | 2187 | g_free(buf); |
| 7827 | 2188 | g_free(decoded_group); |
| 6840 | 2189 | } |
| 2190 | ||
| 15884 | 2191 | static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9062 | 2192 | { |
| 2193 | GSList *l = pkt->hash; | |
| 2194 | char *who = NULL; | |
| 2195 | char *base64 = NULL; | |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
2196 | guchar *decoded; |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
2197 | gsize len; |
| 9062 | 2198 | |
| 2199 | while (l) { | |
| 2200 | struct yahoo_pair *pair = l->data; | |
| 2201 | ||
| 2202 | switch (pair->key) { | |
| 2203 | case 5: | |
| 2204 | /* our identity */ | |
| 2205 | break; | |
| 2206 | case 4: | |
| 2207 | who = pair->value; | |
| 2208 | break; | |
| 2209 | case 1: | |
| 2210 | /* who again, the master identity this time? */ | |
| 2211 | break; | |
| 2212 | case 12: | |
| 2213 | base64 = pair->value; | |
| 2214 | /* so, this is an ip address. in base64. decoded it's in ascii. | |
| 2215 | after strtol, it's in reversed byte order. Who thought this up?*/ | |
| 2216 | break; | |
| 2217 | /* | |
| 2218 | TODO: figure these out | |
| 2219 | yahoo: Key: 61 Value: 0 | |
| 2220 | yahoo: Key: 2 Value: | |
| 2221 | yahoo: Key: 13 Value: 0 | |
| 2222 | yahoo: Key: 49 Value: PEERTOPEER | |
| 2223 | yahoo: Key: 140 Value: 1 | |
| 2224 | yahoo: Key: 11 Value: -1786225828 | |
| 2225 | */ | |
| 2226 | ||
| 2227 | } | |
| 2228 | ||
| 2229 | l = l->next; | |
| 2230 | } | |
| 2231 | ||
| 9277 | 2232 | if (base64) { |
| 9281 | 2233 | guint32 ip; |
| 2234 | char *tmp2; | |
| 2235 | YahooFriend *f; | |
| 2236 | ||
| 15884 | 2237 | decoded = purple_base64_decode(base64, &len); |
| 9277 | 2238 | if (len) { |
| 15884 | 2239 | char *tmp = purple_str_binary_to_ascii(decoded, len); |
| 2240 | purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); | |
| 9277 | 2241 | g_free(tmp); |
| 2242 | } | |
| 9281 | 2243 | |
|
11144
c6fd3a852568
[gaim-migrate @ 13208]
Mark Doliner <markdoliner@pidgin.im>
parents:
11137
diff
changeset
|
2244 | tmp2 = g_strndup((const gchar *)decoded, len); /* so its \0 terminated...*/ |
| 9281 | 2245 | ip = strtol(tmp2, NULL, 10); |
| 2246 | g_free(tmp2); | |
| 9062 | 2247 | g_free(decoded); |
| 9281 | 2248 | tmp2 = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, |
| 2249 | (ip >> 24) & 0xff); | |
| 2250 | f = yahoo_friend_find(gc, who); | |
| 2251 | if (f) | |
| 2252 | yahoo_friend_set_ip(f, tmp2); | |
| 2253 | g_free(tmp2); | |
| 9062 | 2254 | } |
| 2255 | } | |
| 2256 | ||
| 15884 | 2257 | static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9604 | 2258 | { |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2259 | char *who = NULL, *msg = NULL, *id = NULL; |
| 9604 | 2260 | GSList *l = pkt->hash; |
| 2261 | ||
| 2262 | while (l) { | |
| 2263 | struct yahoo_pair *pair = l->data; | |
| 2264 | ||
| 2265 | switch (pair->key) { | |
| 2266 | case 4: | |
| 2267 | who = pair->value; | |
| 2268 | break; | |
| 2269 | case 5: | |
| 2270 | /* us */ | |
| 2271 | break; | |
| 2272 | case 230: | |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2273 | /* the audible, in foo.locale.bar.baz format |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2274 | eg: base.tw.smiley.smiley43 */ |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2275 | id = pair->value; |
| 9604 | 2276 | break; |
| 2277 | case 231: | |
| 2278 | /* the text of the audible */ | |
| 2279 | msg = pair->value; | |
| 2280 | break; | |
| 2281 | case 232: | |
| 2282 | /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */ | |
| 2283 | break; | |
| 2284 | } | |
| 2285 | ||
| 2286 | l = l->next; | |
| 2287 | } | |
| 2288 | ||
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2289 | if (!msg) |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2290 | msg = id; |
| 9604 | 2291 | if (!who || !msg) |
| 2292 | return; | |
| 2293 | if (!g_utf8_validate(msg, -1, NULL)) { | |
| 15884 | 2294 | purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); |
| 9604 | 2295 | return; |
| 2296 | } | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2297 | if (!yahoo_privacy_check(gc, who)) { |
| 15884 | 2298 | purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2299 | gc->account->username, who); |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2300 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2301 | } |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2302 | if (id) { |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2303 | /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */ |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2304 | char **audible_locale = g_strsplit(id, ".", 0); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2305 | char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2306 | g_strfreev(audible_locale); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2307 | |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2308 | serv_got_im(gc, who, buf, 0, time(NULL)); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2309 | g_free(buf); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2310 | } else |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2311 | serv_got_im(gc, who, msg, 0, time(NULL)); |
| 9604 | 2312 | } |
| 2313 | ||
| 15884 | 2314 | static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 2315 | { |
| 6760 | 2316 | switch (pkt->service) { |
| 2681 | 2317 | case YAHOO_SERVICE_LOGON: |
|
2771
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
2318 | case YAHOO_SERVICE_LOGOFF: |
| 2681 | 2319 | case YAHOO_SERVICE_ISAWAY: |
|
2737
f7edb9c3f348
[gaim-migrate @ 2750]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2724
diff
changeset
|
2320 | case YAHOO_SERVICE_ISBACK: |
| 3019 | 2321 | case YAHOO_SERVICE_GAMELOGON: |
| 2322 | case YAHOO_SERVICE_GAMELOGOFF: | |
| 6686 | 2323 | case YAHOO_SERVICE_CHATLOGON: |
| 2324 | case YAHOO_SERVICE_CHATLOGOFF: | |
| 10373 | 2325 | case YAHOO_SERVICE_Y6_STATUS_UPDATE: |
| 14320 | 2326 | case YAHOO_SERVICE_STATUS_15: |
| 2681 | 2327 | yahoo_process_status(gc, pkt); |
| 2328 | break; | |
| 3019 | 2329 | case YAHOO_SERVICE_NOTIFY: |
| 2330 | yahoo_process_notify(gc, pkt); | |
| 2993 | 2331 | break; |
| 2681 | 2332 | case YAHOO_SERVICE_MESSAGE: |
| 2786 | 2333 | case YAHOO_SERVICE_GAMEMSG: |
| 5939 | 2334 | case YAHOO_SERVICE_CHATMSG: |
| 2681 | 2335 | yahoo_process_message(gc, pkt); |
| 2336 | break; | |
| 7865 | 2337 | case YAHOO_SERVICE_SYSMESSAGE: |
| 2338 | yahoo_process_sysmessage(gc, pkt); | |
| 2339 | break; | |
| 2681 | 2340 | case YAHOO_SERVICE_NEWMAIL: |
| 2341 | yahoo_process_mail(gc, pkt); | |
| 2342 | break; | |
| 2343 | case YAHOO_SERVICE_NEWCONTACT: | |
| 2344 | yahoo_process_contact(gc, pkt); | |
| 2345 | break; | |
| 6784 | 2346 | case YAHOO_SERVICE_AUTHRESP: |
| 2347 | yahoo_process_authresp(gc, pkt); | |
| 2348 | break; | |
| 2681 | 2349 | case YAHOO_SERVICE_LIST: |
| 2350 | yahoo_process_list(gc, pkt); | |
| 2351 | break; | |
| 14320 | 2352 | case YAHOO_SERVICE_LIST_15: |
| 2353 | yahoo_process_list_15(gc, pkt); | |
| 2354 | break; | |
| 3147 | 2355 | case YAHOO_SERVICE_AUTH: |
| 2356 | yahoo_process_auth(gc, pkt); | |
| 2357 | break; | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
2358 | case YAHOO_SERVICE_AUTH_REQ_15: |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
2359 | yahoo_buddy_auth_req_15(gc, pkt); |
|
19538
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
2360 | break; |
| 6840 | 2361 | case YAHOO_SERVICE_ADDBUDDY: |
| 2362 | yahoo_process_addbuddy(gc, pkt); | |
| 2363 | break; | |
| 6760 | 2364 | case YAHOO_SERVICE_IGNORECONTACT: |
| 2365 | yahoo_process_ignore(gc, pkt); | |
| 2366 | break; | |
| 6729 | 2367 | case YAHOO_SERVICE_CONFINVITE: |
| 2368 | case YAHOO_SERVICE_CONFADDINVITE: | |
| 2369 | yahoo_process_conference_invite(gc, pkt); | |
| 2370 | break; | |
| 2371 | case YAHOO_SERVICE_CONFDECLINE: | |
| 2372 | yahoo_process_conference_decline(gc, pkt); | |
| 2373 | break; | |
| 2374 | case YAHOO_SERVICE_CONFLOGON: | |
| 2375 | yahoo_process_conference_logon(gc, pkt); | |
| 2376 | break; | |
| 2377 | case YAHOO_SERVICE_CONFLOGOFF: | |
| 2378 | yahoo_process_conference_logoff(gc, pkt); | |
| 2379 | break; | |
| 2380 | case YAHOO_SERVICE_CONFMSG: | |
| 2381 | yahoo_process_conference_message(gc, pkt); | |
| 2382 | break; | |
| 2383 | case YAHOO_SERVICE_CHATONLINE: | |
| 2384 | yahoo_process_chat_online(gc, pkt); | |
| 2385 | break; | |
| 2386 | case YAHOO_SERVICE_CHATLOGOUT: | |
| 2387 | yahoo_process_chat_logout(gc, pkt); | |
| 2388 | break; | |
| 2389 | case YAHOO_SERVICE_CHATGOTO: | |
| 2390 | yahoo_process_chat_goto(gc, pkt); | |
| 2391 | break; | |
| 2392 | case YAHOO_SERVICE_CHATJOIN: | |
| 2393 | yahoo_process_chat_join(gc, pkt); | |
| 2394 | break; | |
| 2395 | case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */ | |
| 2396 | case YAHOO_SERVICE_CHATEXIT: | |
| 2397 | yahoo_process_chat_exit(gc, pkt); | |
| 2398 | break; | |
| 2399 | case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */ | |
| 2400 | case YAHOO_SERVICE_CHATADDINVITE: | |
| 2401 | yahoo_process_chat_addinvite(gc, pkt); | |
| 2402 | break; | |
| 2403 | case YAHOO_SERVICE_COMMENT: | |
| 2404 | yahoo_process_chat_message(gc, pkt); | |
| 2405 | break; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2406 | case YAHOO_SERVICE_PRESENCE_PERM: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2407 | case YAHOO_SERVICE_PRESENCE_SESSION: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2408 | yahoo_process_presence(gc, pkt); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
2409 | break; |
| 7651 | 2410 | case YAHOO_SERVICE_P2PFILEXFER: |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
2411 | /* This case had no break and continued; thus keeping it this way.*/ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11897
diff
changeset
|
2412 | yahoo_process_p2pfilexfer(gc, pkt); |
| 7651 | 2413 | case YAHOO_SERVICE_FILETRANSFER: |
| 2414 | yahoo_process_filetransfer(gc, pkt); | |
| 2415 | break; | |
|
11180
4098d74c03c2
[gaim-migrate @ 13291]
Daniel Atallah <datallah@pidgin.im>
parents:
11153
diff
changeset
|
2416 | case YAHOO_SERVICE_PEERTOPEER: |
| 9062 | 2417 | yahoo_process_p2p(gc, pkt); |
| 2418 | break; | |
| 9284 | 2419 | case YAHOO_SERVICE_PICTURE: |
| 2420 | yahoo_process_picture(gc, pkt); | |
| 2421 | break; | |
| 9292 | 2422 | case YAHOO_SERVICE_PICTURE_UPDATE: |
| 2423 | yahoo_process_picture_update(gc, pkt); | |
| 2424 | break; | |
| 2425 | case YAHOO_SERVICE_PICTURE_CHECKSUM: | |
| 2426 | yahoo_process_picture_checksum(gc, pkt); | |
| 2427 | break; | |
| 9306 | 2428 | case YAHOO_SERVICE_PICTURE_UPLOAD: |
| 2429 | yahoo_process_picture_upload(gc, pkt); | |
| 2430 | break; | |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2431 | case YAHOO_SERVICE_AVATAR_UPDATE: |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2432 | yahoo_process_avatar_update(gc, pkt); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2433 | break; |
| 9604 | 2434 | case YAHOO_SERVICE_AUDIBLE: |
| 2435 | yahoo_process_audible(gc, pkt); | |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2436 | break; |
| 2681 | 2437 | default: |
| 15884 | 2438 | purple_debug(PURPLE_DEBUG_ERROR, "yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2439 | "Unhandled service 0x%02x\n", pkt->service); |
| 2681 | 2440 | break; |
| 2441 | } | |
| 2442 | } | |
| 2443 | ||
| 15884 | 2444 | static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 2681 | 2445 | { |
| 15884 | 2446 | PurpleConnection *gc = data; |
| 2681 | 2447 | struct yahoo_data *yd = gc->proto_data; |
| 2448 | char buf[1024]; | |
| 2449 | int len; | |
| 2450 | ||
| 2451 | len = read(yd->fd, buf, sizeof(buf)); | |
| 2452 | ||
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2453 | if (len < 0) { |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2454 | gchar *tmp; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2455 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2456 | if (errno == EAGAIN) |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2457 | /* No worries */ |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2458 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2459 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2460 | tmp = g_strdup_printf(_("Lost connection with server:\n%s"), |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2461 | strerror(errno)); |
| 15884 | 2462 | purple_connection_error(gc, tmp); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2463 | g_free(tmp); |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2464 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2465 | } else if (len == 0) { |
| 15884 | 2466 | purple_connection_error(gc, _("Server closed the connection.")); |
| 2681 | 2467 | return; |
| 2468 | } | |
| 2469 | ||
| 2470 | yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); | |
| 2471 | memcpy(yd->rxqueue + yd->rxlen, buf, len); | |
| 2472 | yd->rxlen += len; | |
| 2473 | ||
| 2474 | while (1) { | |
| 2475 | struct yahoo_packet *pkt; | |
| 2476 | int pos = 0; | |
| 2477 | int pktlen; | |
| 2478 | ||
| 2479 | if (yd->rxlen < YAHOO_PACKET_HDRLEN) | |
| 2480 | return; | |
| 2481 | ||
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11303
diff
changeset
|
2482 | if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { |
| 10610 | 2483 | /* HEY! This isn't even a YMSG packet. What |
| 2484 | * are you trying to pull? */ | |
| 2485 | guchar *start; | |
| 2486 | ||
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2487 | purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n"); |
| 10611 | 2488 | |
| 10635 | 2489 | start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); |
| 10610 | 2490 | if (start) { |
| 2491 | g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); | |
| 2492 | yd->rxlen -= start - yd->rxqueue; | |
| 2493 | continue; | |
| 2494 | } else { | |
| 2495 | g_free(yd->rxqueue); | |
| 2496 | yd->rxqueue = NULL; | |
| 2497 | yd->rxlen = 0; | |
| 2498 | return; | |
| 2499 | } | |
| 2500 | } | |
| 2501 | ||
| 2681 | 2502 | pos += 4; /* YMSG */ |
| 2503 | pos += 2; | |
| 2504 | pos += 2; | |
| 2505 | ||
| 2506 | pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
| 15884 | 2507 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2508 | "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
| 2681 | 2509 | |
| 2510 | if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) | |
| 2511 | return; | |
| 2512 | ||
| 2513 | yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); | |
| 2514 | ||
| 2515 | pkt = yahoo_packet_new(0, 0, 0); | |
| 2516 | ||
| 2517 | pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
| 3021 | 2518 | pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 15884 | 2519 | purple_debug(PURPLE_DEBUG_MISC, "yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2520 | "Yahoo Service: 0x%02x Status: %d\n", |
|
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2521 | pkt->service, pkt->status); |
| 2681 | 2522 | pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 2523 | ||
| 2524 | yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); | |
| 2525 | ||
| 2526 | yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; | |
| 2527 | if (yd->rxlen) { | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11303
diff
changeset
|
2528 | guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); |
| 2681 | 2529 | g_free(yd->rxqueue); |
| 2530 | yd->rxqueue = tmp; | |
| 2531 | } else { | |
| 2532 | g_free(yd->rxqueue); | |
| 2533 | yd->rxqueue = NULL; | |
| 2534 | } | |
| 2535 | ||
| 2536 | yahoo_packet_process(gc, pkt); | |
| 2537 | ||
| 2538 | yahoo_packet_free(pkt); | |
| 2539 | } | |
| 2540 | } | |
| 2541 | ||
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
2542 | static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
| 2681 | 2543 | { |
| 15884 | 2544 | PurpleConnection *gc = data; |
| 2681 | 2545 | struct yahoo_data *yd; |
| 2546 | struct yahoo_packet *pkt; | |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
2547 | |
| 15884 | 2548 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 2681 | 2549 | close(source); |
| 2550 | return; | |
| 2551 | } | |
| 2552 | ||
| 2553 | if (source < 0) { | |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2554 | gchar *tmp; |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2555 | tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2556 | error_message); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2557 | purple_connection_error(gc, tmp); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2558 | g_free(tmp); |
| 2681 | 2559 | return; |
| 2560 | } | |
| 2561 | ||
| 2562 | yd = gc->proto_data; | |
| 2563 | yd->fd = source; | |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
2564 | |
|
11078
b611f3a7800c
[gaim-migrate @ 13088]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11077
diff
changeset
|
2565 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0); |
| 2681 | 2566 | |
| 15884 | 2567 | yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); |
| 10392 | 2568 | yahoo_packet_send_and_free(pkt, yd); |
| 2681 | 2569 | |
| 15884 | 2570 | gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
| 2681 | 2571 | } |
| 9370 | 2572 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2573 | #ifdef TRY_WEBMESSENGER_LOGIN |
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
2574 | static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
| 7134 | 2575 | { |
| 15884 | 2576 | PurpleConnection *gc = data; |
| 7134 | 2577 | struct yahoo_data *yd; |
| 2578 | struct yahoo_packet *pkt; | |
| 2579 | ||
| 15884 | 2580 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
| 7134 | 2581 | close(source); |
| 2582 | return; | |
| 2583 | } | |
| 2584 | ||
| 2585 | if (source < 0) { | |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2586 | gchar *tmp; |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2587 | tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"), |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2588 | error_message); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2589 | purple_connection_error(gc, tmp); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2590 | g_free(tmp); |
| 7134 | 2591 | return; |
| 2592 | } | |
| 2593 | ||
| 2594 | yd = gc->proto_data; | |
| 2595 | yd->fd = source; | |
| 2596 | ||
| 2597 | pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); | |
| 2598 | ||
| 10394 | 2599 | yahoo_packet_hash(pkt, "sss", 0, |
| 15884 | 2600 | purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
| 2601 | 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), | |
| 10394 | 2602 | 6, yd->auth); |
| 10392 | 2603 | yahoo_packet_send_and_free(pkt, yd); |
| 2604 | ||
| 7134 | 2605 | g_free(yd->auth); |
| 15884 | 2606 | gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
| 7134 | 2607 | } |
| 2608 | ||
| 15884 | 2609 | static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 7134 | 2610 | { |
| 15884 | 2611 | PurpleConnection *gc = data; |
| 2612 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 7134 | 2613 | struct yahoo_data *yd = gc->proto_data; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2614 | char bufread[2048], *i = bufread, *buf = bufread; |
| 8161 | 2615 | int len; |
| 2616 | GString *s; | |
| 7134 | 2617 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2618 | len = read(source, bufread, sizeof(bufread) - 1); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2619 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2620 | if (len < 0) { |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2621 | gchar *tmp; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2622 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2623 | if (errno == EAGAIN) |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2624 | /* No worries */ |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2625 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2626 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2627 | tmp = g_strdup_printf(_("Lost connection with server:\n%s"), |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2628 | strerror(errno)); |
| 15884 | 2629 | purple_connection_error(gc, tmp); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2630 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2631 | return; |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2632 | } else if (len == 0) { |
| 15884 | 2633 | purple_connection_error(gc, _("Server closed the connection.")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2634 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2635 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2636 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2637 | if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) { |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2638 | yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2639 | memcpy(yd->rxqueue + yd->rxlen, buf, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2640 | yd->rxlen += len; |
| 14321 | 2641 | i = buf = (char *)yd->rxqueue; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2642 | len = yd->rxlen; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2643 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2644 | buf[len] = '\0'; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2645 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2646 | if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) && |
|
8216
9c4bc4d5a373
[gaim-migrate @ 8939]
Christian Hammond <chipx86@chipx86.com>
parents:
8212
diff
changeset
|
2647 | strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { |
| 15884 | 2648 | purple_connection_error(gc, _("Received unexpected HTTP response from server.")); |
| 7134 | 2649 | return; |
| 2650 | } | |
| 8161 | 2651 | |
| 2652 | s = g_string_sized_new(len); | |
| 2653 | ||
| 2654 | while ((i = strstr(i, "Set-Cookie: "))) { | |
| 2655 | i += strlen("Set-Cookie: "); | |
| 8243 | 2656 | for (;*i != ';' && *i != '\0'; i++) |
| 8161 | 2657 | g_string_append_c(s, *i); |
| 2658 | ||
| 2659 | g_string_append(s, "; "); | |
| 7134 | 2660 | } |
| 8161 | 2661 | |
| 2662 | yd->auth = g_string_free(s, FALSE); | |
| 15884 | 2663 | purple_input_remove(gc->inpa); |
| 7134 | 2664 | close(source); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2665 | g_free(yd->rxqueue); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2666 | yd->rxqueue = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2667 | yd->rxlen = 0; |
| 7134 | 2668 | /* Now we have our cookies to login with. I'll go get the milk. */ |
| 15884 | 2669 | if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", |
| 2670 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), | |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
2671 | yahoo_got_web_connected, gc) == NULL) { |
| 15884 | 2672 | purple_connection_error(gc, _("Connection problem")); |
| 7134 | 2673 | return; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
2674 | } |
| 7134 | 2675 | } |
| 2676 | ||
| 15884 | 2677 | static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
| 7134 | 2678 | { |
| 15884 | 2679 | PurpleConnection *gc; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2680 | struct yahoo_data *yd; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2681 | int written, remaining; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2682 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2683 | gc = data; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2684 | yd = gc->proto_data; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2685 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2686 | remaining = strlen(yd->auth) - yd->auth_written; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2687 | written = write(source, yd->auth + yd->auth_written, remaining); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2688 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2689 | if (written < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2690 | written = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2691 | else if (written <= 0) { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2692 | gchar *tmp; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2693 | g_free(yd->auth); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2694 | yd->auth = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2695 | if (gc->inpa) |
| 15884 | 2696 | purple_input_remove(gc->inpa); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2697 | gc->inpa = 0; |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2698 | tmp = g_strdup_printf(_("Lost connection with %s:\n%s"), |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2699 | "login.yahoo.com:80", strerror(errno)); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2700 | purple_connection_error(gc, tmp); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2701 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2702 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2703 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2704 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2705 | if (written < remaining) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2706 | yd->auth_written += written; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2707 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2708 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2709 | |
| 7134 | 2710 | g_free(yd->auth); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2711 | yd->auth = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2712 | yd->auth_written = 0; |
| 15884 | 2713 | purple_input_remove(gc->inpa); |
| 2714 | gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); | |
| 7134 | 2715 | } |
| 2716 | ||
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
2717 | static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message) |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2718 | { |
| 15884 | 2719 | PurpleConnection *gc = data; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2720 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2721 | if (source < 0) { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2722 | gchar *tmp; |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2723 | tmp = g_strdup_printf(_("Could not establish a connection with %s:\n%s"), |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2724 | "login.yahoo.com:80", error_message); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2725 | purple_connection_error(gc, tmp); |
|
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2726 | g_free(tmp); |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2727 | return; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2728 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2729 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2730 | if (gc->inpa == 0) |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2731 | { |
| 15884 | 2732 | gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2733 | yahoo_got_cookies_send_cb, gc); |
| 15884 | 2734 | yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2735 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2736 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
2737 | |
| 7134 | 2738 | static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) |
| 2739 | { | |
| 2740 | if (!strcmp(key, "passwd")) | |
| 2741 | return; | |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
2742 | g_string_append_c(url, '&'); |
|
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
2743 | g_string_append(url, key); |
|
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
2744 | g_string_append_c(url, '='); |
| 7134 | 2745 | if (!strcmp(key, ".save") || !strcmp(key, ".js")) |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
2746 | g_string_append_c(url, '1'); |
| 7134 | 2747 | else if (!strcmp(key, ".challenge")) |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
2748 | g_string_append(url, val); |
| 7134 | 2749 | else |
| 15884 | 2750 | g_string_append(url, purple_url_encode(val)); |
| 7134 | 2751 | } |
| 2752 | ||
| 2753 | static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) | |
| 2754 | { | |
| 2755 | GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
|
7138
12b7979bce6e
[gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents:
7134
diff
changeset
|
2756 | const char *c = buf; |
|
12b7979bce6e
[gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents:
7134
diff
changeset
|
2757 | char *d; |
| 7134 | 2758 | char name[64], value[64]; |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2759 | int count; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2760 | int input_len = strlen("<input "); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2761 | int name_len = strlen("name=\""); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2762 | int value_len = strlen("value=\""); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2763 | while ((len > ((c - buf) + input_len)) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2764 | && (c = strstr(c, "<input "))) { |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2765 | if (!(c = g_strstr_len(c, len - (c - buf), "name=\""))) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2766 | continue; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2767 | c += name_len; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2768 | count = sizeof(name)-1; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2769 | for (d = name; (len > ((c - buf) + 1)) && *c!='"' |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2770 | && count; c++, d++, count--) |
| 7134 | 2771 | *d = *c; |
| 2772 | *d = '\0'; | |
|
8118
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
2773 | count = sizeof(value)-1; |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2774 | if (!(d = g_strstr_len(c, len - (c - buf), "value=\""))) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2775 | continue; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2776 | d += value_len; |
| 7134 | 2777 | if (strchr(c, '>') < d) |
| 2778 | break; | |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2779 | for (c = d, d = value; (len > ((c - buf) + 1)) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
2780 | && *c!='"' && count; c++, d++, count--) |
| 7134 | 2781 | *d = *c; |
| 2782 | *d = '\0'; | |
| 2783 | g_hash_table_insert(hash, g_strdup(name), g_strdup(value)); | |
| 2784 | } | |
| 2785 | return hash; | |
| 2786 | } | |
| 2787 | ||
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2788 | static void |
| 15884 | 2789 | yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2790 | const gchar *url_text, size_t len, const gchar *error_message) |
| 7134 | 2791 | { |
| 15884 | 2792 | PurpleConnection *gc = (PurpleConnection *)user_data; |
| 2793 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 7134 | 2794 | struct yahoo_data *yd = gc->proto_data; |
| 15884 | 2795 | const char *sn = purple_account_get_username(account); |
| 2796 | const char *pass = purple_connection_get_password(gc); | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2797 | GHashTable *hash = yahoo_login_page_hash(url_text, len); |
|
10575
f360d2dc8a1c
[gaim-migrate @ 11968]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10553
diff
changeset
|
2798 | GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
| 7134 | 2799 | char md5[33], *hashp = md5, *chal; |
| 2800 | int i; | |
| 15884 | 2801 | PurpleCipher *cipher; |
| 2802 | PurpleCipherContext *context; | |
|
11183
be87fe695c93
[gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents:
11180
diff
changeset
|
2803 | guchar digest[16]; |
|
7191
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
2804 | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2805 | yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2806 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2807 | if (error_message != NULL) |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2808 | { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2809 | purple_connection_error(gc, error_message); |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2810 | return; |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2811 | } |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2812 | |
|
7191
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
2813 | url = g_string_append(url, sn); |
|
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
2814 | url = g_string_append(url, "&passwd="); |
|
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
2815 | |
| 15884 | 2816 | cipher = purple_ciphers_find_cipher("md5"); |
| 2817 | context = purple_cipher_context_new(cipher, NULL); | |
| 2818 | ||
| 2819 | purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); | |
| 2820 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 2821 | for (i = 0; i < 16; ++i) { |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2822 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 2823 | hashp += 2; |
| 2824 | } | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2825 | |
| 7134 | 2826 | chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); |
| 15884 | 2827 | purple_cipher_context_reset(context, NULL); |
| 2828 | purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); | |
| 2829 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 2830 | hashp = md5; |
| 2831 | for (i = 0; i < 16; ++i) { | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2832 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 2833 | hashp += 2; |
| 2834 | } | |
| 2835 | /* | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2836 | * I dunno why this is here and commented out.. but in case it's needed |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2837 | * I updated it.. |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2838 | |
| 15884 | 2839 | purple_cipher_context_reset(context, NULL); |
| 2840 | purple_cipher_context_append(context, md5, strlen(md5)); | |
| 2841 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 2842 | hashp = md5; |
| 2843 | for (i = 0; i < 16; ++i) { | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2844 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 2845 | hashp += 2; |
| 2846 | } | |
| 2847 | */ | |
| 2848 | g_free(chal); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
2849 | |
| 7134 | 2850 | url = g_string_append(url, md5); |
|
7138
12b7979bce6e
[gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents:
7134
diff
changeset
|
2851 | g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
2852 | |
| 7134 | 2853 | url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" |
| 2854 | "Host: login.yahoo.com\r\n\r\n"); | |
| 2855 | g_hash_table_destroy(hash); | |
| 2856 | yd->auth = g_string_free(url, FALSE); | |
| 15884 | 2857 | if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { |
| 2858 | purple_connection_error(gc, _("Connection problem")); | |
| 7134 | 2859 | return; |
| 2860 | } | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
2861 | |
| 15884 | 2862 | purple_cipher_context_destroy(context); |
| 7134 | 2863 | } |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2864 | #endif |
| 7134 | 2865 | |
| 15884 | 2866 | static void yahoo_server_check(PurpleAccount *account) |
| 7883 | 2867 | { |
| 2868 | const char *server; | |
| 2869 | ||
| 15884 | 2870 | server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST); |
| 7883 | 2871 | |
| 2872 | if (strcmp(server, "scs.yahoo.com") == 0) | |
| 15884 | 2873 | purple_account_set_string(account, "server", YAHOO_PAGER_HOST); |
| 7883 | 2874 | } |
| 9306 | 2875 | |
| 15884 | 2876 | static void yahoo_picture_check(PurpleAccount *account) |
| 9306 | 2877 | { |
| 15884 | 2878 | PurpleConnection *gc = purple_account_get_connection(account); |
|
16538
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
2879 | PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account); |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
2880 | |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
2881 | yahoo_set_buddy_icon(gc, img); |
|
c7e61e2917c9
Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@pidgin.im>
parents:
16534
diff
changeset
|
2882 | purple_imgstore_unref(img); |
| 9306 | 2883 | } |
| 2884 | ||
| 15884 | 2885 | static int get_yahoo_status_from_purple_status(PurpleStatus *status) |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2886 | { |
| 15884 | 2887 | PurplePresence *presence; |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2888 | const char *status_id; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2889 | const char *msg; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2890 | |
| 15884 | 2891 | presence = purple_status_get_presence(status); |
| 2892 | status_id = purple_status_get_id(status); | |
| 2893 | msg = purple_status_get_attr_string(status, "message"); | |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2894 | |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2895 | if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2896 | if ((msg != NULL) && (*msg != '\0')) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2897 | return YAHOO_STATUS_CUSTOM; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2898 | else |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2899 | return YAHOO_STATUS_AVAILABLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2900 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2901 | return YAHOO_STATUS_BRB; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2902 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2903 | return YAHOO_STATUS_BUSY; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2904 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2905 | return YAHOO_STATUS_NOTATHOME; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2906 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2907 | return YAHOO_STATUS_NOTATDESK; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2908 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2909 | return YAHOO_STATUS_NOTINOFFICE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2910 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2911 | return YAHOO_STATUS_ONPHONE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2912 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2913 | return YAHOO_STATUS_ONVACATION; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2914 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2915 | return YAHOO_STATUS_OUTTOLUNCH; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2916 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2917 | return YAHOO_STATUS_STEPPEDOUT; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2918 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2919 | return YAHOO_STATUS_INVISIBLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2920 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2921 | return YAHOO_STATUS_CUSTOM; |
| 15884 | 2922 | } else if (purple_presence_is_idle(presence)) { |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2923 | return YAHOO_STATUS_IDLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2924 | } else { |
| 15884 | 2925 | purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2926 | return YAHOO_STATUS_AVAILABLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2927 | } |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2928 | } |
| 7883 | 2929 | |
| 15884 | 2930 | static void yahoo_login(PurpleAccount *account) { |
| 2931 | PurpleConnection *gc = purple_account_get_connection(account); | |
| 2681 | 2932 | struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
| 15884 | 2933 | PurpleStatus *status = purple_account_get_active_status(account); |
| 2934 | gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; | |
| 2935 | ||
| 2936 | purple_connection_update_progress(gc, _("Connecting"), 1, 2); | |
| 2937 | ||
| 2938 | purple_connection_set_display_name(gc, purple_account_get_username(account)); | |
| 8235 | 2939 | |
| 2681 | 2940 | yd->fd = -1; |
|
19573
03c72c532d5a
Input handlers are unsigned integers. So set them to 0 instead of -1 after
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19545
diff
changeset
|
2941 | yd->txhandler = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
2942 | /* TODO: Is there a good grow size for the buffer? */ |
| 15884 | 2943 | yd->txbuf = purple_circ_buffer_new(0); |
| 6784 | 2944 | yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
2945 | yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
| 6729 | 2946 | yd->confs = NULL; |
| 2947 | yd->conf_id = 2; | |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
2948 | |
| 15884 | 2949 | yd->current_status = get_yahoo_status_from_purple_status(status); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
2950 | |
| 7883 | 2951 | yahoo_server_check(account); |
| 9306 | 2952 | yahoo_picture_check(account); |
| 7883 | 2953 | |
| 15884 | 2954 | if (purple_account_get_bool(account, "yahoojp", FALSE)) { |
| 9164 | 2955 | yd->jp = TRUE; |
| 15884 | 2956 | if (purple_proxy_connect(gc, account, |
| 2957 | purple_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST), | |
| 2958 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), | |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
2959 | yahoo_got_connected, gc) == NULL) |
| 9164 | 2960 | { |
| 15884 | 2961 | purple_connection_error(gc, _("Connection problem")); |
| 9164 | 2962 | return; |
| 2963 | } | |
| 2964 | } else { | |
| 2965 | yd->jp = FALSE; | |
| 15884 | 2966 | if (purple_proxy_connect(gc, account, |
| 2967 | purple_account_get_string(account, "server", YAHOO_PAGER_HOST), | |
| 2968 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), | |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
2969 | yahoo_got_connected, gc) == NULL) |
| 9164 | 2970 | { |
| 15884 | 2971 | purple_connection_error(gc, _("Connection problem")); |
| 9164 | 2972 | return; |
| 2973 | } | |
| 2681 | 2974 | } |
| 2975 | } | |
| 2976 | ||
| 15884 | 2977 | static void yahoo_close(PurpleConnection *gc) { |
| 2681 | 2978 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 9782 | 2979 | GSList *l; |
| 2980 | ||
| 11608 | 2981 | if (gc->inpa) |
| 15884 | 2982 | purple_input_remove(gc->inpa); |
| 11608 | 2983 | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2984 | while (yd->url_datas) { |
| 15884 | 2985 | purple_util_fetch_url_cancel(yd->url_datas->data); |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2986 | yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas); |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2987 | } |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2988 | |
| 9782 | 2989 | for (l = yd->confs; l; l = l->next) { |
| 15884 | 2990 | PurpleConversation *conv = l->data; |
| 2991 | ||
| 2992 | yahoo_conf_leave(yd, purple_conversation_get_name(conv), | |
| 2993 | purple_connection_get_display_name(gc), | |
| 2994 | purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); | |
| 9782 | 2995 | } |
| 2996 | g_slist_free(yd->confs); | |
| 6729 | 2997 | |
|
12841
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
2998 | yd->chat_online = 0; |
|
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
2999 | if (yd->in_chat) |
|
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
3000 | yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ |
|
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
3001 | |
| 6784 | 3002 | g_hash_table_destroy(yd->friends); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3003 | g_hash_table_destroy(yd->imvironments); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3004 | g_free(yd->chat_name); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3005 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3006 | g_free(yd->cookie_y); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3007 | g_free(yd->cookie_t); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3008 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3009 | if (yd->txhandler) |
| 15884 | 3010 | purple_input_remove(yd->txhandler); |
| 3011 | ||
| 3012 | purple_circ_buffer_destroy(yd->txbuf); | |
| 7651 | 3013 | |
| 2681 | 3014 | if (yd->fd >= 0) |
| 3015 | close(yd->fd); | |
|
3720
dbba62e0d603
[gaim-migrate @ 3853]
Herman Bloggs <herman@bluedigits.com>
parents:
3642
diff
changeset
|
3016 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3017 | g_free(yd->rxqueue); |
|
2687
664e22f507cf
[gaim-migrate @ 2700]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2686
diff
changeset
|
3018 | yd->rxlen = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3019 | g_free(yd->picture_url); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3020 | |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14604
diff
changeset
|
3021 | if (yd->buddy_icon_connect_data) |
| 15884 | 3022 | purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
| 9306 | 3023 | if (yd->picture_upload_todo) |
| 3024 | yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); | |
| 9376 | 3025 | if (yd->ycht) |
| 3026 | ycht_connection_close(yd->ycht); | |
| 11608 | 3027 | |
|
19716
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19703
diff
changeset
|
3028 | g_free(yd->pending_chat_room); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19703
diff
changeset
|
3029 | g_free(yd->pending_chat_id); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19703
diff
changeset
|
3030 | g_free(yd->pending_chat_topic); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19703
diff
changeset
|
3031 | g_free(yd->pending_chat_goto); |
|
3f161bed09f6
Fix yahoo chats again for their new super-duper-ultra-mega secure captcha stuff. "/join chat" still doesn't work, you need to use the roomlist because they now require the chat id to be set (the native client also has this problem). Fixes #2860.
Daniel Atallah <datallah@pidgin.im>
parents:
19703
diff
changeset
|
3032 | |
| 2681 | 3033 | g_free(yd); |
|
13344
fde4e6dc84f8
[gaim-migrate @ 15713]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13297
diff
changeset
|
3034 | gc->proto_data = NULL; |
| 2681 | 3035 | } |
| 3036 | ||
| 15884 | 3037 | static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 2681 | 3038 | { |
| 4687 | 3039 | return "yahoo"; |
| 2681 | 3040 | } |
| 4916 | 3041 | |
| 15884 | 3042 | static const char *yahoo_list_emblem(PurpleBuddy *b) |
| 4916 | 3043 | { |
| 15884 | 3044 | PurpleAccount *account; |
| 3045 | PurpleConnection *gc; | |
| 6784 | 3046 | struct yahoo_data *yd; |
| 9278 | 3047 | YahooFriend *f; |
| 15884 | 3048 | PurplePresence *presence; |
| 3049 | ||
| 3050 | if (!b || !(account = b->account) || !(gc = purple_account_get_connection(account)) || | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
3051 | !(yd = gc->proto_data)) |
|
15558
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
3052 | return NULL; |
| 6784 | 3053 | |
| 9279 | 3054 | f = yahoo_friend_find(gc, b->name); |
| 6784 | 3055 | if (!f) { |
| 15524 | 3056 | return "not-authorized"; |
| 6784 | 3057 | } |
| 3058 | ||
| 15884 | 3059 | presence = purple_buddy_get_presence(b); |
| 3060 | ||
| 3061 | if (purple_presence_is_online(presence)) { | |
| 9283 | 3062 | if (yahoo_friend_get_game(f)) |
| 15524 | 3063 | return "game"; |
| 14366 | 3064 | if (f->protocol == 2) |
| 15524 | 3065 | return "msn"; |
| 4916 | 3066 | } |
| 15524 | 3067 | return NULL; |
| 4916 | 3068 | } |
| 2681 | 3069 | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3070 | static const char *yahoo_get_status_string(enum yahoo_status a) |
| 2681 | 3071 | { |
| 3072 | switch (a) { | |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3073 | case YAHOO_STATUS_BRB: |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3074 | return _("Be Right Back"); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3075 | case YAHOO_STATUS_BUSY: |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3076 | return _("Busy"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3077 | case YAHOO_STATUS_NOTATHOME: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3078 | return _("Not at Home"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3079 | case YAHOO_STATUS_NOTATDESK: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3080 | return _("Not at Desk"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3081 | case YAHOO_STATUS_NOTINOFFICE: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3082 | return _("Not in Office"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3083 | case YAHOO_STATUS_ONPHONE: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3084 | return _("On the Phone"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3085 | case YAHOO_STATUS_ONVACATION: |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3086 | return _("On Vacation"); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3087 | case YAHOO_STATUS_OUTTOLUNCH: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3088 | return _("Out to Lunch"); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3089 | case YAHOO_STATUS_STEPPEDOUT: |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3090 | return _("Stepped Out"); |
|
2873
9e56887eeb06
[gaim-migrate @ 2886]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2856
diff
changeset
|
3091 | case YAHOO_STATUS_INVISIBLE: |
|
4596
64e72bf4ece4
[gaim-migrate @ 4881]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
4491
diff
changeset
|
3092 | return _("Invisible"); |
| 4730 | 3093 | case YAHOO_STATUS_IDLE: |
| 3094 | return _("Idle"); | |
| 6784 | 3095 | case YAHOO_STATUS_OFFLINE: |
| 3096 | return _("Offline"); | |
|
2879
e417cf7111c4
[gaim-migrate @ 2892]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2878
diff
changeset
|
3097 | default: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3098 | return _("Available"); |
| 2681 | 3099 | } |
| 3100 | } | |
| 3101 | ||
| 15884 | 3102 | static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { |
| 3103 | ||
| 3104 | PurpleBuddy *buddy; | |
| 3105 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3106 | |
| 6729 | 3107 | GHashTable *components; |
| 3108 | struct yahoo_data *yd; | |
| 3109 | int id; | |
| 3110 | ||
| 15884 | 3111 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 3112 | ||
| 3113 | buddy = (PurpleBuddy *) node; | |
| 3114 | gc = purple_account_get_connection(buddy->account); | |
| 6729 | 3115 | yd = gc->proto_data; |
| 3116 | id = yd->conf_id; | |
| 3117 | ||
| 3118 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 3119 | g_hash_table_replace(components, g_strdup("room"), | |
| 15884 | 3120 | g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); |
| 6729 | 3121 | g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); |
| 3122 | g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); | |
| 3123 | yahoo_c_join(gc, components); | |
| 3124 | g_hash_table_destroy(components); | |
| 3125 | ||
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3126 | yahoo_c_invite(gc, id, "Join my conference...", buddy->name); |
| 6729 | 3127 | } |
| 3128 | ||
| 15884 | 3129 | static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { |
| 3130 | PurpleBuddy *buddy; | |
| 3131 | PurpleConnection *gc; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3132 | int presence_val = GPOINTER_TO_INT(data); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3133 | |
| 15884 | 3134 | buddy = (PurpleBuddy *) node; |
| 3135 | gc = purple_account_get_connection(buddy->account); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3136 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3137 | yahoo_friend_update_presence(gc, buddy->name, presence_val); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3138 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3139 | |
| 15884 | 3140 | static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
| 3141 | ||
| 3142 | PurpleBuddy *buddy; | |
| 3143 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3144 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3145 | struct yahoo_data *yd; |
| 9283 | 3146 | const char *game; |
| 3147 | char *game2; | |
| 3019 | 3148 | char *t; |
| 3149 | char url[256]; | |
| 9278 | 3150 | YahooFriend *f; |
| 3019 | 3151 | |
| 15884 | 3152 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 3153 | ||
| 3154 | buddy = (PurpleBuddy *) node; | |
| 3155 | gc = purple_account_get_connection(buddy->account); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3156 | yd = (struct yahoo_data *) gc->proto_data; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3157 | |
| 9279 | 3158 | f = yahoo_friend_find(gc, buddy->name); |
| 6784 | 3159 | if (!f) |
| 3160 | return; | |
| 3161 | ||
| 9283 | 3162 | game = yahoo_friend_get_game(f); |
| 3019 | 3163 | if (!game) |
| 3164 | return; | |
| 6784 | 3165 | |
| 9283 | 3166 | t = game2 = g_strdup(strstr(game, "ante?room=")); |
| 3167 | while (*t && *t != '\t') | |
| 3019 | 3168 | t++; |
| 3169 | *t = 0; | |
| 9283 | 3170 | g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); |
| 15884 | 3171 | purple_notify_uri(gc, url); |
| 9283 | 3172 | g_free(game2); |
| 3019 | 3173 | } |
| 4722 | 3174 | |
| 15884 | 3175 | static char *yahoo_status_text(PurpleBuddy *b) |
| 4722 | 3176 | { |
| 9278 | 3177 | YahooFriend *f = NULL; |
| 9283 | 3178 | const char *msg; |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3179 | char *msg2; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
3180 | |
| 9279 | 3181 | f = yahoo_friend_find(b->account->gc, b->name); |
| 6784 | 3182 | if (!f) |
| 3183 | return g_strdup(_("Not on server list")); | |
| 3184 | ||
| 3185 | switch (f->status) { | |
| 3186 | case YAHOO_STATUS_AVAILABLE: | |
| 3187 | return NULL; | |
| 3188 | case YAHOO_STATUS_IDLE: | |
| 3189 | if (f->idle == -1) | |
| 3190 | return g_strdup(yahoo_get_status_string(f->status)); | |
| 3191 | return NULL; | |
| 3192 | case YAHOO_STATUS_CUSTOM: | |
| 9283 | 3193 | if (!(msg = yahoo_friend_get_status_message(f))) |
| 6784 | 3194 | return NULL; |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3195 | msg2 = g_markup_escape_text(msg, strlen(msg)); |
| 15884 | 3196 | purple_util_chrreplace(msg2, '\n', ' '); |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3197 | return msg2; |
| 9224 | 3198 | |
| 6784 | 3199 | default: |
| 3200 | return g_strdup(yahoo_get_status_string(f->status)); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
3201 | } |
| 4722 | 3202 | } |
| 3203 | ||
| 15884 | 3204 | void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 4724 | 3205 | { |
| 9278 | 3206 | YahooFriend *f; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3207 | char *escaped; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3208 | char *status = NULL; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3209 | const char *presence = NULL; |
| 6784 | 3210 | |
| 9279 | 3211 | f = yahoo_friend_find(b->account->gc, b->name); |
| 6784 | 3212 | if (!f) |
|
8591
ae42ad1cd127
[gaim-migrate @ 9342]
Mark Doliner <markdoliner@pidgin.im>
parents:
8589
diff
changeset
|
3213 | status = g_strdup_printf("\n%s", _("Not on server list")); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3214 | else { |
| 6784 | 3215 | switch (f->status) { |
| 3216 | case YAHOO_STATUS_CUSTOM: | |
| 9283 | 3217 | if (!yahoo_friend_get_status_message(f)) |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12945
diff
changeset
|
3218 | return; |
| 9283 | 3219 | status = g_strdup(yahoo_friend_get_status_message(f)); |
| 6784 | 3220 | break; |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3221 | case YAHOO_STATUS_OFFLINE: |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3222 | break; |
| 6784 | 3223 | default: |
| 3224 | status = g_strdup(yahoo_get_status_string(f->status)); | |
| 3225 | break; | |
| 4745 | 3226 | } |
| 6784 | 3227 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3228 | switch (f->presence) { |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3229 | case YAHOO_PRESENCE_ONLINE: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3230 | presence = _("Appear Online"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3231 | break; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3232 | case YAHOO_PRESENCE_PERM_OFFLINE: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3233 | presence = _("Appear Permanently Offline"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3234 | break; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3235 | case YAHOO_PRESENCE_DEFAULT: |
|
12945
69f429d29451
[gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
3236 | break; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3237 | default: |
| 15884 | 3238 | purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3239 | break; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3240 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3241 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3242 | |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3243 | if (status != NULL) { |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3244 | escaped = g_markup_escape_text(status, strlen(status)); |
| 15884 | 3245 | purple_notify_user_info_add_pair(user_info, _("Status"), escaped); |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3246 | g_free(status); |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3247 | g_free(escaped); |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3248 | } |
| 6784 | 3249 | |
|
12945
69f429d29451
[gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
3250 | if (presence != NULL) |
| 15884 | 3251 | purple_notify_user_info_add_pair(user_info, _("Presence"), presence); |
| 4729 | 3252 | } |
| 3253 | ||
| 15884 | 3254 | static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3255 | { |
| 15884 | 3256 | PurpleBuddy *buddy; |
| 3257 | PurpleConnection *gc; | |
| 3258 | ||
| 3259 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | |
| 3260 | ||
| 3261 | buddy = (PurpleBuddy *) node; | |
| 3262 | gc = purple_account_get_connection(buddy->account); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3263 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
3264 | yahoo_add_buddy(gc, buddy, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3265 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3266 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3267 | |
| 15884 | 3268 | static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) |
| 6796 | 3269 | { |
| 15884 | 3270 | PurpleBuddy *buddy; |
| 3271 | PurpleConnection *gc; | |
| 3272 | ||
| 3273 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | |
| 3274 | ||
| 3275 | buddy = (PurpleBuddy *) node; | |
| 3276 | gc = purple_account_get_connection(buddy->account); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3277 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3278 | yahoo_chat_goto(gc, buddy->name); |
| 6796 | 3279 | } |
| 3280 | ||
| 15884 | 3281 | static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3282 | GList *m = NULL; |
| 15884 | 3283 | PurpleMenuAction *act; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3284 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3285 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3286 | if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3287 | if (f->presence != YAHOO_PRESENCE_ONLINE) { |
| 15884 | 3288 | act = purple_menu_action_new(_("Appear Online"), |
| 3289 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3290 | GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), |
| 3291 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3292 | m = g_list_append(m, act); |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3293 | } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { |
| 15884 | 3294 | act = purple_menu_action_new(_("Appear Offline"), |
| 3295 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3296 | GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
| 3297 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3298 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3299 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3300 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3301 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3302 | if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
| 15884 | 3303 | act = purple_menu_action_new(_("Don't Appear Permanently Offline"), |
| 3304 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3305 | GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
| 3306 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3307 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3308 | } else { |
| 15884 | 3309 | act = purple_menu_action_new(_("Appear Permanently Offline"), |
| 3310 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3311 | GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), |
| 3312 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3313 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3314 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3315 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3316 | return m; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3317 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3318 | |
| 15884 | 3319 | static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data) |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3320 | { |
| 15884 | 3321 | PurpleBuddy *b = (PurpleBuddy *)node; |
| 3322 | PurpleConnection *gc = b->account->gc; | |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3323 | |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3324 | yahoo_doodle_initiate(gc, b->name); |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3325 | } |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3326 | |
| 15884 | 3327 | static GList *yahoo_buddy_menu(PurpleBuddy *buddy) |
| 2681 | 3328 | { |
| 3329 | GList *m = NULL; | |
| 15884 | 3330 | PurpleMenuAction *act; |
| 3331 | ||
| 3332 | PurpleConnection *gc = purple_account_get_connection(buddy->account); | |
| 9370 | 3333 | struct yahoo_data *yd = gc->proto_data; |
| 3019 | 3334 | static char buf2[1024]; |
| 9278 | 3335 | YahooFriend *f; |
| 6784 | 3336 | |
| 9279 | 3337 | f = yahoo_friend_find(gc, buddy->name); |
| 6784 | 3338 | |
| 9370 | 3339 | if (!f && !yd->wm) { |
| 15884 | 3340 | act = purple_menu_action_new(_("Add Buddy"), |
| 3341 | PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), | |
| 12919 | 3342 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3343 | m = g_list_append(m, act); |
| 6784 | 3344 | |
| 3345 | return m; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3346 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3347 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3348 | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3349 | if (f && f->status != YAHOO_STATUS_OFFLINE) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3350 | if (!yd->wm) { |
| 15884 | 3351 | act = purple_menu_action_new(_("Join in Chat"), |
| 3352 | PURPLE_CALLBACK(yahoo_chat_goto_menu), | |
| 12919 | 3353 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3354 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3355 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3356 | |
| 15884 | 3357 | act = purple_menu_action_new(_("Initiate Conference"), |
| 3358 | PURPLE_CALLBACK(yahoo_initiate_conference), | |
| 12919 | 3359 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3360 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3361 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3362 | if (yahoo_friend_get_game(f)) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3363 | const char *game = yahoo_friend_get_game(f); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3364 | char *room; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3365 | char *t; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3366 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3367 | if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3368 | while (*room && *room != '\t') /* skip to the tab */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3369 | room++; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3370 | t = room++; /* room as now at the name */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3371 | while (*t != '\n') |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3372 | t++; /* replace the \n with a space */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3373 | *t = ' '; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3374 | g_snprintf(buf2, sizeof buf2, "%s", room); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3375 | |
| 15884 | 3376 | act = purple_menu_action_new(buf2, |
| 3377 | PURPLE_CALLBACK(yahoo_game), | |
| 12919 | 3378 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3379 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3380 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3381 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3382 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3383 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3384 | if (f) { |
| 15884 | 3385 | act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, |
| 12919 | 3386 | build_presence_submenu(f, gc)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3387 | m = g_list_append(m, act); |
| 3019 | 3388 | } |
| 6729 | 3389 | |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3390 | if (f) { |
| 15884 | 3391 | act = purple_menu_action_new(_("Start Doodling"), |
| 3392 | PURPLE_CALLBACK(yahoo_doodle_blist_node), | |
| 12919 | 3393 | NULL, NULL); |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3394 | m = g_list_append(m, act); |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3395 | } |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3396 | |
| 2681 | 3397 | return m; |
| 3398 | } | |
| 3399 | ||
| 15884 | 3400 | static GList *yahoo_blist_node_menu(PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3401 | { |
| 15884 | 3402 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 3403 | return yahoo_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3404 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3405 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3406 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3407 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3408 | |
| 15884 | 3409 | static void yahoo_act_id(PurpleConnection *gc, const char *entry) |
| 2681 | 3410 | { |
| 3411 | struct yahoo_data *yd = gc->proto_data; | |
| 3412 | ||
| 3413 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 3414 | yahoo_packet_hash_str(pkt, 3, entry); |
| 10392 | 3415 | yahoo_packet_send_and_free(pkt, yd); |
| 2681 | 3416 | |
| 15884 | 3417 | purple_connection_set_display_name(gc, entry); |
| 2681 | 3418 | } |
| 3419 | ||
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3420 | static void |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3421 | yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3422 | const gchar *token, size_t len, const gchar *error_message) |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3423 | { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3424 | PurpleConnection *gc = user_data; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3425 | gboolean set_cookie = FALSE; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3426 | char *url; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3427 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3428 | g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3429 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3430 | if (error_message != NULL) |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3431 | purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3432 | else if (len > 0 && token && *token) { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3433 | /* Should we not be hardcoding the rd url? */ |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3434 | url = g_strdup_printf( |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3435 | "http://login.yahoo.com/config/reset_cookies_token?" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3436 | ".token=%s" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3437 | "&.done=http://us.rd.yahoo.com/messenger/client/%%3fhttp://mail.yahoo.com/", |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3438 | token); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3439 | set_cookie = TRUE; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3440 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3441 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3442 | if (!set_cookie) { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3443 | struct yahoo_data *yd = gc->proto_data; |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19716
diff
changeset
|
3444 | purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n"); |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3445 | url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3446 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3447 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3448 | /* Open the mailbox with the parsed url data */ |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3449 | purple_notify_uri(gc, url); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3450 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3451 | g_free(url); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3452 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3453 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3454 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3455 | static void yahoo_show_inbox(PurplePluginAction *action) |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3456 | { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3457 | /* Setup a cookie that can be used by the browser */ |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3458 | /* XXX I have no idea how this will work with Yahoo! Japan. */ |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3459 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3460 | PurpleConnection *gc = action->context; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3461 | struct yahoo_data *yd = gc->proto_data; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3462 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3463 | PurpleUtilFetchUrlData *url_data; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3464 | const char* base_url = "http://login.yahoo.com"; |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3465 | char *request = g_strdup_printf( |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3466 | "POST /config/cookie_token HTTP/1.0\r\n" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3467 | "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3468 | "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\r\n" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3469 | "Host: login.yahoo.com\r\n" |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3470 | "Content-Length: 0\r\n\r\n", |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3471 | yd->cookie_t, yd->cookie_y); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3472 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3473 | url_data = purple_util_fetch_url_request(base_url, FALSE, |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3474 | "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE, |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3475 | yahoo_get_inbox_token_cb, gc); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3476 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3477 | g_free(request); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3478 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3479 | if (url_data == NULL) { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3480 | const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3481 | purple_debug_error("yahoo", |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3482 | "Unable to request mail login token; forwarding to login screen."); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3483 | purple_notify_uri(gc, yahoo_mail_url); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3484 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3485 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3486 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3487 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3488 | |
| 15884 | 3489 | static void yahoo_show_act_id(PurplePluginAction *action) |
| 2681 | 3490 | { |
| 15884 | 3491 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3492 | purple_request_input(gc, NULL, _("Activate which ID?"), NULL, |
| 15884 | 3493 | purple_connection_get_display_name(gc), FALSE, FALSE, NULL, |
|
5493
f30de3b116ea
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
3494 | _("OK"), G_CALLBACK(yahoo_act_id), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
3495 | _("Cancel"), NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
3496 | purple_connection_get_account(gc), NULL, NULL, |
|
19280
75c489043716
Adding hints to yahoo yahoo.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19064
diff
changeset
|
3497 | "account", gc); |
| 2681 | 3498 | } |
| 3499 | ||
| 15884 | 3500 | static void yahoo_show_chat_goto(PurplePluginAction *action) |
| 7878 | 3501 | { |
| 15884 | 3502 | PurpleConnection *gc = (PurpleConnection *) action->context; |
| 3503 | purple_request_input(gc, NULL, _("Join who in chat?"), NULL, | |
| 8697 | 3504 | "", FALSE, FALSE, NULL, |
| 7878 | 3505 | _("OK"), G_CALLBACK(yahoo_chat_goto), |
|
16490
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
3506 | _("Cancel"), NULL, |
|
68c22924d66b
Added account, who, and conversation parameters to the request API calls, and updated all code to match. I can't compile the Perl module, so I'd appreciate it if someone who knows it would verify that this doesn't break Perl.
Evan Schoenberg <evands@pidgin.im>
parents:
16007
diff
changeset
|
3507 | purple_connection_get_account(gc), NULL, NULL, |
|
19280
75c489043716
Adding hints to yahoo yahoo.c
Gabriel Schulhof <nix@go-nix.ca>
parents:
19064
diff
changeset
|
3508 | "chat", gc); |
| 7878 | 3509 | } |
| 3510 | ||
| 15884 | 3511 | static GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { |
| 2681 | 3512 | GList *m = NULL; |
| 15884 | 3513 | PurplePluginAction *act; |
| 3514 | ||
| 3515 | act = purple_plugin_action_new(_("Activate ID..."), | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
3516 | yahoo_show_act_id); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
3517 | m = g_list_append(m, act); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
3518 | |
| 15884 | 3519 | act = purple_plugin_action_new(_("Join User in Chat..."), |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
3520 | yahoo_show_chat_goto); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
3521 | m = g_list_append(m, act); |
| 7878 | 3522 | |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3523 | m = g_list_append(m, NULL); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3524 | act = purple_plugin_action_new(_("Open Inbox"), |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3525 | yahoo_show_inbox); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3526 | m = g_list_append(m, act); |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3527 | |
| 2681 | 3528 | return m; |
| 3529 | } | |
| 3530 | ||
| 15884 | 3531 | static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
| 2681 | 3532 | { |
| 3533 | struct yahoo_data *yd = gc->proto_data; | |
| 3534 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); | |
| 6629 | 3535 | char *msg = yahoo_html_to_codes(what); |
| 7827 | 3536 | char *msg2; |
| 3537 | gboolean utf8 = TRUE; | |
| 15884 | 3538 | PurpleWhiteboard *wb; |
| 9828 | 3539 | int ret = 1; |
| 14320 | 3540 | YahooFriend *f = NULL; |
| 7827 | 3541 | |
| 3542 | msg2 = yahoo_string_encode(gc, msg, &utf8); | |
| 2681 | 3543 | |
| 15884 | 3544 | yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); |
| 14346 | 3545 | if ((f = yahoo_friend_find(gc, who)) && f->protocol) |
| 3546 | yahoo_packet_hash_int(pkt, 241, f->protocol); | |
| 14320 | 3547 | |
| 7827 | 3548 | if (utf8) |
| 10394 | 3549 | yahoo_packet_hash_str(pkt, 97, "1"); |
| 3550 | yahoo_packet_hash_str(pkt, 14, msg2); | |
| 3551 | ||
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3552 | /* |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3553 | * IMVironment. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3554 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3555 | * If this message is to a user who is also Doodling with the local user, |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
3556 | * format the chat packet with the correct IMV information (thanks Yahoo!) |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3557 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3558 | * Otherwise attempt to use the same IMVironment as the remote user, |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3559 | * just so that we don't inadvertantly reset their IMVironment back |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3560 | * to nothing. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3561 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3562 | * If they have no set an IMVironment, then use the default. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3563 | */ |
| 15884 | 3564 | wb = purple_whiteboard_get_session(gc->account, who); |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
3565 | if (wb) |
|
19064
1680699bdbf4
Fix yahoo doodling to work with newer yahoo messenger clients. This breaks doodling with older Pidgin clients (trying to support both looked too painful). Fixes #1445.
Daniel Atallah <datallah@pidgin.im>
parents:
19058
diff
changeset
|
3566 | yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
3567 | else |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3568 | { |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3569 | const char *imv; |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3570 | imv = g_hash_table_lookup(yd->imvironments, who); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3571 | if (imv != NULL) |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3572 | yahoo_packet_hash_str(pkt, 63, imv); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3573 | else |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3574 | yahoo_packet_hash_str(pkt, 63, ";0"); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3575 | } |
| 11608 | 3576 | |
| 10394 | 3577 | yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ |
| 3578 | yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ | |
| 9306 | 3579 | if (!yd->picture_url) |
| 10394 | 3580 | yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ |
| 9306 | 3581 | else |
| 10394 | 3582 | yahoo_packet_hash_str(pkt, 206, "2"); |
| 2681 | 3583 | |
| 9828 | 3584 | /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ |
| 3585 | if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) | |
| 10392 | 3586 | yahoo_packet_send(pkt, yd); |
| 9828 | 3587 | else |
| 3588 | ret = -E2BIG; | |
| 2681 | 3589 | |
| 3590 | yahoo_packet_free(pkt); | |
| 6629 | 3591 | |
| 3592 | g_free(msg); | |
| 7827 | 3593 | g_free(msg2); |
| 6629 | 3594 | |
| 9828 | 3595 | return ret; |
| 2681 | 3596 | } |
| 3597 | ||
| 15884 | 3598 | static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
| 2993 | 3599 | { |
| 3600 | struct yahoo_data *yd = gc->proto_data; | |
| 3019 | 3601 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); |
| 15884 | 3602 | yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
| 3603 | 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", | |
| 10394 | 3604 | 5, who, 1002, "1"); |
| 2993 | 3605 | |
| 10392 | 3606 | yahoo_packet_send_and_free(pkt, yd); |
| 2993 | 3607 | |
| 3001 | 3608 | return 0; |
| 2993 | 3609 | } |
| 3610 | ||
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3611 | static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data) |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3612 | { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3613 | YahooFriend *f = value; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3614 | if (f && f->presence == YAHOO_PRESENCE_ONLINE) |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3615 | f->presence = YAHOO_PRESENCE_DEFAULT; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3616 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3617 | |
| 15884 | 3618 | static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
| 2681 | 3619 | { |
| 15884 | 3620 | PurpleConnection *gc; |
| 3621 | PurplePresence *presence; | |
| 10400 | 3622 | struct yahoo_data *yd; |
| 2681 | 3623 | struct yahoo_packet *pkt; |
| 10400 | 3624 | int old_status; |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3625 | const char *msg = NULL; |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3626 | char *tmp = NULL; |
| 7827 | 3627 | char *conv_msg = NULL; |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
3628 | gboolean utf8 = TRUE; |
| 9984 | 3629 | |
| 15884 | 3630 | if (!purple_status_is_active(status)) |
| 10400 | 3631 | return; |
| 3632 | ||
| 15884 | 3633 | gc = purple_account_get_connection(account); |
| 3634 | presence = purple_status_get_presence(status); | |
| 10400 | 3635 | yd = (struct yahoo_data *)gc->proto_data; |
| 3636 | old_status = yd->current_status; | |
| 9984 | 3637 | |
| 15884 | 3638 | yd->current_status = get_yahoo_status_from_purple_status(status); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3639 | |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3640 | if (yd->current_status == YAHOO_STATUS_CUSTOM) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3641 | { |
| 15884 | 3642 | msg = purple_status_get_attr_string(status, "message"); |
| 3643 | ||
| 3644 | if (purple_status_is_available(status)) { | |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
3645 | tmp = yahoo_string_encode(gc, msg, &utf8); |
| 15884 | 3646 | conv_msg = purple_markup_strip_html(tmp); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3647 | g_free(tmp); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3648 | } else { |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3649 | if ((msg == NULL) || (*msg == '\0')) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3650 | msg = _("Away"); |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
3651 | tmp = yahoo_string_encode(gc, msg, &utf8); |
| 15884 | 3652 | conv_msg = purple_markup_strip_html(tmp); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3653 | g_free(tmp); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3654 | } |
| 2681 | 3655 | } |
| 3656 | ||
| 10373 | 3657 | if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
| 3658 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 3659 | yahoo_packet_hash_str(pkt, 13, "2"); |
| 10392 | 3660 | yahoo_packet_send_and_free(pkt, yd); |
| 10373 | 3661 | |
| 3662 | return; | |
| 3663 | } | |
| 3664 | ||
| 3665 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 3666 | yahoo_packet_hash_int(pkt, 10, yd->current_status); |
| 6847 | 3667 | |
| 9984 | 3668 | if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
3669 | yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3670 | yahoo_packet_hash_str(pkt, 19, conv_msg); |
| 10373 | 3671 | } else { |
| 10394 | 3672 | yahoo_packet_hash_str(pkt, 19, ""); |
| 10373 | 3673 | } |
| 3674 | ||
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3675 | g_free(conv_msg); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3676 | |
| 15884 | 3677 | if (purple_presence_is_idle(presence)) |
| 10394 | 3678 | yahoo_packet_hash_str(pkt, 47, "2"); |
| 15884 | 3679 | else if (!purple_status_is_available(status)) |
| 10394 | 3680 | yahoo_packet_hash_str(pkt, 47, "1"); |
| 2681 | 3681 | |
| 10392 | 3682 | yahoo_packet_send_and_free(pkt, yd); |
| 9984 | 3683 | |
| 10373 | 3684 | if (old_status == YAHOO_STATUS_INVISIBLE) { |
| 3685 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 3686 | yahoo_packet_hash_str(pkt, 13, "1"); |
| 10392 | 3687 | yahoo_packet_send_and_free(pkt, yd); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3688 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3689 | /* Any per-session presence settings are removed */ |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3690 | g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3691 | |
| 10373 | 3692 | } |
| 2681 | 3693 | } |
| 3694 | ||
| 15884 | 3695 | static void yahoo_set_idle(PurpleConnection *gc, int idle) |
| 2681 | 3696 | { |
| 3697 | struct yahoo_data *yd = gc->proto_data; | |
| 3698 | struct yahoo_packet *pkt = NULL; | |
| 8503 | 3699 | char *msg = NULL, *msg2 = NULL; |
| 15884 | 3700 | PurpleStatus *status = NULL; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3701 | |
|
13688
240e5b90adb4
[gaim-migrate @ 16089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13559
diff
changeset
|
3702 | if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
| 2681 | 3703 | yd->current_status = YAHOO_STATUS_IDLE; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3704 | else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
| 15884 | 3705 | status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
| 3706 | yd->current_status = get_yahoo_status_from_purple_status(status); | |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3707 | } |
| 10373 | 3708 | |
| 3709 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | |
| 3710 | ||
| 10394 | 3711 | yahoo_packet_hash_int(pkt, 10, yd->current_status); |
| 10373 | 3712 | if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3713 | const char *tmp; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3714 | if (status == NULL) |
| 15884 | 3715 | status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
| 3716 | tmp = purple_status_get_attr_string(status, "message"); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3717 | if (tmp != NULL) { |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3718 | msg = yahoo_string_encode(gc, tmp, NULL); |
| 15884 | 3719 | msg2 = purple_markup_strip_html(msg); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3720 | yahoo_packet_hash_str(pkt, 19, msg2); |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3721 | } else { |
| 15884 | 3722 | /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3723 | * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */ |
|
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
3724 | yahoo_packet_hash_str(pkt, 19, _("Away")); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
3725 | } |
| 6847 | 3726 | } else { |
| 10394 | 3727 | yahoo_packet_hash_str(pkt, 19, ""); |
| 2681 | 3728 | } |
| 3729 | ||
| 10373 | 3730 | if (idle) |
| 10394 | 3731 | yahoo_packet_hash_str(pkt, 47, "2"); |
| 15884 | 3732 | else if (!purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc)))) |
| 10394 | 3733 | yahoo_packet_hash_str(pkt, 47, "1"); |
| 10373 | 3734 | |
| 10392 | 3735 | yahoo_packet_send_and_free(pkt, yd); |
| 10373 | 3736 | |
| 3737 | g_free(msg); | |
| 3738 | g_free(msg2); | |
| 2681 | 3739 | } |
| 3740 | ||
| 15884 | 3741 | static GList *yahoo_status_types(PurpleAccount *account) |
| 2681 | 3742 | { |
| 15884 | 3743 | PurpleStatusType *type; |
| 9979 | 3744 | GList *types = NULL; |
| 3745 | ||
| 15884 | 3746 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
3747 | NULL, TRUE, TRUE, FALSE, |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3748 | "message", _("Message"), |
| 15884 | 3749 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3750 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3751 | |
| 15884 | 3752 | type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY, |
|
12595
8108c22aa723
[gaim-migrate @ 14925]
Richard Laager <rlaager@pidgin.im>
parents:
12489
diff
changeset
|
3753 | NULL, TRUE, TRUE, FALSE, |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3754 | "message", _("Message"), |
| 15884 | 3755 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3756 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3757 | |
| 15884 | 3758 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3759 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3760 | |
| 15884 | 3761 | type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3762 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3763 | |
| 15884 | 3764 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3765 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3766 | |
| 15884 | 3767 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3768 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3769 | |
| 15884 | 3770 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3771 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3772 | |
| 15884 | 3773 | type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3774 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3775 | |
| 15884 | 3776 | type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3777 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3778 | |
| 15884 | 3779 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3780 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3781 | |
| 15884 | 3782 | type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3783 | types = g_list_append(types, type); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3784 | |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
3785 | |
| 15884 | 3786 | type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); |
| 9979 | 3787 | types = g_list_append(types, type); |
| 3788 | ||
| 15884 | 3789 | type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE); |
|
12658
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
3790 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
3791 | |
| 15884 | 3792 | type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); |
| 15589 | 3793 | types = g_list_append(types, type); |
| 3794 | ||
| 9979 | 3795 | return types; |
| 2681 | 3796 | } |
| 3797 | ||
| 15884 | 3798 | static void yahoo_keepalive(PurpleConnection *gc) |
| 2681 | 3799 | { |
| 3800 | struct yahoo_data *yd = gc->proto_data; | |
| 3801 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0); | |
| 10392 | 3802 | yahoo_packet_send_and_free(pkt, yd); |
| 6729 | 3803 | |
| 3804 | if (!yd->chat_online) | |
| 3805 | return; | |
| 3806 | ||
| 9376 | 3807 | if (yd->wm) { |
| 3808 | ycht_chat_send_keepalive(yd->ycht); | |
| 3809 | return; | |
| 3810 | } | |
| 3811 | ||
| 6729 | 3812 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); |
| 15884 | 3813 | yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); |
| 10394 | 3814 | yahoo_packet_send_and_free(pkt, yd); |
| 2681 | 3815 | } |
| 3816 | ||
| 15884 | 3817 | /* XXX - What's the deal with PurpleGroup *foo? */ |
| 3818 | static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *foo) | |
| 2681 | 3819 | { |
| 3820 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 3821 | struct yahoo_packet *pkt; | |
| 15884 | 3822 | PurpleGroup *g; |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
19411
diff
changeset
|
3823 | const char *group = NULL; |
|
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
19411
diff
changeset
|
3824 | char *group2; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
3825 | YahooFriend *f; |
| 2681 | 3826 | |
| 3827 | if (!yd->logged_in) | |
| 3828 | return; | |
| 3829 | ||
| 15884 | 3830 | if (!yahoo_privacy_check(gc, purple_buddy_get_name(buddy))) |
|
10963
8011e6bc10b5
[gaim-migrate @ 12768]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10944
diff
changeset
|
3831 | return; |
|
8011e6bc10b5
[gaim-migrate @ 12768]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10944
diff
changeset
|
3832 | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
3833 | f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
|
19538
5b71901c8766
Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <datallah@pidgin.im>
parents:
19534
diff
changeset
|
3834 | |
| 6840 | 3835 | if (foo) |
| 3836 | group = foo->name; | |
| 3837 | if (!group) { | |
| 15884 | 3838 | g = purple_buddy_get_group(buddy); |
| 6840 | 3839 | if (g) |
| 3840 | group = g->name; | |
| 3841 | else | |
| 3842 | group = "Buddies"; | |
| 3843 | } | |
| 2681 | 3844 | |
| 7829 | 3845 | group2 = yahoo_string_encode(gc, group, NULL); |
| 2681 | 3846 | pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
|
19330
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3847 | yahoo_packet_hash(pkt, "ssssssssss", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3848 | 14, "", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3849 | 65, group2, |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3850 | 97, "1", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3851 | 1, purple_connection_get_display_name(gc), |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3852 | 302, "319", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3853 | 300, "319", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3854 | 7, buddy->name, |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3855 | 334, "0", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3856 | 301, "319", |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3857 | 303, "319" |
|
a2e7ef0cab90
Make adding buddies work again for yahoo.
Tim Ringenbach <marv@pidgin.im>
parents:
19329
diff
changeset
|
3858 | ); |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
3859 | if (f && f->protocol) |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
3860 | yahoo_packet_hash_int(pkt, 241, f->protocol); |
| 10392 | 3861 | yahoo_packet_send_and_free(pkt, yd); |
| 7829 | 3862 | g_free(group2); |
| 2681 | 3863 | } |
| 3864 | ||
| 15884 | 3865 | static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 2681 | 3866 | { |
| 3867 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
|
6795
396b24cfeeb6
[gaim-migrate @ 7334]
Herman Bloggs <herman@bluedigits.com>
parents:
6793
diff
changeset
|
3868 | struct yahoo_packet *pkt; |
| 6840 | 3869 | GSList *buddies, *l; |
| 15884 | 3870 | PurpleGroup *g; |
| 6840 | 3871 | gboolean remove = TRUE; |
| 7827 | 3872 | char *cg; |
| 6784 | 3873 | |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3874 | if (!(yahoo_friend_find(gc, buddy->name))) |
| 6784 | 3875 | return; |
| 3876 | ||
| 15884 | 3877 | buddies = purple_find_buddies(purple_connection_get_account(gc), buddy->name); |
| 6840 | 3878 | for (l = buddies; l; l = l->next) { |
| 15884 | 3879 | g = purple_buddy_get_group(l->data); |
| 3880 | if (purple_utf8_strcasecmp(group->name, g->name)) { | |
| 6840 | 3881 | remove = FALSE; |
| 3882 | break; | |
| 3883 | } | |
| 3884 | } | |
| 3885 | ||
| 3886 | g_slist_free(buddies); | |
| 3887 | ||
| 3888 | if (remove) | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
3889 | g_hash_table_remove(yd->friends, buddy->name); |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
3890 | |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
3891 | cg = yahoo_string_encode(gc, group->name, NULL); |
|
6795
396b24cfeeb6
[gaim-migrate @ 7334]
Herman Bloggs <herman@bluedigits.com>
parents:
6793
diff
changeset
|
3892 | pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
| 15884 | 3893 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
| 10394 | 3894 | 7, buddy->name, 65, cg); |
| 10392 | 3895 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 3896 | g_free(cg); |
| 2681 | 3897 | } |
| 3898 | ||
| 15884 | 3899 | static void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
| 6760 | 3900 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 3901 | struct yahoo_packet *pkt; | |
| 3902 | ||
| 3903 | if (!yd->logged_in) | |
| 3904 | return; | |
| 8057 | 3905 | /* It seems to work better without this */ |
| 3906 | ||
| 8113 | 3907 | /* if (gc->account->perm_deny != 4) |
| 3908 | return; */ | |
| 3909 | ||
| 3910 | if (!who || who[0] == '\0') | |
| 3911 | return; | |
| 3912 | ||
| 6760 | 3913 | pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
| 15884 | 3914 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
| 10394 | 3915 | 7, who, 13, "1"); |
| 10392 | 3916 | yahoo_packet_send_and_free(pkt, yd); |
| 6760 | 3917 | } |
| 3918 | ||
| 15884 | 3919 | static void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
| 6760 | 3920 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 3921 | struct yahoo_packet *pkt; | |
| 3922 | ||
| 3923 | if (!yd->logged_in) | |
| 3924 | return; | |
| 3925 | ||
| 3926 | if (!who || who[0] == '\0') | |
| 3927 | return; | |
| 3928 | ||
| 3929 | pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | |
| 15884 | 3930 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); |
| 10392 | 3931 | yahoo_packet_send_and_free(pkt, yd); |
| 6760 | 3932 | } |
| 3933 | ||
| 15884 | 3934 | static void yahoo_set_permit_deny(PurpleConnection *gc) { |
| 3935 | PurpleAccount *acct; | |
| 6760 | 3936 | GSList *deny; |
| 3937 | ||
| 3938 | acct = gc->account; | |
| 3939 | ||
| 3940 | switch (acct->perm_deny) { | |
| 10105 | 3941 | /* privacy 1 */ |
| 15884 | 3942 | case PURPLE_PRIVACY_ALLOW_ALL: |
| 10143 | 3943 | for (deny = acct->deny;deny;deny = deny->next) |
| 3944 | yahoo_rem_deny(gc, deny->data); | |
| 3945 | break; | |
| 10105 | 3946 | /* privacy 3 */ |
| 15884 | 3947 | case PURPLE_PRIVACY_ALLOW_USERS: |
| 6760 | 3948 | for (deny = acct->deny;deny;deny = deny->next) |
| 3949 | yahoo_rem_deny(gc, deny->data); | |
| 3950 | break; | |
| 10105 | 3951 | /* privacy 5 */ |
| 15884 | 3952 | case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
| 10105 | 3953 | /* privacy 4 */ |
| 15884 | 3954 | case PURPLE_PRIVACY_DENY_USERS: |
| 6760 | 3955 | for (deny = acct->deny;deny;deny = deny->next) |
| 3956 | yahoo_add_deny(gc, deny->data); | |
| 3957 | break; | |
| 10105 | 3958 | /* privacy 2 */ |
| 15884 | 3959 | case PURPLE_PRIVACY_DENY_ALL: |
| 6760 | 3960 | default: |
| 3961 | break; | |
| 3962 | } | |
| 3963 | } | |
| 3964 | ||
| 15884 | 3965 | static gboolean yahoo_unload_plugin(PurplePlugin *plugin) |
| 6513 | 3966 | { |
| 3967 | yahoo_dest_colorht(); | |
| 11033 | 3968 | |
| 6513 | 3969 | return TRUE; |
| 3970 | } | |
| 3971 | ||
| 15884 | 3972 | static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
| 6793 | 3973 | const char *old_group, const char *new_group) |
| 3974 | { | |
| 3975 | struct yahoo_data *yd = gc->proto_data; | |
| 3976 | struct yahoo_packet *pkt; | |
| 7827 | 3977 | char *gpn, *gpo; |
| 6793 | 3978 | |
| 3979 | /* Step 0: If they aren't on the server list anyway, | |
| 3980 | * don't bother letting the server know. | |
| 3981 | */ | |
| 9279 | 3982 | if (!yahoo_friend_find(gc, who)) |
| 6793 | 3983 | return; |
| 3984 | ||
| 7827 | 3985 | /* If old and new are the same, we would probably |
| 3986 | * end up deleting the buddy, which would be bad. | |
| 3987 | * This might happen because of the charset conversation. | |
| 3988 | */ | |
| 3989 | gpn = yahoo_string_encode(gc, new_group, NULL); | |
| 3990 | gpo = yahoo_string_encode(gc, old_group, NULL); | |
| 3991 | if (!strcmp(gpn, gpo)) { | |
| 3992 | g_free(gpn); | |
| 3993 | g_free(gpo); | |
| 3994 | return; | |
| 3995 | } | |
| 3996 | ||
|
19329
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
3997 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, 0); |
|
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
3998 | yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), |
|
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
3999 | 302, "240", 300, "240", 7, who, 224, gpo, 264, gpn, 301, |
|
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
4000 | "240", 303, "240"); |
| 10392 | 4001 | yahoo_packet_send_and_free(pkt, yd); |
| 6793 | 4002 | |
| 7827 | 4003 | g_free(gpn); |
| 4004 | g_free(gpo); | |
| 6793 | 4005 | } |
| 4006 | ||
| 15884 | 4007 | static void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
| 4008 | PurpleGroup *group, GList *moved_buddies) | |
| 6793 | 4009 | { |
| 4010 | struct yahoo_data *yd = gc->proto_data; | |
| 4011 | struct yahoo_packet *pkt; | |
| 7827 | 4012 | char *gpn, *gpo; |
| 4013 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
4014 | gpn = yahoo_string_encode(gc, group->name, NULL); |
|
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
4015 | gpo = yahoo_string_encode(gc, old_name, NULL); |
| 7827 | 4016 | if (!strcmp(gpn, gpo)) { |
| 4017 | g_free(gpn); | |
| 4018 | g_free(gpo); | |
| 4019 | return; | |
| 4020 | } | |
| 6793 | 4021 | |
| 4022 | pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); | |
| 15884 | 4023 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
| 10394 | 4024 | 65, gpo, 67, gpn); |
| 10392 | 4025 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 4026 | g_free(gpn); |
| 4027 | g_free(gpo); | |
| 6793 | 4028 | } |
| 4029 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4030 | /********************************* Commands **********************************/ |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4031 | |
| 15884 | 4032 | static PurpleCmdRet |
| 4033 | yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { | |
| 4034 | PurpleAccount *account = purple_conversation_get_account(c); | |
| 10119 | 4035 | |
| 4036 | if (*args && args[0]) | |
| 15884 | 4037 | return PURPLE_CMD_RET_FAILED; |
| 4038 | ||
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4039 | serv_send_attention(account->gc, c->name, YAHOO_BUZZ); |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4040 | |
| 15884 | 4041 | return PURPLE_CMD_RET_OK; |
| 10119 | 4042 | } |
| 4043 | ||
| 15884 | 4044 | static PurplePlugin *my_protocol = NULL; |
| 4045 | ||
| 4046 | static PurpleCmdRet | |
| 4047 | yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, | |
| 10119 | 4048 | char **args, char **error, void *data) |
| 4049 | { | |
| 4050 | GHashTable *comp; | |
| 15884 | 4051 | PurpleConnection *gc; |
| 10119 | 4052 | struct yahoo_data *yd; |
| 4053 | int id; | |
| 4054 | ||
| 4055 | if (!args || !args[0]) | |
| 15884 | 4056 | return PURPLE_CMD_RET_FAILED; |
| 4057 | ||
| 4058 | gc = purple_conversation_get_gc(conv); | |
| 10119 | 4059 | yd = gc->proto_data; |
| 4060 | id = yd->conf_id; | |
| 15884 | 4061 | purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
| 10119 | 4062 | "Trying to join %s \n", args[0]); |
| 4063 | ||
| 4064 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 4065 | g_hash_table_replace(comp, g_strdup("room"), | |
| 4066 | g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0])))); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
4067 | g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); |
| 10119 | 4068 | |
| 4069 | yahoo_c_join(gc, comp); | |
| 4070 | ||
| 4071 | g_hash_table_destroy(comp); | |
| 15884 | 4072 | return PURPLE_CMD_RET_OK; |
| 10119 | 4073 | } |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4074 | |
| 15884 | 4075 | static PurpleCmdRet |
| 4076 | yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, | |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4077 | char **args, char **error, void *data) |
|
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4078 | { |
| 15884 | 4079 | PurpleAccount *account = purple_conversation_get_account(conv); |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4080 | if (*args && args[0]) |
| 15884 | 4081 | return PURPLE_CMD_RET_FAILED; |
| 4082 | purple_roomlist_show_with_account(account); | |
| 4083 | return PURPLE_CMD_RET_OK; | |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4084 | } |
|
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4085 | |
| 15884 | 4086 | static gboolean yahoo_offline_message(const PurpleBuddy *buddy) |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4087 | { |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4088 | return TRUE; |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4089 | } |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4090 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4091 | gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type) |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4092 | { |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4093 | PurpleConversation *c; |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4094 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4095 | c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4096 | username, gc->account); |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4097 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4098 | g_return_val_if_fail(c != NULL, FALSE); |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4099 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4100 | purple_debug(PURPLE_DEBUG_INFO, "yahoo", |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4101 | "Sending <ding> on account %s to buddy %s.\n", username, c->name); |
|
19674
371069ae12fd
Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19643
diff
changeset
|
4102 | purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "<ding>", PURPLE_MESSAGE_INVISIBLE); |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4103 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4104 | return TRUE; |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4105 | } |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4106 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4107 | GList *yahoo_attention_types(PurpleAccount *account) |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4108 | { |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4109 | PurpleAttentionType *attn; |
|
19643
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4110 | static GList *list = NULL; |
|
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4111 | |
|
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4112 | if (!list) { |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4113 | /* Yahoo only supports one attention command: the 'buzz'. */ |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4114 | /* This is index number YAHOO_BUZZ. */ |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4115 | attn = g_new0(PurpleAttentionType, 1); |
|
19918
033cfe5bb467
Capitalize the attention type names.
Richard Laager <rlaager@pidgin.im>
parents:
19913
diff
changeset
|
4116 | attn->name = _("Buzz"); |
|
19908
221dc581b555
Clear up translation ambiguity with the attention API.
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
4117 | attn->incoming_description = _("%s has buzzed you!"); |
|
221dc581b555
Clear up translation ambiguity with the attention API.
Richard Laager <rlaager@pidgin.im>
parents:
19897
diff
changeset
|
4118 | attn->outgoing_description = _("Buzzing %s..."); |
|
19643
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4119 | list = g_list_append(list, attn); |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4120 | } |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4121 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4122 | return list; |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4123 | } |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4124 | |
| 10119 | 4125 | /************************** Plugin Initialization ****************************/ |
| 4126 | static void | |
| 15884 | 4127 | yahoopurple_register_commands(void) |
| 10119 | 4128 | { |
| 15884 | 4129 | purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL, |
| 4130 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 4131 | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 4132 | "prpl-yahoo", yahoopurple_cmd_chat_join, | |
| 10119 | 4133 | _("join <room>: Join a chat room on the Yahoo network"), NULL); |
| 15884 | 4134 | purple_cmd_register("list", "", PURPLE_CMD_P_PRPL, |
| 4135 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | | |
| 4136 | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 4137 | "prpl-yahoo", yahoopurple_cmd_chat_list, | |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4138 | _("list: List rooms on the Yahoo network"), NULL); |
| 15884 | 4139 | purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL, |
| 4140 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 4141 | "prpl-yahoo", yahoopurple_cmd_buzz, | |
|
12318
942b7c089acb
[gaim-migrate @ 14622]
Richard Laager <rlaager@pidgin.im>
parents:
12243
diff
changeset
|
4142 | _("buzz: Buzz a user to get their attention"), NULL); |
| 15884 | 4143 | purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL, |
| 4144 | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY, | |
| 4145 | "prpl-yahoo", yahoo_doodle_purple_cmd_start, | |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4146 | _("doodle: Request user to start a Doodle session"), NULL); |
| 10119 | 4147 | } |
| 4148 | ||
| 15884 | 4149 | static PurpleAccount *find_acct(const char *prpl, const char *acct_id) |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4150 | { |
| 15884 | 4151 | PurpleAccount *acct = NULL; |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4152 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4153 | /* If we have a specific acct, use it */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4154 | if (acct_id) { |
| 15884 | 4155 | acct = purple_accounts_find(acct_id, prpl); |
| 4156 | if (acct && !purple_account_is_connected(acct)) | |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4157 | acct = NULL; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4158 | } else { /* Otherwise find an active account for the protocol */ |
|
18122
9bf9970c1b6a
disapproval of revision '2d8ea56b90971e7851442d96b7d74ecb4f052126'
Richard Laager <rlaager@pidgin.im>
parents:
18121
diff
changeset
|
4159 | GList *l = purple_accounts_get_all(); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4160 | while (l) { |
| 15884 | 4161 | if (!strcmp(prpl, purple_account_get_protocol_id(l->data)) |
| 4162 | && purple_account_is_connected(l->data)) { | |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4163 | acct = l->data; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4164 | break; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4165 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4166 | l = l->next; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4167 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4168 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4169 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4170 | return acct; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4171 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4172 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4173 | /* This may not be the best way to do this, but we find the first key w/o a value |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4174 | * and assume it is the screenname */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4175 | static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data) |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4176 | { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4177 | char **retval = user_data; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4178 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4179 | if (value == NULL && *retval == NULL) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4180 | *retval = key; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4181 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4182 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4183 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4184 | static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params) |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4185 | { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4186 | char *acct_id = g_hash_table_lookup(params, "account"); |
| 15884 | 4187 | PurpleAccount *acct; |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4188 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4189 | if (g_ascii_strcasecmp(proto, "ymsgr")) |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4190 | return FALSE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4191 | |
| 15884 | 4192 | acct = find_acct(purple_plugin_get_id(my_protocol), acct_id); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4193 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4194 | if (!acct) |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4195 | return FALSE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4196 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4197 | /* ymsgr:SendIM?screename&m=The+Message */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4198 | if (!g_ascii_strcasecmp(cmd, "SendIM")) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4199 | char *sname = NULL; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4200 | g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname); |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4201 | if (sname) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4202 | char *message = g_hash_table_lookup(params, "m"); |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4203 | |
| 15884 | 4204 | PurpleConversation *conv = purple_find_conversation_with_account( |
| 4205 | PURPLE_CONV_TYPE_IM, sname, acct); | |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4206 | if (conv == NULL) |
| 15884 | 4207 | conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname); |
| 4208 | purple_conversation_present(conv); | |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4209 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4210 | if (message) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4211 | /* Spaces are encoded as '+' */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4212 | g_strdelimit(message, "+", ' '); |
|
18940
8a9341775495
Don't actually send messages using the protocol handlers (open the window and pre-populate the message, but require the user to actually send the message). Fixes #1961.
Daniel Atallah <datallah@pidgin.im>
parents:
18122
diff
changeset
|
4213 | purple_conv_send_confirm(conv, message); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4214 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4215 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4216 | /*else |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4217 | **If pidgindialogs_im() was in the core, we could use it here. |
| 15884 | 4218 | * It is all purple_request_* based, but I'm not sure it really belongs in the core |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4219 | pidgindialogs_im();*/ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4220 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4221 | return TRUE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4222 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4223 | /* ymsgr:Chat?roomname */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4224 | else if (!g_ascii_strcasecmp(cmd, "Chat")) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4225 | char *rname = NULL; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4226 | g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname); |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4227 | if (rname) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4228 | /* This is somewhat hacky, but the params aren't useful after this command */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4229 | g_hash_table_insert(params, g_strdup("room"), g_strdup(rname)); |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4230 | g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat")); |
| 15884 | 4231 | serv_join_chat(purple_account_get_connection(acct), params); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4232 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4233 | /*else |
| 15884 | 4234 | ** Same as above (except that this would have to be re-written using purple_request_*) |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4235 | pidgin_blist_joinchat_show(); */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4236 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4237 | return TRUE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4238 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4239 | /* ymsgr:AddFriend?name */ |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4240 | else if (!g_ascii_strcasecmp(cmd, "AddFriend")) { |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4241 | char *name = NULL; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4242 | g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name); |
| 15884 | 4243 | purple_blist_request_add_buddy(acct, name, NULL, NULL); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4244 | return TRUE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4245 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4246 | |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4247 | return FALSE; |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4248 | } |
|
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4249 | |
| 15884 | 4250 | static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops = |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4251 | { |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4252 | yahoo_doodle_start, |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4253 | yahoo_doodle_end, |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4254 | yahoo_doodle_get_dimensions, |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4255 | NULL, |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11897
diff
changeset
|
4256 | yahoo_doodle_get_brush, |
|
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11897
diff
changeset
|
4257 | yahoo_doodle_set_brush, |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4258 | yahoo_doodle_send_draw_list, |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4259 | yahoo_doodle_clear, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4260 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4261 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4262 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4263 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4264 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4265 | NULL |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4266 | }; |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4267 | |
| 15884 | 4268 | static PurplePluginProtocolInfo prpl_info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4269 | { |
| 9308 | 4270 | OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC, |
| 6729 | 4271 | NULL, /* user_splits */ |
| 4272 | NULL, /* protocol_options */ | |
| 15884 | 4273 | {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND}, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4274 | yahoo_list_icon, |
| 15524 | 4275 | yahoo_list_emblem, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4276 | yahoo_status_text, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4277 | yahoo_tooltip_text, |
| 9979 | 4278 | yahoo_status_types, |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
4279 | yahoo_blist_node_menu, |
| 6729 | 4280 | yahoo_c_info, |
| 9768 | 4281 | yahoo_c_info_defaults, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4282 | yahoo_login, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4283 | yahoo_close, |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4284 | yahoo_send_im, |
| 6729 | 4285 | NULL, /* set info */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4286 | yahoo_send_typing, |
| 6514 | 4287 | yahoo_get_info, |
| 9984 | 4288 | yahoo_set_status, |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4289 | yahoo_set_idle, |
| 6729 | 4290 | NULL, /* change_passwd*/ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4291 | yahoo_add_buddy, |
| 6729 | 4292 | NULL, /* add_buddies */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4293 | yahoo_remove_buddy, |
| 6729 | 4294 | NULL, /*remove_buddies */ |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4295 | yahoo_add_permit, |
| 6760 | 4296 | yahoo_add_deny, |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4297 | yahoo_rem_permit, |
| 6760 | 4298 | yahoo_rem_deny, |
| 4299 | yahoo_set_permit_deny, | |
| 6729 | 4300 | yahoo_c_join, |
|
8562
7e73676d1772
[gaim-migrate @ 9306]
Christopher O'Brien <siege@pidgin.im>
parents:
8503
diff
changeset
|
4301 | NULL, /* reject chat invite */ |
|
9917
2fbb3c9fab2b
[gaim-migrate @ 10809]
Daniel Atallah <datallah@pidgin.im>
parents:
9888
diff
changeset
|
4302 | yahoo_get_chat_name, |
| 6729 | 4303 | yahoo_c_invite, |
| 4304 | yahoo_c_leave, | |
| 4305 | NULL, /* chat whisper */ | |
| 4306 | yahoo_c_send, | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4307 | yahoo_keepalive, |
| 6729 | 4308 | NULL, /* register_user */ |
| 4309 | NULL, /* get_cb_info */ | |
| 4310 | NULL, /* get_cb_away */ | |
|
19058
9facc10e1c01
Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents:
19053
diff
changeset
|
4311 | yahoo_update_alias, /* alias_buddy */ |
| 6793 | 4312 | yahoo_change_buddys_group, |
| 4313 | yahoo_rename_group, | |
| 6729 | 4314 | NULL, /* buddy_free */ |
| 4315 | NULL, /* convo_closed */ | |
| 15884 | 4316 | purple_normalize_nocase, /* normalize */ |
| 9306 | 4317 | yahoo_set_buddy_icon, |
| 15884 | 4318 | NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/ |
| 4319 | NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */ | |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
4320 | NULL, /* set_chat_topic */ |
|
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
4321 | NULL, /* find_blist_chat */ |
| 8113 | 4322 | yahoo_roomlist_get_list, |
| 4323 | yahoo_roomlist_cancel, | |
|
9466
b6425eab60ca
[gaim-migrate @ 10291]
Daniel Atallah <datallah@pidgin.im>
parents:
9410
diff
changeset
|
4324 | yahoo_roomlist_expand_category, |
|
9475
8c8d4ac992a6
[gaim-migrate @ 10300]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
9466
diff
changeset
|
4325 | NULL, /* can_receive_file */ |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4326 | yahoo_send_file, |
|
12143
09f216663302
[gaim-migrate @ 14444]
Evan Schoenberg <evands@pidgin.im>
parents:
12138
diff
changeset
|
4327 | yahoo_new_xfer, |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4328 | yahoo_offline_message, /* offline_message */ |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12595
diff
changeset
|
4329 | &yahoo_whiteboard_prpl_ops, |
| 15185 | 4330 | NULL, /* send_raw */ |
| 4331 | NULL, /* roomlist_room_serialize */ | |
|
19893
33446dac7ca0
Fixed merge errors stemming from the fact that the main branch and my branch both added something to the prpl struct
Andreas Monitzer <am@adiumx.com>
parents:
19643
diff
changeset
|
4332 | NULL, /* unregister_user */ |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4333 | |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4334 | yahoo_send_attention, |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4335 | yahoo_attention_types, |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4336 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4337 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4338 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4339 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4340 | |
| 15884 | 4341 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4342 | { |
| 15884 | 4343 | PURPLE_PLUGIN_MAGIC, |
| 4344 | PURPLE_MAJOR_VERSION, | |
| 4345 | PURPLE_MINOR_VERSION, | |
| 4346 | PURPLE_PLUGIN_PROTOCOL, /**< type */ | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4347 | NULL, /**< ui_requirement */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4348 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4349 | NULL, /**< dependencies */ |
| 15884 | 4350 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4351 | "prpl-yahoo", /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4352 | "Yahoo", /**< name */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4353 | VERSION, /**< version */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4354 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4355 | N_("Yahoo Protocol Plugin"), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4356 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4357 | N_("Yahoo Protocol Plugin"), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4358 | NULL, /**< author */ |
| 15884 | 4359 | PURPLE_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4360 | NULL, /**< load */ |
| 6513 | 4361 | yahoo_unload_plugin, /**< unload */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4362 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4363 | NULL, /**< ui_info */ |
| 8993 | 4364 | &prpl_info, /**< extra_info */ |
| 4365 | NULL, | |
|
16746
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4366 | yahoo_actions, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4367 | |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4368 | /* padding */ |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4369 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4370 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4371 | NULL, |
|
72faf41c3c4f
And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents:
16606
diff
changeset
|
4372 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4373 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4374 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4375 | static void |
| 15884 | 4376 | init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4377 | { |
| 15884 | 4378 | PurpleAccountOption *option; |
| 4379 | ||
| 4380 | option = purple_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE); | |
| 9164 | 4381 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4382 | ||
| 15884 | 4383 | option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST); |
| 7827 | 4384 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4385 | ||
| 15884 | 4386 | option = purple_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST); |
| 9164 | 4387 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4388 | ||
| 15884 | 4389 | option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT); |
| 7827 | 4390 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 7651 | 4391 | |
| 15884 | 4392 | option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST); |
| 7651 | 4393 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4394 | ||
| 15884 | 4395 | option = purple_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST); |
| 9164 | 4396 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4397 | ||
| 15884 | 4398 | option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT); |
| 7651 | 4399 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4400 | ||
| 15884 | 4401 | option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11033
diff
changeset
|
4402 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
12999
7479d16384c0
[gaim-migrate @ 15352]
Daniel Atallah <datallah@pidgin.im>
parents:
12994
diff
changeset
|
4403 | |
| 15884 | 4404 | option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE); |
|
12999
7479d16384c0
[gaim-migrate @ 15352]
Daniel Atallah <datallah@pidgin.im>
parents:
12994
diff
changeset
|
4405 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
7479d16384c0
[gaim-migrate @ 15352]
Daniel Atallah <datallah@pidgin.im>
parents:
12994
diff
changeset
|
4406 | |
| 15884 | 4407 | option = purple_account_option_string_new(_("Encoding"), "local_charset", "ISO-8859-1"); |
| 14347 | 4408 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4409 | ||
| 4410 | ||
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11033
diff
changeset
|
4411 | #if 0 |
| 15884 | 4412 | option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL); |
| 8113 | 4413 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
|
11043
763427cecd21
[gaim-migrate @ 12957]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11033
diff
changeset
|
4414 | |
| 15884 | 4415 | option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST); |
| 9376 | 4416 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4417 | ||
| 15884 | 4418 | option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT); |
| 9376 | 4419 | prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 4420 | #endif | |
| 4421 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4422 | my_protocol = plugin; |
| 15884 | 4423 | yahoopurple_register_commands(); |
| 6513 | 4424 | yahoo_init_colorht(); |
|
15685
483b223d0b60
uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <datallah@pidgin.im>
parents:
15589
diff
changeset
|
4425 | |
| 15884 | 4426 | purple_signal_connect(purple_get_core(), "uri-handler", plugin, |
| 4427 | PURPLE_CALLBACK(yahoo_uri_handler), NULL); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4428 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
4429 | |
| 15884 | 4430 | PURPLE_INIT_PLUGIN(yahoo, init_plugin, info); |