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