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