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