Sun, 12 Jul 2009 05:43:38 +0000
merge of '7d8b32345d10dc76edfbf45d76eecf58f73bc85f'
and 'f25b6a565494213315490ef079a2aa0c77d49e3b'
| 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" |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
33 | #include "network.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
34 | #include "notify.h" |
| 6760 | 35 | #include "privacy.h" |
| 2681 | 36 | #include "prpl.h" |
| 37 | #include "proxy.h" | |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
38 | #include "request.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
39 | #include "server.h" |
|
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
40 | #include "util.h" |
| 9943 | 41 | #include "version.h" |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
42 | #include "xmlnode.h" |
|
5872
754c63f29b77
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5685
diff
changeset
|
43 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
44 | #include "libymsg.h" |
| 6729 | 45 | #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
|
46 | #include "yahoo_aliases.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 | |
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
58 | /* One hour */ |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
59 | #define PING_TIMEOUT 3600 |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
60 | |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
61 | /* One minute */ |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
62 | #define KEEPALIVE_TIMEOUT 60 |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
63 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
64 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 15884 | 65 | static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
66 | #endif /* TRY_WEBMESSENGER_LOGIN */ |
| 9306 | 67 | |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
68 | static gboolean yahoo_is_japan(PurpleAccount *account) |
|
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
69 | { |
|
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
70 | return purple_strequal(purple_account_get_protocol_id(account), "prpl-yahoojp"); |
|
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
71 | } |
|
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
72 | |
| 15884 | 73 | static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f) |
| 6784 | 74 | { |
| 9983 | 75 | char *status = NULL; |
| 6840 | 76 | |
| 15884 | 77 | if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name)) |
| 6784 | 78 | return; |
| 79 | ||
| 9983 | 80 | switch (f->status) { |
|
27393
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
81 | case YAHOO_STATUS_OFFLINE: |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
82 | status = YAHOO_STATUS_TYPE_OFFLINE; |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
83 | break; |
| 9983 | 84 | case YAHOO_STATUS_AVAILABLE: |
| 10373 | 85 | status = YAHOO_STATUS_TYPE_AVAILABLE; |
| 9983 | 86 | break; |
| 87 | case YAHOO_STATUS_BRB: | |
| 10373 | 88 | status = YAHOO_STATUS_TYPE_BRB; |
| 9983 | 89 | break; |
| 90 | case YAHOO_STATUS_BUSY: | |
| 10373 | 91 | status = YAHOO_STATUS_TYPE_BUSY; |
| 9983 | 92 | break; |
| 93 | case YAHOO_STATUS_NOTATHOME: | |
| 10373 | 94 | status = YAHOO_STATUS_TYPE_NOTATHOME; |
| 9983 | 95 | break; |
| 96 | case YAHOO_STATUS_NOTATDESK: | |
| 10373 | 97 | status = YAHOO_STATUS_TYPE_NOTATDESK; |
| 9983 | 98 | break; |
| 99 | case YAHOO_STATUS_NOTINOFFICE: | |
| 10373 | 100 | status = YAHOO_STATUS_TYPE_NOTINOFFICE; |
| 9983 | 101 | break; |
| 102 | case YAHOO_STATUS_ONPHONE: | |
| 10373 | 103 | status = YAHOO_STATUS_TYPE_ONPHONE; |
| 9983 | 104 | break; |
| 105 | case YAHOO_STATUS_ONVACATION: | |
| 10373 | 106 | status = YAHOO_STATUS_TYPE_ONVACATION; |
| 9983 | 107 | break; |
| 108 | case YAHOO_STATUS_OUTTOLUNCH: | |
| 10373 | 109 | status = YAHOO_STATUS_TYPE_OUTTOLUNCH; |
| 9983 | 110 | break; |
| 111 | case YAHOO_STATUS_STEPPEDOUT: | |
| 10373 | 112 | status = YAHOO_STATUS_TYPE_STEPPEDOUT; |
| 9983 | 113 | break; |
| 114 | case YAHOO_STATUS_INVISIBLE: /* this should never happen? */ | |
| 10373 | 115 | status = YAHOO_STATUS_TYPE_INVISIBLE; |
| 9983 | 116 | break; |
| 117 | case YAHOO_STATUS_CUSTOM: | |
|
13688
240e5b90adb4
[gaim-migrate @ 16089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13559
diff
changeset
|
118 | case YAHOO_STATUS_IDLE: |
| 9983 | 119 | if (!f->away) |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
120 | status = YAHOO_STATUS_TYPE_AVAILABLE; |
| 9983 | 121 | else |
| 10373 | 122 | status = YAHOO_STATUS_TYPE_AWAY; |
| 9983 | 123 | break; |
| 124 | default: | |
| 15884 | 125 | purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status); |
| 9983 | 126 | break; |
| 127 | } | |
| 128 | ||
| 129 | if (status) { | |
| 130 | if (f->status == YAHOO_STATUS_CUSTOM) | |
| 15884 | 131 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message", |
| 9983 | 132 | yahoo_friend_get_status_message(f), NULL); |
| 133 | else | |
| 15884 | 134 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL); |
| 9983 | 135 | } |
| 136 | ||
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
137 | if (f->idle != 0) |
| 15884 | 138 | 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
|
139 | else |
| 15884 | 140 | purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0); |
| 15589 | 141 | |
| 142 | if (f->sms) | |
| 15884 | 143 | purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL); |
| 15589 | 144 | else |
| 15884 | 145 | purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE); |
| 6784 | 146 | } |
| 147 | ||
| 15884 | 148 | static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 149 | { |
| 15884 | 150 | PurpleAccount *account = purple_connection_get_account(gc); |
| 2681 | 151 | GSList *l = pkt->hash; |
| 9278 | 152 | YahooFriend *f = NULL; |
| 2681 | 153 | 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
|
154 | 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
|
155 | char *message = NULL; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
156 | char *msn_name = NULL; |
| 6784 | 157 | |
| 7892 | 158 | if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) { |
|
20658
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19918
diff
changeset
|
159 | 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
|
160 | purple_account_set_password(account, NULL); |
| 21279 | 161 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
162 | _("You have signed on from another location")); |
| 7892 | 163 | return; |
| 164 | } | |
| 6686 | 165 | |
| 2681 | 166 | while (l) { |
| 167 | struct yahoo_pair *pair = l->data; | |
| 168 | ||
| 169 | switch (pair->key) { | |
| 170 | case 0: /* we won't actually do anything with this */ | |
|
27247
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
171 | case 1: /* we won't actually do anything with this */ |
| 2681 | 172 | break; |
| 173 | case 8: /* how many online buddies we have */ | |
| 174 | break; | |
| 175 | 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
|
176 | /* 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
|
177 | 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
|
178 | 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
|
179 | 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
|
180 | 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
|
181 | 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
|
182 | } |
|
30cf0d072270
Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <datallah@pidgin.im>
parents:
19573
diff
changeset
|
183 | 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
|
184 | 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
|
185 | if (pair->value && g_utf8_validate(pair->value, -1, NULL)) { |
|
27392
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
186 | GSList *tmplist; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
187 | int protocol = 0; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
188 | |
|
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
|
189 | name = pair->value; |
|
27392
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
190 | |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
191 | /* Look ahead to see if we have the protocol info about the buddy */ |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
192 | for (tmplist = l->next; tmplist; tmplist = tmplist->next) { |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
193 | struct yahoo_pair *p = tmplist->data; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
194 | if (p->key == 7) |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
195 | break; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
196 | if (p->key == 241) { |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
197 | if(strtol(p->value, NULL, 10) == 2) { |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
198 | g_free(msn_name); |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
199 | msn_name = g_strconcat("msn/", name, NULL); |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
200 | name = msn_name; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
201 | protocol = 2; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
202 | } |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
203 | break; |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
204 | } |
|
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
205 | } |
| 9886 | 206 | f = yahoo_friend_find_or_new(gc, name); |
|
27392
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
207 | f->protocol = protocol; |
| 9888 | 208 | } |
| 2681 | 209 | break; |
| 210 | case 10: /* state */ | |
| 6784 | 211 | if (!f) |
| 212 | break; | |
| 213 | ||
| 214 | f->status = strtol(pair->value, NULL, 10); | |
| 215 | if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT)) | |
| 216 | f->away = 1; | |
| 217 | else | |
| 218 | f->away = 0; | |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
219 | |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
220 | if (f->status == YAHOO_STATUS_IDLE) { |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
221 | /* 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
|
222 | if (f->idle == 0) |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
223 | f->idle = time(NULL); |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
224 | } else |
| 6804 | 225 | f->idle = 0; |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
226 | |
| 9283 | 227 | if (f->status != YAHOO_STATUS_CUSTOM) |
| 228 | yahoo_friend_set_status_message(f, NULL); | |
| 6847 | 229 | |
| 230 | f->sms = 0; | |
| 2681 | 231 | break; |
| 232 | case 19: /* custom message */ | |
| 9283 | 233 | 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
|
234 | message = pair->value; |
| 2681 | 235 | break; |
| 6686 | 236 | case 11: /* this is the buddy's session id */ |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
237 | if (f) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
238 | f->session_id = strtol(pair->value, NULL, 10); |
| 2681 | 239 | break; |
| 240 | case 17: /* in chat? */ | |
| 241 | break; | |
| 6784 | 242 | case 47: /* is custom status away or not? 2=idle*/ |
| 243 | if (!f) | |
| 244 | break; | |
| 8441 | 245 | |
| 246 | /* I have no idea what it means when this is | |
| 247 | * set when someone's available, but it doesn't | |
| 248 | * mean idle. */ | |
| 249 | if (f->status == YAHOO_STATUS_AVAILABLE) | |
| 250 | break; | |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
251 | |
| 6784 | 252 | f->away = strtol(pair->value, NULL, 10); |
|
10141
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
253 | if (f->away == 2) { |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
254 | /* 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
|
255 | if (f->idle == 0) |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
256 | f->idle = time(NULL); |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
257 | } |
|
3db22fc14161
[gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents:
10126
diff
changeset
|
258 | |
| 6686 | 259 | break; |
| 6784 | 260 | case 138: /* either we're not idle, or we are but won't say how long */ |
| 261 | if (!f) | |
| 262 | break; | |
| 263 | ||
| 264 | if (f->idle) | |
| 265 | f->idle = -1; | |
| 266 | break; | |
| 267 | case 137: /* usually idle time in seconds, sometimes login time */ | |
| 268 | if (!f) | |
| 269 | break; | |
| 270 | ||
| 271 | if (f->status != YAHOO_STATUS_AVAILABLE) | |
| 272 | f->idle = time(NULL) - strtol(pair->value, NULL, 10); | |
| 6686 | 273 | break; |
| 274 | case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */ | |
| 6784 | 275 | if (strtol(pair->value, NULL, 10) == 0) { |
| 276 | if (f) | |
| 277 | f->status = YAHOO_STATUS_OFFLINE; | |
| 15589 | 278 | if (name) { |
| 15884 | 279 | purple_prpl_got_user_status(account, name, "offline", NULL); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
280 | purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE); |
| 15589 | 281 | } |
|
2807
fe1ea0453890
[gaim-migrate @ 2820]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2805
diff
changeset
|
282 | break; |
|
2805
31c7645db097
[gaim-migrate @ 2818]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2795
diff
changeset
|
283 | } |
| 6784 | 284 | break; |
| 285 | case 60: /* SMS */ | |
| 286 | if (f) { | |
| 287 | f->sms = strtol(pair->value, NULL, 10); | |
| 288 | yahoo_update_status(gc, name, f); | |
|
2771
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
289 | } |
|
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
290 | break; |
| 9292 | 291 | case 197: /* Avatars */ |
| 9277 | 292 | { |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
293 | guchar *decoded; |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
294 | char *tmp; |
|
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
295 | gsize len; |
| 9277 | 296 | |
| 297 | if (pair->value) { | |
| 15884 | 298 | decoded = purple_base64_decode(pair->value, &len); |
| 9277 | 299 | if (len) { |
| 15884 | 300 | tmp = purple_str_binary_to_ascii(decoded, len); |
| 301 | purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp); | |
| 9277 | 302 | g_free(tmp); |
| 303 | } | |
| 304 | g_free(decoded); | |
| 305 | } | |
| 306 | break; | |
| 307 | } | |
| 9292 | 308 | case 192: /* Pictures, aka Buddy Icons, checksum */ |
| 309 | { | |
|
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
|
310 | /* 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
|
311 | * FIXME: fix up the strtol() stuff if possible. */ |
| 9292 | 312 | 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
|
313 | const char *locksum = NULL; |
| 15884 | 314 | PurpleBuddy *b; |
| 9292 | 315 | |
| 316 | if (!name) | |
| 317 | break; | |
| 318 | ||
| 15884 | 319 | b = purple_find_buddy(gc->account, name); |
| 9325 | 320 | |
| 9292 | 321 | if (!cksum || (cksum == -1)) { |
| 9325 | 322 | if (f) |
| 323 | 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
|
324 | purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL); |
| 9292 | 325 | break; |
| 326 | } | |
| 327 | ||
| 328 | if (!f) | |
| 329 | break; | |
| 9325 | 330 | |
| 9292 | 331 | 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
|
332 | if (b) { |
|
7d28dd13c4db
Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents:
17044
diff
changeset
|
333 | 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
|
334 | 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
|
335 | 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
|
336 | } |
| 9292 | 337 | |
| 338 | break; | |
| 339 | } | |
| 2979 | 340 | case 16: /* Custom error message */ |
| 7827 | 341 | { |
| 342 | char *tmp = yahoo_string_decode(gc, pair->value, TRUE); | |
| 15884 | 343 | purple_notify_error(gc, NULL, tmp, NULL); |
| 7827 | 344 | g_free(tmp); |
| 345 | } | |
| 2951 | 346 | break; |
|
19053
b667a7fdaa81
Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@pidgin.im>
parents:
19038
diff
changeset
|
347 | 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
|
348 | 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
|
349 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
350 | case 244: /* client version number. Yahoo Client Detection */ |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
351 | if(f && strtol(pair->value, NULL, 10)) |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
352 | f->version_id = strtol(pair->value, NULL, 10); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
353 | break; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
354 | case 241: /* protocol buddy belongs to */ |
|
27392
6f8b494ffe86
Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27391
diff
changeset
|
355 | break; /* We process this when get '7' */ |
| 2681 | 356 | default: |
|
22811
2e0dca7ea23e
I don't consider this an error.
Mark Doliner <markdoliner@pidgin.im>
parents:
22562
diff
changeset
|
357 | purple_debug_warning("yahoo", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
358 | "Unknown status key %d\n", pair->key); |
| 2681 | 359 | break; |
| 360 | } | |
| 361 | ||
| 362 | l = l->next; | |
| 363 | } | |
| 10553 | 364 | |
|
27393
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
365 | if (f) { |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
366 | if (pkt->service == YAHOO_SERVICE_LOGOFF) |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
367 | f->status = YAHOO_STATUS_OFFLINE; |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
368 | if (message) |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
369 | yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode)); |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
370 | |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
371 | if (name) /* update the last buddy */ |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
372 | yahoo_update_status(gc, name, f); |
|
273326282c26
Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27392
diff
changeset
|
373 | } |
|
27390
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
374 | g_free(msn_name); |
| 2681 | 375 | } |
| 376 | ||
| 15884 | 377 | static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group) |
| 6820 | 378 | { |
| 15884 | 379 | PurpleBuddy *b; |
| 380 | PurpleGroup *g; | |
| 6820 | 381 | GSList *list, *i; |
| 382 | gboolean onlist = 0; | |
| 383 | char *oname = NULL; | |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
384 | char **oname_p = &oname; |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
385 | GSList **list_p = &list; |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
386 | |
| 15884 | 387 | if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p)) |
| 388 | list = purple_find_buddies(account, name); | |
| 6820 | 389 | else |
| 390 | g_hash_table_steal(ht, name); | |
| 391 | ||
| 392 | for (i = list; i; i = i->next) { | |
| 393 | b = i->data; | |
| 15884 | 394 | g = purple_buddy_get_group(b); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
395 | if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) { |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
396 | purple_debug_misc("yahoo", |
| 6820 | 397 | "Oh good, %s is in the right group (%s).\n", name, group); |
| 398 | list = g_slist_delete_link(list, i); | |
| 399 | onlist = 1; | |
| 400 | break; | |
| 401 | } | |
| 402 | } | |
| 403 | ||
| 404 | if (!onlist) { | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
405 | purple_debug_misc("yahoo", |
| 6820 | 406 | "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group); |
| 15884 | 407 | if (!(g = purple_find_group(group))) { |
| 408 | g = purple_group_new(group); | |
| 409 | purple_blist_add_group(g, NULL); | |
| 6820 | 410 | } |
| 15884 | 411 | b = purple_buddy_new(account, name, NULL); |
| 412 | purple_blist_add_buddy(b, NULL, g, NULL); | |
| 6820 | 413 | } |
| 414 | ||
| 415 | if (list) { | |
| 416 | if (!oname) | |
| 15884 | 417 | oname = g_strdup(purple_normalize(account, name)); |
| 6820 | 418 | g_hash_table_insert(ht, oname, list); |
| 419 | } else if (oname) | |
| 420 | g_free(oname); | |
| 421 | } | |
| 422 | ||
| 423 | static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data) | |
| 424 | { | |
| 425 | char *name = key; | |
| 426 | GSList *list = value, *i; | |
| 15884 | 427 | PurpleBuddy *b; |
| 428 | PurpleGroup *g; | |
| 6820 | 429 | |
| 430 | for (i = list; i; i = i->next) { | |
| 431 | b = i->data; | |
| 15884 | 432 | g = purple_buddy_get_group(b); |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
433 | purple_debug_misc("yahoo", "Deleting Buddy %s from group %s.\n", name, |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
434 | purple_group_get_name(g)); |
| 15884 | 435 | purple_blist_remove_buddy(b); |
| 6820 | 436 | } |
| 437 | } | |
| 438 | ||
| 7651 | 439 | static char *_getcookie(char *rawcookie) |
| 440 | { | |
| 441 | char *cookie = NULL; | |
| 442 | char *tmpcookie; | |
| 443 | char *cookieend; | |
| 444 | ||
| 445 | if (strlen(rawcookie) < 2) | |
| 446 | return NULL; | |
| 447 | tmpcookie = g_strdup(rawcookie+2); | |
| 448 | cookieend = strchr(tmpcookie, ';'); | |
| 449 | ||
| 450 | if (cookieend) | |
| 451 | *cookieend = '\0'; | |
| 452 | ||
| 453 | cookie = g_strdup(tmpcookie); | |
| 454 | g_free(tmpcookie); | |
| 455 | ||
| 456 | return cookie; | |
| 457 | } | |
| 458 | ||
| 459 | static void yahoo_process_cookie(struct yahoo_data *yd, char *c) | |
| 460 | { | |
| 461 | if (c[0] == 'Y') { | |
|
22201
434114a12ae4
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21918
diff
changeset
|
462 | if (yd->cookie_y) |
|
434114a12ae4
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21918
diff
changeset
|
463 | g_free(yd->cookie_y); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
464 | yd->cookie_y = _getcookie(c); |
| 7651 | 465 | } else if (c[0] == 'T') { |
|
22201
434114a12ae4
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21918
diff
changeset
|
466 | if (yd->cookie_t) |
|
434114a12ae4
Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21918
diff
changeset
|
467 | g_free(yd->cookie_t); |
| 7651 | 468 | 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
|
469 | } else |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
470 | purple_debug_info("yahoo", "Unrecognized cookie '%c'\n", c[0]); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
471 | yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c)); |
| 7651 | 472 | } |
| 473 | ||
| 15884 | 474 | static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 14320 | 475 | { |
| 476 | GSList *l = pkt->hash; | |
| 477 | ||
| 15884 | 478 | PurpleAccount *account = purple_connection_get_account(gc); |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
479 | struct yahoo_data *yd = gc->proto_data; |
| 14320 | 480 | GHashTable *ht; |
| 481 | char *norm_bud = NULL; | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
482 | char *temp = NULL; |
| 14362 | 483 | YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */ |
| 484 | /* But what if you had no friends? */ | |
| 15884 | 485 | PurpleBuddy *b; |
| 486 | PurpleGroup *g; | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
487 | int protocol = 0; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
488 | int stealth = 0; |
| 14362 | 489 | |
| 14320 | 490 | |
| 491 | ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); | |
| 492 | ||
| 493 | while (l) { | |
| 494 | struct yahoo_pair *pair = l->data; | |
| 495 | l = l->next; | |
| 496 | ||
| 497 | 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
|
498 | case 302: |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
499 | /* 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
|
500 | * 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
|
501 | * 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
|
502 | * 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
|
503 | */ |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
504 | if (pair->value && !strcmp(pair->value, "320")) { |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
505 | /* No longer in any group; this indicates the start of the ignore list. */ |
|
22552
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
506 | g_free(yd->current_list15_grp); |
|
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
507 | yd->current_list15_grp = NULL; |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
508 | } |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
509 | |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
510 | break; |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
511 | case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
512 | if(temp != NULL) { |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
513 | if(protocol == 2) |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
514 | norm_bud = g_strconcat("msn/", temp, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
515 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
516 | norm_bud = g_strdup(temp); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
517 | |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
518 | if (yd->current_list15_grp) { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
519 | /* This buddy is in a group */ |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
520 | f = yahoo_friend_find_or_new(gc, norm_bud); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
521 | if (!(b = purple_find_buddy(account, norm_bud))) { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
522 | if (!(g = purple_find_group(yd->current_list15_grp))) { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
523 | g = purple_group_new(yd->current_list15_grp); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
524 | purple_blist_add_group(g, NULL); |
|
27390
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
525 | } |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
526 | b = purple_buddy_new(account, norm_bud, NULL); |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
527 | purple_blist_add_buddy(b, NULL, g, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
528 | } |
|
27390
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
529 | yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp); |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
530 | if(protocol != 0) { |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
531 | f->protocol = protocol; |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
532 | purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol); |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
533 | } |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
534 | if(stealth == 2) |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
535 | f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
536 | |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
537 | /* set p2p status not connected and no p2p packet sent */ |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
538 | if(protocol == 0) { |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
539 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
540 | f->p2p_packet_sent = 0; |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
541 | } else |
|
ef13fccec009
Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27362
diff
changeset
|
542 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
543 | } else { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
544 | /* This buddy is on the ignore list (and therefore in no group) */ |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
545 | purple_debug_info("yahoo", "%s adding %s to the deny list because of the ignore list / no group was found\n",account->username, norm_bud); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
546 | purple_privacy_deny_add(account, norm_bud, 1); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
547 | } |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
548 | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
549 | protocol = 0; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
550 | stealth = 0; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
551 | norm_bud = NULL; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
552 | temp = NULL; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
553 | } |
|
14699
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
554 | break; |
|
f4953b1a192e
[gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents:
14693
diff
changeset
|
555 | case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */ |
| 14320 | 556 | break; |
| 557 | case 65: /* This is the group */ | |
|
22552
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
558 | g_free(yd->current_list15_grp); |
|
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
559 | yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE); |
| 14320 | 560 | break; |
| 561 | case 7: /* buddy's s/n */ | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
562 | temp = g_strdup(purple_normalize(account, pair->value)); |
| 14320 | 563 | break; |
| 14346 | 564 | case 241: /* another protocol user */ |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
565 | protocol = strtol(pair->value, NULL, 10); |
| 14320 | 566 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
567 | case 59: /* somebody told cookies come here too, but im not sure */ |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
568 | yahoo_process_cookie(yd, pair->value); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
569 | 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
|
570 | case 317: /* Stealth Setting */ |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
571 | stealth = strtol(pair->value, NULL, 10); |
|
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
|
572 | break; |
| 14320 | 573 | /* case 242: */ /* this seems related to 241 */ |
| 574 | /* break; */ | |
| 575 | } | |
| 576 | } | |
| 577 | ||
| 578 | g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); | |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
579 | |
|
27247
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
580 | /* Now that we have processed the buddy list, we can say yahoo has connected */ |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
581 | purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account))); |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
582 | purple_connection_set_state(gc, PURPLE_CONNECTED); |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
583 | yd->logged_in = TRUE; |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
584 | if (yd->picture_upload_todo) { |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
585 | yahoo_buddy_icon_upload(gc, yd->picture_upload_todo); |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
586 | yd->picture_upload_todo = NULL; |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
587 | } |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
588 | yahoo_set_status(account, purple_account_get_active_status(account)); |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
589 | purple_debug_info("yahoo","Authentication: Connection established\n"); |
|
06fd277b3355
Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27200
diff
changeset
|
590 | |
| 14320 | 591 | g_hash_table_destroy(ht); |
| 592 | g_free(norm_bud); | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
593 | g_free(temp); |
| 14320 | 594 | } |
| 595 | ||
| 15884 | 596 | static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 597 | { |
| 598 | GSList *l = pkt->hash; | |
| 599 | gboolean export = FALSE; | |
| 6760 | 600 | gboolean got_serv_list = FALSE; |
| 15884 | 601 | PurpleBuddy *b; |
| 602 | PurpleGroup *g; | |
| 9278 | 603 | YahooFriend *f = NULL; |
| 15884 | 604 | PurpleAccount *account = purple_connection_get_account(gc); |
| 6784 | 605 | struct yahoo_data *yd = gc->proto_data; |
| 6820 | 606 | GHashTable *ht; |
| 6784 | 607 | |
| 608 | char **lines; | |
| 609 | char **split; | |
| 610 | char **buddies; | |
| 7823 | 611 | char **tmp, **bud, *norm_bud; |
| 7827 | 612 | char *grp = NULL; |
| 2681 | 613 | |
| 7651 | 614 | if (pkt->id) |
| 615 | yd->session_id = pkt->id; | |
| 616 | ||
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
617 | while (l) { |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
618 | struct yahoo_pair *pair = l->data; |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
619 | l = l->next; |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
620 | |
| 6760 | 621 | switch (pair->key) { |
| 622 | case 87: | |
| 6784 | 623 | if (!yd->tmp_serv_blist) |
| 624 | yd->tmp_serv_blist = g_string_new(pair->value); | |
| 625 | else | |
| 626 | g_string_append(yd->tmp_serv_blist, pair->value); | |
| 6760 | 627 | break; |
| 628 | case 88: | |
| 6784 | 629 | if (!yd->tmp_serv_ilist) |
| 630 | yd->tmp_serv_ilist = g_string_new(pair->value); | |
| 631 | else | |
| 632 | g_string_append(yd->tmp_serv_ilist, pair->value); | |
| 6760 | 633 | break; |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
634 | case 89: |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
635 | yd->profiles = g_strsplit(pair->value, ",", -1); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
636 | break; |
| 7651 | 637 | case 59: /* cookies, yum */ |
| 638 | yahoo_process_cookie(yd, pair->value); | |
| 639 | break; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
640 | case YAHOO_SERVICE_PRESENCE_PERM: |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
641 | if (!yd->tmp_serv_plist) |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
642 | yd->tmp_serv_plist = g_string_new(pair->value); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
643 | else |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
644 | g_string_append(yd->tmp_serv_plist, pair->value); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
645 | break; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
646 | } |
|
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
647 | } |
| 2681 | 648 | |
| 6784 | 649 | if (pkt->status != 0) |
| 650 | return; | |
| 651 | ||
| 652 | if (yd->tmp_serv_blist) { | |
| 6820 | 653 | ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free); |
| 654 | ||
| 6784 | 655 | lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1); |
| 656 | for (tmp = lines; *tmp; tmp++) { | |
| 657 | split = g_strsplit(*tmp, ":", 2); | |
| 658 | if (!split) | |
| 659 | continue; | |
| 660 | if (!split[0] || !split[1]) { | |
| 661 | g_strfreev(split); | |
| 662 | continue; | |
| 663 | } | |
| 7827 | 664 | grp = yahoo_string_decode(gc, split[0], FALSE); |
| 6784 | 665 | buddies = g_strsplit(split[1], ",", -1); |
| 666 | for (bud = buddies; bud && *bud; bud++) { | |
| 15884 | 667 | norm_bud = g_strdup(purple_normalize(account, *bud)); |
| 9279 | 668 | f = yahoo_friend_find_or_new(gc, norm_bud); |
| 669 | ||
| 15884 | 670 | if (!(b = purple_find_buddy(account, norm_bud))) { |
| 671 | if (!(g = purple_find_group(grp))) { | |
| 672 | g = purple_group_new(grp); | |
| 673 | purple_blist_add_group(g, NULL); | |
| 6784 | 674 | } |
| 15884 | 675 | b = purple_buddy_new(account, norm_bud, NULL); |
| 676 | purple_blist_add_buddy(b, NULL, g, NULL); | |
| 6784 | 677 | export = TRUE; |
| 6820 | 678 | } |
| 6784 | 679 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
680 | yahoo_do_group_check(account, ht, norm_bud, grp); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
681 | /* set p2p status not connected and no p2p packet sent */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
682 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
683 | f->p2p_packet_sent = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
684 | |
| 7823 | 685 | g_free(norm_bud); |
| 6784 | 686 | } |
| 687 | g_strfreev(buddies); | |
| 688 | g_strfreev(split); | |
| 7827 | 689 | g_free(grp); |
| 6784 | 690 | } |
| 691 | g_strfreev(lines); | |
| 692 | ||
| 693 | g_string_free(yd->tmp_serv_blist, TRUE); | |
| 694 | yd->tmp_serv_blist = NULL; | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
695 | g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL); |
| 6820 | 696 | g_hash_table_destroy(ht); |
| 6784 | 697 | } |
| 698 | ||
| 699 | if (yd->tmp_serv_ilist) { | |
| 700 | buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1); | |
| 701 | for (bud = buddies; bud && *bud; bud++) { | |
| 702 | /* The server is already ignoring the user */ | |
| 703 | got_serv_list = TRUE; | |
|
22364
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
704 | purple_privacy_deny_add(account, *bud, 1); |
| 6784 | 705 | } |
| 706 | g_strfreev(buddies); | |
| 707 | ||
| 708 | g_string_free(yd->tmp_serv_ilist, TRUE); | |
| 709 | yd->tmp_serv_ilist = NULL; | |
| 710 | } | |
| 711 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
712 | if (got_serv_list && |
|
22364
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
713 | ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) && |
|
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
714 | (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) && |
|
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
715 | (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS))) |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
716 | { |
|
22364
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
717 | account->perm_deny = PURPLE_PRIVACY_DENY_USERS; |
| 15884 | 718 | purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n", |
|
22364
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
719 | account->username); |
| 6784 | 720 | } |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
721 | |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
722 | if (yd->tmp_serv_plist) { |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
723 | buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
724 | for (bud = buddies; bud && *bud; bud++) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
725 | f = yahoo_friend_find(gc, *bud); |
|
12138
fcf3d84824d7
[gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12088
diff
changeset
|
726 | if (f) { |
| 15884 | 727 | purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n", |
|
22364
1719b9cced93
Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents:
22359
diff
changeset
|
728 | account->username, *bud); |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
729 | f->presence = YAHOO_PRESENCE_PERM_OFFLINE; |
|
12138
fcf3d84824d7
[gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12088
diff
changeset
|
730 | } |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
731 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
732 | g_strfreev(buddies); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
733 | g_string_free(yd->tmp_serv_plist, TRUE); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
734 | yd->tmp_serv_plist = NULL; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
735 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
736 | } |
|
19058
9facc10e1c01
Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents:
19053
diff
changeset
|
737 | /* 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
|
738 | yahoo_fetch_aliases(gc); |
| 2681 | 739 | } |
| 740 | ||
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
741 | /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
742 | static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
| 2993 | 743 | { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
744 | PurpleAccount *account; |
| 2993 | 745 | char *msg = NULL; |
| 746 | char *from = NULL; | |
| 3019 | 747 | char *stat = NULL; |
| 748 | char *game = NULL; | |
| 9278 | 749 | YahooFriend *f = NULL; |
| 2993 | 750 | GSList *l = pkt->hash; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
751 | gint val_11 = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
752 | struct yahoo_data *yd = gc->proto_data; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
753 | gboolean msn = FALSE; |
| 6784 | 754 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
755 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
756 | |
| 2993 | 757 | while (l) { |
| 758 | struct yahoo_pair *pair = l->data; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
759 | if (pair->key == 4 || pair->key == 1) |
| 2993 | 760 | from = pair->value; |
| 761 | if (pair->key == 49) | |
| 762 | msg = pair->value; | |
| 3001 | 763 | if (pair->key == 13) |
| 3019 | 764 | stat = pair->value; |
| 765 | if (pair->key == 14) | |
| 766 | game = pair->value; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
767 | if (pair->key == 11) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
768 | val_11 = strtol(pair->value, NULL, 10); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
769 | if (pair->key == 241) |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
770 | if(strtol(pair->value, NULL, 10) == 2) |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
771 | msn = TRUE; |
| 2993 | 772 | l = l->next; |
| 773 | } | |
| 3640 | 774 | |
| 6784 | 775 | if (!from || !msg) |
| 3640 | 776 | return; |
| 6686 | 777 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
778 | /* disconnect the peer if connected through p2p and sends wrong value for session id */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
779 | if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
780 | purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
781 | /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
782 | g_hash_table_remove(yd->peers, from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
783 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
784 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
785 | |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
786 | if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING")) |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
787 | && (purple_privacy_check(account, from))) |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
788 | { |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
789 | if(msn) { |
|
27411
ea398d497614
Create a string only when necessary. Fixes a small possible leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27396
diff
changeset
|
790 | char *msn_from = g_strconcat("msn/", from, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
791 | if (*stat == '1') |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
792 | serv_got_typing(gc, msn_from, 0, PURPLE_TYPING); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
793 | else |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
794 | serv_got_typing_stopped(gc, msn_from); |
|
27411
ea398d497614
Create a string only when necessary. Fixes a small possible leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27396
diff
changeset
|
795 | g_free(msn_from); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
796 | } |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
797 | else { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
798 | if (*stat == '1') |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
799 | serv_got_typing(gc, from, 0, PURPLE_TYPING); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
800 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
801 | serv_got_typing_stopped(gc, from); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
802 | } |
| 4793 | 803 | } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
804 | PurpleBuddy *bud = purple_find_buddy(account, from); |
| 6784 | 805 | |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
806 | if (!bud) { |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
807 | purple_debug_warning("yahoo", |
|
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
808 | "%s is playing a game, and doesn't want you to know.\n", from); |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
809 | } |
|
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
810 | |
| 9279 | 811 | f = yahoo_friend_find(gc, from); |
| 6784 | 812 | if (!f) |
| 813 | return; /* if they're not on the list, don't bother */ | |
| 814 | ||
| 9283 | 815 | yahoo_friend_set_game(f, NULL); |
| 6784 | 816 | |
| 3019 | 817 | if (*stat == '1') { |
| 9283 | 818 | yahoo_friend_set_game(f, game); |
| 3020 | 819 | if (bud) |
| 6784 | 820 | yahoo_update_status(gc, from, f); |
| 3019 | 821 | } |
|
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
|
822 | } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
823 | PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); |
|
19545
39e46a4923f1
Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@pidgin.im>
parents:
19540
diff
changeset
|
824 | 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
|
825 | 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
|
826 | g_free(buf); |
| 3019 | 827 | } |
| 2993 | 828 | } |
| 829 | ||
| 7827 | 830 | |
| 831 | struct _yahoo_im { | |
| 832 | char *from; | |
|
27415
3f97c796191d
Use the active-id the message was sent to when sending the ack.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27411
diff
changeset
|
833 | char *active_id; |
| 7827 | 834 | int time; |
| 835 | int utf8; | |
| 9284 | 836 | int buddy_icon; |
|
27353
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
837 | char *id; |
| 7827 | 838 | char *msg; |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
839 | gboolean msn; |
| 7827 | 840 | }; |
| 841 | ||
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
842 | static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
843 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
844 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
845 | GSList *l = pkt->hash; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
846 | struct _yahoo_im *sms = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
847 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
848 | char *server_msg = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
849 | char *m; |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
850 | |
|
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
851 | yd = gc->proto_data; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
852 | account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
853 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
854 | while (l != NULL) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
855 | struct yahoo_pair *pair = l->data; |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
856 | if (pair->key == 4) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
857 | sms = g_new0(struct _yahoo_im, 1); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
858 | sms->from = g_strdup_printf("+%s", pair->value); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
859 | sms->time = time(NULL); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
860 | sms->utf8 = TRUE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
861 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
862 | if (pair->key == 14) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
863 | if (sms) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
864 | sms->msg = pair->value; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
865 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
866 | if (pair->key == 68) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
867 | if(sms) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
868 | g_hash_table_insert(yd->sms_carrier, g_strdup(sms->from), g_strdup(pair->value)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
869 | if (pair->key == 16) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
870 | server_msg = pair->value; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
871 | l = l->next; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
872 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
873 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
874 | if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) { |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
875 | if (server_msg) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
876 | PurpleConversation *c; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
877 | c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms->from, account); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
878 | if (c == NULL) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
879 | c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sms->from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
880 | purple_conversation_write(c, NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
881 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
882 | else |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
883 | purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
884 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
885 | g_free(sms->from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
886 | g_free(sms); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
887 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
888 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
889 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
890 | if (!sms->from || !sms->msg) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
891 | g_free(sms); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
892 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
893 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
894 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
895 | m = yahoo_string_decode(gc, sms->msg, sms->utf8); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
896 | serv_got_im(gc, sms->from, m, 0, sms->time); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
897 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
898 | g_free(m); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
899 | g_free(sms->from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
900 | g_free(sms); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
901 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
902 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
903 | /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
904 | static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type) |
| 2681 | 905 | { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
906 | PurpleAccount *account; |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
907 | struct yahoo_data *yd = gc->proto_data; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
908 | GSList *l = pkt->hash; |
| 7827 | 909 | GSList *list = NULL; |
| 910 | struct _yahoo_im *im = NULL; | |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
911 | const char *imv = NULL; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
912 | gint val_11 = 0; |
| 6069 | 913 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
914 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
915 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
916 | if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
917 | /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */ |
|
11914
81ac838f3824
[gaim-migrate @ 14205]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11897
diff
changeset
|
918 | while (l != NULL) { |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
919 | struct yahoo_pair *pair = l->data; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
920 | if (pair->key == 4 || pair->key == 1) { |
| 7827 | 921 | im = g_new0(struct _yahoo_im, 1); |
| 922 | list = g_slist_append(list, im); | |
| 923 | im->from = pair->value; | |
| 924 | im->time = time(NULL); | |
|
23426
ff02feaf4899
Yahoo seems to always send messages encoded in utf-8 now. Hopefully this
Daniel Atallah <datallah@pidgin.im>
parents:
23278
diff
changeset
|
925 | im->utf8 = TRUE; |
| 7827 | 926 | } |
|
27415
3f97c796191d
Use the active-id the message was sent to when sending the ack.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27411
diff
changeset
|
927 | if (im && pair->key == 5) |
|
3f97c796191d
Use the active-id the message was sent to when sending the ack.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27411
diff
changeset
|
928 | im->active_id = pair->value; |
| 7827 | 929 | if (pair->key == 97) |
| 930 | if (im) | |
| 931 | im->utf8 = strtol(pair->value, NULL, 10); | |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
932 | if (pair->key == 15) |
| 7827 | 933 | if (im) |
| 934 | im->time = strtol(pair->value, NULL, 10); | |
| 9284 | 935 | if (pair->key == 206) |
| 936 | if (im) | |
| 937 | im->buddy_icon = strtol(pair->value, NULL, 10); | |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
938 | if (pair->key == 14) { |
| 7827 | 939 | if (im) |
| 940 | im->msg = pair->value; | |
| 6687 | 941 | } |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
942 | if (im && pair->key == 241) { |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
943 | if(strtol(pair->value, NULL, 10) == 2) |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
944 | im->msn = TRUE; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
945 | } |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
946 | /* peer session id */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
947 | if (pair->key == 11) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
948 | if (im) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
949 | val_11 = strtol(pair->value, NULL, 10); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
950 | } |
|
11801
c19b37ac661b
[gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents:
11800
diff
changeset
|
951 | /* IMV key */ |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
952 | if (pair->key == 63) |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
953 | { |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
954 | imv = pair->value; |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
955 | } |
|
27353
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
956 | if (pair->key == 429) |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
957 | if (im) |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
958 | im->id = pair->value; |
|
6691
fecdc585c292
[gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents:
6687
diff
changeset
|
959 | l = l->next; |
| 6687 | 960 | } |
| 2681 | 961 | } else if (pkt->status == 2) { |
| 15884 | 962 | purple_notify_error(gc, NULL, |
|
10386
6fcc45a26a16
[gaim-migrate @ 11612]
Daniel Atallah <datallah@pidgin.im>
parents:
10379
diff
changeset
|
963 | _("Your Yahoo! message did not get sent."), NULL); |
| 2681 | 964 | } |
| 11608 | 965 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
966 | /* disconnect the peer if connected through p2p and sends wrong value for session id */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
967 | if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
968 | purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
969 | /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
970 | g_hash_table_remove(yd->peers, im->from); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
971 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
972 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
973 | |
|
13462
feff8b605383
[gaim-migrate @ 15836]
Daniel Atallah <datallah@pidgin.im>
parents:
13344
diff
changeset
|
974 | /** 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
|
975 | /* Check for the Doodle IMV */ |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
976 | if (im != NULL && imv!= NULL && im->from != NULL) |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
977 | { |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
978 | 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
|
979 | |
|
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
|
980 | if (strstr(imv, "doodle;") != NULL) |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
981 | { |
| 15884 | 982 | PurpleWhiteboard *wb; |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
983 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
984 | if (!purple_privacy_check(account, im->from)) { |
| 15884 | 985 | 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
|
986 | return; |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
987 | } |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
988 | |
|
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
|
989 | /* 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
|
990 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
991 | wb = purple_whiteboard_get_session(account, im->from); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
992 | |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
993 | /* If a Doodle session doesn't exist between this user */ |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
994 | if(wb == NULL) |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
995 | { |
|
20150
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
996 | doodle_session *ds; |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
997 | wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED); |
|
20150
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
998 | ds = wb->proto_data; |
|
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
999 | ds->imv_key = g_strdup(imv); |
|
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
1000 | |
|
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
1001 | yahoo_doodle_command_send_request(gc, im->from, imv); |
|
760aa4bea7c6
applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@pidgin.im>
parents:
19918
diff
changeset
|
1002 | yahoo_doodle_command_send_ready(gc, im->from, imv); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
1003 | } |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
1004 | } |
|
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
1005 | } |
| 7827 | 1006 | |
| 1007 | for (l = list; l; l = l->next) { | |
| 9306 | 1008 | YahooFriend *f; |
| 7827 | 1009 | char *m, *m2; |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1010 | char *msn_from = NULL; |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1011 | const char *from; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1012 | PurpleConversation *c; |
| 7827 | 1013 | im = l->data; |
| 1014 | ||
| 1015 | if (!im->from || !im->msg) { | |
| 1016 | g_free(im); | |
| 1017 | continue; | |
| 1018 | } | |
| 1019 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1020 | if (!purple_privacy_check(account, im->from)) { |
| 15884 | 1021 | 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
|
1022 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
1023 | } |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
1024 | |
|
27353
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1025 | /* |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1026 | * TODO: Is there anything else we should check when determining whether |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1027 | * we should send an acknowledgement? |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1028 | */ |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1029 | if (im->id != NULL) { |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1030 | /* Send acknowledgement. If we don't do this then the official |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1031 | * Yahoo Messenger client for Windows will send us the same |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1032 | * message 7 seconds later as an offline message. This is true |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1033 | * for at least version 9.0.0.2162 on Windows XP. */ |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1034 | struct yahoo_packet *pkt2; |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1035 | pkt2 = yahoo_packet_new(YAHOO_SERVICE_MESSAGE_ACK, |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1036 | YAHOO_STATUS_AVAILABLE, pkt->id); |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1037 | yahoo_packet_hash(pkt2, "ssisii", |
|
27415
3f97c796191d
Use the active-id the message was sent to when sending the ack.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27411
diff
changeset
|
1038 | 1, im->active_id, /* May not always be the connection's display name */ |
|
27353
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1039 | 5, im->from, |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1040 | 302, 430, |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1041 | 430, im->id, |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1042 | 303, 430, |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1043 | 450, 0); |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1044 | yahoo_packet_send_and_free(pkt2, yd); |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1045 | } |
|
f45f69e45658
New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents:
27350
diff
changeset
|
1046 | |
| 7827 | 1047 | m = yahoo_string_decode(gc, im->msg, im->utf8); |
|
12994
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1048 | /* This may actually not be necessary, but it appears |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1049 | * that at least at one point some clients were sending |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1050 | * "\r\n" as line delimiters, so we want to avoid double |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1051 | * lines. */ |
| 15884 | 1052 | m2 = purple_strreplace(m, "\r\n", "\n"); |
|
12994
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1053 | g_free(m); |
|
8340178b7b16
[gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents:
12970
diff
changeset
|
1054 | m = m2; |
| 15884 | 1055 | purple_util_chrreplace(m, '\r', '\n'); |
| 8375 | 1056 | |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1057 | if (im->msn) { |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1058 | msn_from = g_strconcat("msn/", im->from, NULL); |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1059 | from = msn_from; |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1060 | } else { |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1061 | from = im->from; |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1062 | } |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1063 | |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1064 | c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1065 | |
| 8375 | 1066 | if (!strcmp(m, "<ding>")) { |
|
21622
e9e85d3d0424
Fix #3421 by checking for an existing conversation in which to display a yahoo buzz.
Daniel Atallah <datallah@pidgin.im>
parents:
21510
diff
changeset
|
1067 | char *username; |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
1068 | |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1069 | if (c == NULL) { |
|
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1070 | c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, from); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1071 | } |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1072 | username = g_markup_escape_text(from, -1); |
|
24032
d5c04a8cc62a
Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23545
diff
changeset
|
1073 | purple_prpl_got_attention(gc, username, YAHOO_BUZZ); |
|
16007
3d954c38cf0c
Patch from Zac West which (1) adds a message flag, PURPLE_MESSAGE_NOTIFY, used to indicate that a message is a protocol-level notification from a user ('buzz' in yahoo, 'nudge' in msn, for example) and (2) uses it along with improving the text displayed when sending/receiving buzzes and nudges. The addition of this flag means that a plugin could implement custom behavior, such as playing a sound or triggerring some other event, reliably and easily.
Evan Schoenberg <evands@pidgin.im>
parents:
15884
diff
changeset
|
1074 | g_free(username); |
| 8375 | 1075 | g_free(m); |
| 1076 | g_free(im); | |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
1077 | g_free(msn_from); |
| 8375 | 1078 | continue; |
| 1079 | } | |
| 1080 | ||
| 7827 | 1081 | m2 = yahoo_codes_to_html(m); |
| 1082 | g_free(m); | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1083 | |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1084 | serv_got_im(gc, from, m2, 0, im->time); |
| 7827 | 1085 | g_free(m2); |
| 9284 | 1086 | |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
1087 | /* laters : implement buddy icon for msn friends */ |
|
27441
d43ffc31de58
Fix a crash when there are offline messages from both MSN and Yahoo
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27416
diff
changeset
|
1088 | if (!im->msn) { |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1089 | if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1090 | if (yahoo_friend_get_buddy_icon_need_request(f)) { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1091 | yahoo_send_picture_request(gc, im->from); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1092 | yahoo_friend_set_buddy_icon_need_request(f, FALSE); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1093 | } |
| 9284 | 1094 | } |
| 1095 | } | |
| 1096 | ||
| 7827 | 1097 | g_free(im); |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
1098 | g_free(msn_from); |
| 7827 | 1099 | } |
| 1100 | g_slist_free(list); | |
| 2681 | 1101 | } |
| 1102 | ||
| 15884 | 1103 | static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 7865 | 1104 | { |
| 1105 | 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
|
1106 | char *prim, *me = NULL, *msg = NULL; |
| 7865 | 1107 | |
| 1108 | while (l) { | |
| 1109 | struct yahoo_pair *pair = l->data; | |
| 1110 | ||
| 1111 | if (pair->key == 5) | |
| 1112 | me = pair->value; | |
| 1113 | if (pair->key == 14) | |
| 1114 | msg = pair->value; | |
| 1115 | ||
| 1116 | l = l->next; | |
| 1117 | } | |
| 1118 | ||
| 10070 | 1119 | if (!msg || !g_utf8_validate(msg, -1, NULL)) |
| 7865 | 1120 | return; |
| 1121 | ||
| 1122 | prim = g_strdup_printf(_("Yahoo! system message for %s:"), | |
| 15884 | 1123 | 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
|
1124 | purple_notify_info(NULL, NULL, prim, msg); |
| 7865 | 1125 | g_free(prim); |
| 1126 | } | |
| 1127 | ||
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1128 | struct yahoo_add_request { |
| 15884 | 1129 | PurpleConnection *gc; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1130 | char *id; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1131 | char *who; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1132 | int protocol; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1133 | }; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1134 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1135 | static void |
|
22359
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1136 | yahoo_buddy_add_authorize_cb(gpointer data) |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1137 | { |
|
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
|
1138 | 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
|
1139 | 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
|
1140 | struct yahoo_data *yd = add_req->gc->proto_data; |
|
27391
5c3a78516695
Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27390
diff
changeset
|
1141 | const char *who = add_req->who; |
|
5c3a78516695
Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27390
diff
changeset
|
1142 | |
|
5c3a78516695
Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27390
diff
changeset
|
1143 | if (add_req->protocol == 2) |
|
5c3a78516695
Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27390
diff
changeset
|
1144 | who += 4; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1145 | |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1146 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0); |
|
22359
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1147 | yahoo_packet_hash(pkt, "ssiii", |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1148 | 1, add_req->id, |
|
27391
5c3a78516695
Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27390
diff
changeset
|
1149 | 5, who, |
|
22359
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1150 | 241, add_req->protocol, |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1151 | 13, 1, |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1152 | 334, 0); |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1153 | 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
|
1154 | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1155 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1156 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1157 | g_free(add_req); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1158 | } |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1159 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1160 | static void |
|
22359
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1161 | yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1162 | { |
|
64502566f95b
Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents:
22277
diff
changeset
|
1163 | struct yahoo_data *yd = add_req->gc->proto_data; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1164 | struct yahoo_packet *pkt; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1165 | char *encoded_msg = NULL; |
|
27700
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1166 | const char *who = add_req->who; |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1167 | |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1168 | if (add_req->protocol == 2) |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1169 | who += 4; /* Skip 'msn/' */ |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1170 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1171 | if (msg && *msg) |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1172 | encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1173 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1174 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1175 | YAHOO_STATUS_AVAILABLE, 0); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1176 | |
|
27700
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1177 | yahoo_packet_hash(pkt, "ssiiiis", |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1178 | 1, add_req->id, |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1179 | 5, who, |
|
d7f8521cf633
Fix denying auth requests from MSN buddies, and fix a leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27682
diff
changeset
|
1180 | 241, add_req->protocol, |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1181 | 13, 2, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1182 | 334, 0, |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1183 | 97, 1, |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1184 | 14, encoded_msg ? encoded_msg : ""); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1185 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1186 | yahoo_packet_send_and_free(pkt, yd); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1187 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1188 | g_free(encoded_msg); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1189 | |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1190 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1191 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1192 | g_free(add_req); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1193 | } |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1194 | |
| 15119 | 1195 | static void |
| 1196 | yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg) | |
| 1197 | { | |
| 1198 | yahoo_buddy_add_deny_cb(add_req, NULL); | |
| 1199 | } | |
| 1200 | ||
| 1201 | 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
|
1202 | 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
|
1203 | struct yahoo_add_request *add_req = data; |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1204 | 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
|
1205 | NULL, _("No reason given."), TRUE, FALSE, NULL, |
| 15119 | 1206 | _("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
|
1207 | _("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
|
1208 | purple_connection_get_account(add_req->gc), add_req->who, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
1209 | add_req); |
| 15119 | 1210 | } |
| 1211 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1212 | 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
|
1213 | { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1214 | char *notify_msg; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1215 | 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
|
1216 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1217 | if (who == NULL) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1218 | return; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1219 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1220 | if (reason != NULL) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1221 | 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
|
1222 | 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
|
1223 | g_free(msg2); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1224 | } else |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1225 | 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
|
1226 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1227 | 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
|
1228 | g_free(notify_msg); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1229 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1230 | 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
|
1231 | 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
|
1232 | /* 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
|
1233 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1234 | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1235 | static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1236 | PurpleAccount *account; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1237 | GSList *l = pkt->hash; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1238 | const char *msg = NULL; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1239 | int protocol = 0; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1240 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1241 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1242 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1243 | /* Buddy authorized/declined our addition */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1244 | if (pkt->status == 1) { |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1245 | char *temp = NULL; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1246 | char *who = NULL; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1247 | int response = 0; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1248 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1249 | while (l) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1250 | struct yahoo_pair *pair = l->data; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1251 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1252 | switch (pair->key) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1253 | case 4: |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1254 | temp = pair->value; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1255 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1256 | case 13: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1257 | response = strtol(pair->value, NULL, 10); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1258 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1259 | case 14: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1260 | msg = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1261 | break; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1262 | case 241: |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1263 | protocol = strtol(pair->value, NULL, 10); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1264 | break; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1265 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1266 | 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
|
1267 | } |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1268 | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1269 | if(protocol == 0) |
|
26376
733f5f69a007
clear a double free bug
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26372
diff
changeset
|
1270 | who = g_strdup(temp); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1271 | else if(protocol == 2) |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
1272 | who = g_strconcat("msn/", temp, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1273 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1274 | if (response == 1) /* Authorized */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1275 | 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
|
1276 | else if (response == 2) { /* Declined */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1277 | 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
|
1278 | 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
|
1279 | } else |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1280 | purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)"); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1281 | g_free(who); |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1282 | } |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1283 | /* Buddy requested authorization to add us. */ |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1284 | else if (pkt->status == 3) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1285 | struct yahoo_add_request *add_req; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1286 | const char *firstname = NULL, *lastname = NULL; |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1287 | char *temp = NULL; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1288 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1289 | 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
|
1290 | add_req->gc = gc; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1291 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1292 | while (l) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1293 | struct yahoo_pair *pair = l->data; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1294 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1295 | switch (pair->key) { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1296 | case 4: |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1297 | temp = pair->value; |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1298 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1299 | case 5: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1300 | 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
|
1301 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1302 | case 14: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1303 | msg = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1304 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1305 | case 216: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1306 | firstname = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1307 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1308 | case 241: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1309 | 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
|
1310 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1311 | case 254: |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1312 | lastname = pair->value; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1313 | break; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1314 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1315 | } |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1316 | l = l->next; |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1317 | } |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1318 | if(add_req->protocol == 2) |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
1319 | add_req->who = g_strconcat("msn/", temp, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1320 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
1321 | add_req->who = g_strdup(temp); |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1322 | |
|
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
|
1323 | 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
|
1324 | 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
|
1325 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1326 | if (!purple_privacy_check(account, add_req->who)) |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1327 | { |
|
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
|
1328 | 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
|
1329 | 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
|
1330 | 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
|
1331 | 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
|
1332 | } |
|
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
|
1333 | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1334 | 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
|
1335 | 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
|
1336 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1337 | if (firstname && lastname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1338 | 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
|
1339 | else if (firstname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1340 | alias = g_strdup(firstname); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1341 | else if (lastname) |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1342 | alias = g_strdup(lastname); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1343 | |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1344 | /* 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
|
1345 | * 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
|
1346 | */ |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1347 | purple_account_request_authorization(account, add_req->who, add_req->id, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1348 | alias, dec_msg, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1349 | purple_find_buddy(account, add_req->who) != NULL, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1350 | yahoo_buddy_add_authorize_cb, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1351 | yahoo_buddy_add_deny_reason_cb, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1352 | add_req); |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1353 | 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
|
1354 | g_free(dec_msg); |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1355 | } else { |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1356 | g_free(add_req->id); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1357 | g_free(add_req->who); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1358 | g_free(add_req); |
|
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1359 | } |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1360 | } else { |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1361 | 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
|
1362 | } |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1363 | } |
|
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
1364 | |
|
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
|
1365 | /* I don't think this happens anymore in Version 15 */ |
| 15884 | 1366 | static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1367 | PurpleAccount *account; |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1368 | struct yahoo_add_request *add_req; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1369 | char *msg = NULL; |
| 2681 | 1370 | GSList *l = pkt->hash; |
| 1371 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1372 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1373 | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1374 | add_req = g_new0(struct yahoo_add_request, 1); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1375 | add_req->gc = gc; |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1376 | |
| 2681 | 1377 | while (l) { |
| 1378 | struct yahoo_pair *pair = l->data; | |
| 6686 | 1379 | |
| 1380 | switch (pair->key) { | |
| 1381 | case 1: | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1382 | add_req->id = g_strdup(pair->value); |
| 6686 | 1383 | break; |
| 1384 | case 3: | |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1385 | add_req->who = g_strdup(pair->value); |
| 6686 | 1386 | break; |
| 1387 | case 15: /* time, for when they add us and we're offline */ | |
| 1388 | break; | |
| 1389 | case 14: | |
| 2681 | 1390 | msg = pair->value; |
| 6686 | 1391 | break; |
| 1392 | } | |
| 2681 | 1393 | l = l->next; |
| 1394 | } | |
| 1395 | ||
|
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
|
1396 | 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
|
1397 | 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
|
1398 | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1399 | if (!purple_privacy_check(account, add_req->who)) { |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1400 | 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
|
1401 | 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
|
1402 | 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
|
1403 | 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
|
1404 | } |
|
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
|
1405 | |
| 7827 | 1406 | 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
|
1407 | dec_msg = yahoo_string_decode(gc, msg, FALSE); |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1408 | |
| 15119 | 1409 | /* 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
|
1410 | * this should probably be moved to the core. |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
1411 | */ |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1412 | purple_account_request_authorization(account, add_req->who, add_req->id, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1413 | NULL, dec_msg, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1414 | purple_find_buddy(account,add_req->who) != NULL, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1415 | yahoo_buddy_add_authorize_cb, |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
1416 | yahoo_buddy_add_deny_reason_cb, add_req); |
|
19703
fe6fb15211af
Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <datallah@pidgin.im>
parents:
19674
diff
changeset
|
1417 | g_free(dec_msg); |
|
11109
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1418 | } else { |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1419 | g_free(add_req->id); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1420 | g_free(add_req->who); |
|
d90b1fa34259
[gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents:
11078
diff
changeset
|
1421 | g_free(add_req); |
| 7827 | 1422 | } |
| 6686 | 1423 | } |
| 1424 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1425 | /* 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
|
1426 | static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6686 | 1427 | { |
| 1428 | char *who = NULL; | |
| 1429 | char *msg = NULL; | |
| 1430 | GSList *l = pkt->hash; | |
| 1431 | ||
| 1432 | while (l) { | |
| 1433 | struct yahoo_pair *pair = l->data; | |
| 1434 | ||
| 1435 | switch (pair->key) { | |
| 1436 | case 3: | |
| 1437 | who = pair->value; | |
| 1438 | break; | |
| 1439 | case 14: | |
| 1440 | msg = pair->value; | |
| 1441 | break; | |
| 1442 | } | |
| 1443 | l = l->next; | |
| 1444 | } | |
| 1445 | ||
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1446 | yahoo_buddy_denied_our_add(gc, who, msg); |
| 6686 | 1447 | } |
| 1448 | ||
| 15884 | 1449 | static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6686 | 1450 | { |
| 1451 | switch (pkt->status) { | |
| 1452 | case 1: | |
| 1453 | yahoo_process_status(gc, pkt); | |
| 1454 | return; | |
| 1455 | case 3: | |
| 1456 | yahoo_buddy_added_us(gc, pkt); | |
| 1457 | break; | |
| 1458 | case 7: | |
|
19540
5966b84d99ed
Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents:
19538
diff
changeset
|
1459 | yahoo_buddy_denied_our_add_old(gc, pkt); |
| 6686 | 1460 | break; |
| 1461 | default: | |
| 1462 | break; | |
|
2683
06507dfdd96c
[gaim-migrate @ 2696]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2682
diff
changeset
|
1463 | } |
| 2681 | 1464 | } |
| 1465 | ||
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1466 | #define OUT_CHARSET "utf-8" |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1467 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1468 | static char *yahoo_decode(const char *text) |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1469 | { |
| 9221 | 1470 | char *converted = NULL; |
| 8125 | 1471 | char *n, *new; |
| 1472 | const char *end, *p; | |
| 8616 | 1473 | int i, k; |
| 8125 | 1474 | |
| 7771 | 1475 | n = new = g_malloc(strlen (text) + 1); |
|
8118
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
1476 | end = text + strlen(text); |
|
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
1477 | |
| 8125 | 1478 | for (p = text; p < end; p++, n++) { |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1479 | if (*p == '\\') { |
| 9064 | 1480 | if (p[1] >= '0' && p[1] <= '7') { |
| 1481 | p += 1; | |
| 1482 | for (i = 0, k = 0; k < 3; k += 1) { | |
| 1483 | char c = p[k]; | |
| 9065 | 1484 | if (c < '0' || c > '7') break; |
| 9064 | 1485 | i *= 8; |
| 1486 | i += c - '0'; | |
| 1487 | } | |
| 1488 | *n = i; | |
| 1489 | p += k - 1; | |
| 1490 | } else { /* bug 959248 */ | |
| 1491 | /* If we see a \ not followed by an octal number, | |
| 1492 | * it means that it is actually a \\ with one \ | |
| 1493 | * already eaten by some unknown function. | |
| 1494 | * This is arguably broken. | |
| 1495 | * | |
| 1496 | * I think wing is wrong here, there is no function | |
| 1497 | * called that I see that could have done it. I guess | |
| 1498 | * it is just really sending single \'s. That's yahoo | |
| 1499 | * for you. | |
| 1500 | */ | |
| 1501 | *n = *p; | |
| 1502 | } | |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1503 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1504 | else |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1505 | *n = *p; |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1506 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1507 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1508 | *n = '\0'; |
| 8125 | 1509 | |
| 9221 | 1510 | if (strstr(text, "\033$B")) |
| 1511 | converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL); | |
| 1512 | if (!converted) | |
| 1513 | 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
|
1514 | g_free(new); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1515 | |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1516 | return converted; |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1517 | } |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1518 | |
| 15884 | 1519 | static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 1520 | { |
| 15884 | 1521 | PurpleAccount *account = purple_connection_get_account(gc); |
| 9221 | 1522 | 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
|
1523 | 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
|
1524 | 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
|
1525 | 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
|
1526 | const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL); |
| 2681 | 1527 | int count = 0; |
| 1528 | GSList *l = pkt->hash; | |
| 1529 | ||
| 15884 | 1530 | if (!purple_account_get_check_mail(account)) |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1531 | return; |
|
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1532 | |
| 2681 | 1533 | while (l) { |
| 1534 | struct yahoo_pair *pair = l->data; | |
| 1535 | if (pair->key == 9) | |
| 1536 | count = strtol(pair->value, NULL, 10); | |
| 1537 | else if (pair->key == 43) | |
| 1538 | who = pair->value; | |
| 1539 | else if (pair->key == 42) | |
| 1540 | email = pair->value; | |
| 1541 | else if (pair->key == 18) | |
| 1542 | subj = pair->value; | |
| 1543 | l = l->next; | |
| 1544 | } | |
| 1545 | ||
| 4001 | 1546 | if (who && subj && email && *email) { |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1547 | char *dec_who = yahoo_decode(who); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1548 | char *dec_subj = yahoo_decode(subj); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1549 | char *from = g_strdup_printf("%s (%s)", dec_who, email); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1550 | |
| 15884 | 1551 | purple_notify_email(gc, dec_subj, from, purple_account_get_username(account), |
| 9221 | 1552 | yahoo_mail_url, NULL, NULL); |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1553 | |
|
7747
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1554 | g_free(dec_who); |
|
ce63da454857
[gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents:
7696
diff
changeset
|
1555 | g_free(dec_subj); |
| 2850 | 1556 | g_free(from); |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1557 | } else if (count > 0) { |
|
27079
baa7cbe5775a
correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@pidgin.im>
parents:
26892
diff
changeset
|
1558 | const char *tos[2] = { purple_account_get_username(account) }; |
|
baa7cbe5775a
correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@pidgin.im>
parents:
26892
diff
changeset
|
1559 | const char *urls[2] = { yahoo_mail_url }; |
|
baa7cbe5775a
correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@pidgin.im>
parents:
26892
diff
changeset
|
1560 | |
|
baa7cbe5775a
correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@pidgin.im>
parents:
26892
diff
changeset
|
1561 | purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls, |
|
5521
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1562 | NULL, NULL); |
|
fca5b7c1340d
[gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents:
5498
diff
changeset
|
1563 | } |
| 2681 | 1564 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1565 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1566 | /* We use this structure once while we authenticate */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1567 | struct yahoo_auth_data |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1568 | { |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1569 | PurpleConnection *gc; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1570 | char *seed; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1571 | }; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1572 | |
| 3147 | 1573 | /* 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
|
1574 | static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._"; |
| 3147 | 1575 | |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1576 | /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1577 | * in util.c, but it is different from the one yahoo uses */ |
|
11897
10853b830964
[gaim-migrate @ 14188]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11838
diff
changeset
|
1578 | static void to_y64(char *out, const unsigned char *in, gsize inlen) |
| 3147 | 1579 | /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */ |
| 1580 | { | |
| 1581 | for (; inlen >= 3; inlen -= 3) | |
| 1582 | { | |
| 1583 | *out++ = base64digits[in[0] >> 2]; | |
| 1584 | *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)]; | |
| 1585 | *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)]; | |
| 1586 | *out++ = base64digits[in[2] & 0x3f]; | |
| 1587 | in += 3; | |
| 1588 | } | |
| 1589 | if (inlen > 0) | |
| 1590 | { | |
| 1591 | unsigned char fragment; | |
| 1592 | ||
| 1593 | *out++ = base64digits[in[0] >> 2]; | |
| 1594 | fragment = (in[0] << 4) & 0x30; | |
| 1595 | if (inlen > 1) | |
| 1596 | fragment |= in[1] >> 4; | |
| 1597 | *out++ = base64digits[fragment]; | |
| 1598 | *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c]; | |
| 1599 | *out++ = '-'; | |
| 1600 | } | |
| 1601 | *out = '\0'; | |
| 1602 | } | |
| 1603 | ||
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1604 | static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt) |
| 6986 | 1605 | { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1606 | struct yahoo_data *yd = gc->proto_data; |
| 15884 | 1607 | PurpleAccount *account = purple_connection_get_account(gc); |
| 1608 | const char *name = purple_normalize(account, purple_account_get_username(account)); | |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1609 | PurpleCipher *md5_cipher; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1610 | PurpleCipherContext *md5_ctx; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1611 | guchar md5_digest[16]; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1612 | gchar base64_string[25]; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1613 | struct yahoo_packet *pkt; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1614 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1615 | purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n"); |
| 6986 | 1616 | |
| 15884 | 1617 | md5_cipher = purple_ciphers_find_cipher("md5"); |
| 1618 | md5_ctx = purple_cipher_context_new(md5_cipher, NULL); | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1619 | purple_cipher_context_append(md5_ctx, (guchar *)crypt, strlen(crypt)); |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1620 | purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1621 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1622 | to_y64(base64_string, md5_digest, 16); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1623 | |
|
27200
b512ddc249da
Yahoo auth ver 16: Use the current status of the account when logging in. Enables logging as invisible.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27195
diff
changeset
|
1624 | purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status); |
|
b512ddc249da
Yahoo auth ver 16: Use the current status of the account when logging in. Enables logging as invisible.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27195
diff
changeset
|
1625 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1626 | if(yd->jp) { |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1627 | yahoo_packet_hash(pkt, "ssssssss", |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1628 | 1, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1629 | 0, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1630 | 277, yd->cookie_y, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1631 | 278, yd->cookie_t, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1632 | 307, base64_string, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1633 | 2, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1634 | 2, "1", |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1635 | 135, YAHOOJP_CLIENT_VERSION); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1636 | } else { |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1637 | yahoo_packet_hash(pkt, "sssssssss", |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1638 | 1, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1639 | 0, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1640 | 277, yd->cookie_y, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1641 | 278, yd->cookie_t, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1642 | 307, base64_string, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1643 | 244, YAHOO_CLIENT_VERSION_ID, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1644 | 2, name, |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1645 | 2, "1", |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1646 | 135, YAHOO_CLIENT_VERSION); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1647 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1648 | if (yd->picture_checksum) |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1649 | yahoo_packet_hash_int(pkt, 192, yd->picture_checksum); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1650 | yahoo_packet_send_and_free(pkt, yd); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1651 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1652 | purple_cipher_context_destroy(md5_ctx); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1653 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1654 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1655 | static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1656 | { |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1657 | struct yahoo_auth_data *auth_data = user_data; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1658 | PurpleConnection *gc = auth_data->gc; |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1659 | struct yahoo_data *yd; |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1660 | gboolean try_login_on_error = FALSE; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1661 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1662 | purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n"); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1663 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1664 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1665 | g_free(auth_data->seed); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1666 | g_free(auth_data); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1667 | g_return_if_reached(); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1668 | } |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1669 | |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1670 | yd = (struct yahoo_data *)gc->proto_data; |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1671 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1672 | if (error_message != NULL) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1673 | purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1674 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1675 | g_free(auth_data->seed); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
1676 | g_free(auth_data); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1677 | return; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1678 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1679 | else if (len > 0 && ret_data && *ret_data) { |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1680 | gchar **split_data = g_strsplit(ret_data, "\r\n", -1); |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1681 | int totalelements = 0; |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1682 | int response_no = -1; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1683 | char *crumb = NULL; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1684 | char *crypt = NULL; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1685 | |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1686 | #if GLIB_CHECK_VERSION(2,6,0) |
|
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1687 | totalelements = g_strv_length(split_data); |
|
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1688 | #else |
|
27513
0972fe7d59e8
Add an else when looking at the number of total elements and
Mark Doliner <markdoliner@pidgin.im>
parents:
27512
diff
changeset
|
1689 | while (split_data[++totalelements] != NULL); |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1690 | #endif |
|
27463
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1691 | if (totalelements >= 4) { |
|
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1692 | response_no = strtol(split_data[0], NULL, 10); |
|
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1693 | crumb = g_strdup(split_data[1] + strlen("crumb=")); |
|
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1694 | yd->cookie_y = g_strdup(split_data[2] + strlen("Y=")); |
|
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1695 | yd->cookie_t = g_strdup(split_data[3] + strlen("T=")); |
| 6986 | 1696 | } |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1697 | |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1698 | g_strfreev(split_data); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1699 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1700 | if(response_no != 0) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1701 | /* Some error in the login process */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1702 | PurpleConnectionError error; |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1703 | char *error_reason = NULL; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1704 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1705 | switch(response_no) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1706 | case -1: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1707 | /* Some error in the received stream */ |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1708 | error_reason = g_strdup(_("Received invalid data")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1709 | error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1710 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1711 | case 100: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1712 | /* Unknown error */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1713 | error_reason = g_strdup(_("Unknown error")); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1714 | error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1715 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1716 | default: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1717 | /* if we have everything we need, why not try to login irrespective of response */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1718 | if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1719 | try_login_on_error = TRUE; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1720 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1721 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1722 | error_reason = g_strdup(_("Unknown error")); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1723 | error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1724 | break; |
| 8349 | 1725 | } |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1726 | if(error_reason) { |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1727 | purple_debug_error("yahoo", "Authentication error: %s\n", |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1728 | error_reason); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1729 | purple_connection_error_reason(gc, error, error_reason); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1730 | g_free(error_reason); |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1731 | g_free(auth_data->seed); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1732 | g_free(auth_data); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1733 | return; |
| 8349 | 1734 | } |
| 1735 | } | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1736 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1737 | crypt = g_strconcat(crumb, auth_data->seed, NULL); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1738 | yahoo_auth16_stage3(gc, crypt); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1739 | g_free(crypt); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1740 | g_free(crumb); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
1741 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1742 | g_free(auth_data->seed); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1743 | g_free(auth_data); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1744 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1745 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1746 | static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message) |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1747 | { |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1748 | struct yahoo_auth_data *auth_data = user_data; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1749 | PurpleConnection *gc = auth_data->gc; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1750 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1751 | purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n"); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1752 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1753 | if (!PURPLE_CONNECTION_IS_VALID(gc)) { |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1754 | g_free(auth_data->seed); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1755 | g_free(auth_data); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1756 | g_return_if_reached(); |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1757 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1758 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1759 | if (error_message != NULL) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1760 | purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1761 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1762 | g_free(auth_data->seed); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1763 | g_free(auth_data); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1764 | return; |
| 6986 | 1765 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1766 | else if (len > 0 && ret_data && *ret_data) { |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1767 | gchar **split_data = g_strsplit(ret_data, "\r\n", -1); |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1768 | int totalelements = 0; |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1769 | int response_no = -1; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1770 | char *token = NULL; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1771 | |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1772 | #if GLIB_CHECK_VERSION(2,6,0) |
|
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1773 | totalelements = g_strv_length(split_data); |
|
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1774 | #else |
|
27513
0972fe7d59e8
Add an else when looking at the number of total elements and
Mark Doliner <markdoliner@pidgin.im>
parents:
27512
diff
changeset
|
1775 | while (split_data[++totalelements] != NULL); |
|
27357
6dad1279efcd
g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
27353
diff
changeset
|
1776 | #endif |
|
27510
08d9dc7185e7
In case of an error we do not receive the token, and totalelements in that case is 1. This fixes the issue of not being able to set error properly.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27467
diff
changeset
|
1777 | if(totalelements == 1) |
|
08d9dc7185e7
In case of an error we do not receive the token, and totalelements in that case is 1. This fixes the issue of not being able to set error properly.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27467
diff
changeset
|
1778 | response_no = strtol(split_data[0], NULL, 10); |
|
27513
0972fe7d59e8
Add an else when looking at the number of total elements and
Mark Doliner <markdoliner@pidgin.im>
parents:
27512
diff
changeset
|
1779 | else if(totalelements >= 2) { |
|
27463
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1780 | response_no = strtol(split_data[0], NULL, 10); |
|
439fc4b40125
Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27461
diff
changeset
|
1781 | token = g_strdup(split_data[1] + strlen("ymsgr=")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1782 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1783 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1784 | g_strfreev(split_data); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1785 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1786 | if(response_no != 0) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1787 | /* Some error in the login process */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1788 | PurpleConnectionError error; |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1789 | char *error_reason; |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1790 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1791 | switch(response_no) { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1792 | case -1: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1793 | /* Some error in the received stream */ |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1794 | error_reason = g_strdup(_("Received invalid data")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1795 | error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1796 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1797 | case 1212: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1798 | /* Password incorrect */ |
|
27511
b331af9eaf40
During login, if password incorrect, set it to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27510
diff
changeset
|
1799 | /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */ |
|
27529
6a7306481d7e
Complement the condition, fix the error I made in the last commit.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27513
diff
changeset
|
1800 | if (!purple_account_get_remember_password(purple_connection_get_account(gc))) |
|
27512
09bae417640b
Password reenter prompt only for accounts where password storing is enabled. More consistent with other accounts.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27511
diff
changeset
|
1801 | purple_account_set_password(purple_connection_get_account(gc), NULL); |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
1802 | error_reason = g_strdup(_("Incorrect password")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1803 | error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1804 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1805 | case 1213: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1806 | /* security lock from too many failed login attempts */ |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
1807 | error_reason = g_strdup(_("Account locked: Too many failed login attempts. Logging into the Yahoo! website may fix this.")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1808 | error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1809 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1810 | case 1235: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1811 | /* the username does not exist */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1812 | error_reason = g_strdup(_("Username does not exist")); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1813 | error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1814 | break; |
|
27272
49fee240fd96
yahoo login ver 16: Add another case of error reporting. Ask user to visit yahoo website in case of locked account.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
27247
diff
changeset
|
1815 | case 1214: |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1816 | case 1236: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1817 | /* indicates a lock of some description */ |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
1818 | error_reason = g_strdup(_("Account locked: Unknown reason. Logging into the Yahoo! website may fix this.")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1819 | error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1820 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1821 | case 100: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1822 | /* username or password missing */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1823 | error_reason = g_strdup(_("Username or password missing")); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1824 | error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1825 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1826 | default: |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1827 | /* Unknown error! */ |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1828 | error_reason = g_strdup(_("Unknown error")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1829 | error = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1830 | break; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1831 | } |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1832 | purple_debug_error("yahoo", "Authentication error: %s\n", |
|
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1833 | error_reason); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1834 | purple_connection_error_reason(gc, error, error_reason); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1835 | g_free(error_reason); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1836 | g_free(auth_data->seed); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1837 | g_free(auth_data); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1838 | } |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1839 | else { |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1840 | /* OK to login, correct information provided */ |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1841 | PurpleUtilFetchUrlData *url_data = NULL; |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
1842 | PurpleAccount *account = purple_connection_get_account(gc); |
|
27048
6eba1bfe015b
Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27046
diff
changeset
|
1843 | char *url = NULL; |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
1844 | gboolean yahoojp = yahoo_is_japan(account); |
|
27048
6eba1bfe015b
Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27046
diff
changeset
|
1845 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1846 | url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token); |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
1847 | url_data = purple_util_fetch_url_request_len_with_account(account, url, |
|
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
1848 | TRUE, YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, |
|
27195
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1849 | yahoo_auth16_stage2, auth_data); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1850 | g_free(url); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1851 | g_free(token); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1852 | } |
| 10687 | 1853 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1854 | } |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1855 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1856 | static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed) |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1857 | { |
|
27048
6eba1bfe015b
Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27046
diff
changeset
|
1858 | PurpleUtilFetchUrlData *url_data = NULL; |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1859 | struct yahoo_auth_data *auth_data = NULL; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1860 | char *url = NULL; |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1861 | char *encoded_username; |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1862 | char *encoded_password; |
|
27048
6eba1bfe015b
Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27046
diff
changeset
|
1863 | gboolean yahoojp; |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1864 | |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1865 | purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n"); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1866 | |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1867 | if(!purple_ssl_is_supported()) { |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
1868 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable")); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1869 | return; |
| 6986 | 1870 | } |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1871 | |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
1872 | yahoojp = yahoo_is_japan(purple_connection_get_account(gc)); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1873 | auth_data = g_new0(struct yahoo_auth_data, 1); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1874 | auth_data->gc = gc; |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1875 | auth_data->seed = g_strdup(seed); |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1876 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1877 | encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc)))); |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1878 | encoded_password = g_strdup(purple_url_encode(purple_connection_get_password(gc))); |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1879 | url = g_strdup_printf(yahoojp ? YAHOOJP_TOKEN_URL : YAHOO_TOKEN_URL, |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1880 | encoded_username, encoded_password, purple_url_encode(seed)); |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1881 | g_free(encoded_password); |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
1882 | g_free(encoded_username); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1883 | |
|
27195
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1884 | url_data = purple_util_fetch_url_request_len_with_account( |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1885 | purple_connection_get_account(gc), url, TRUE, |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1886 | YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1, |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1887 | yahoo_auth16_stage1_cb, auth_data); |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
1888 | |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1889 | g_free(url); |
| 6986 | 1890 | } |
| 1891 | ||
| 15884 | 1892 | static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 3147 | 1893 | { |
| 1894 | char *seed = NULL; | |
| 1895 | char *sn = NULL; | |
| 1896 | GSList *l = pkt->hash; | |
| 7010 | 1897 | int m = 0; |
| 9277 | 1898 | gchar *buf; |
| 1899 | ||
| 3147 | 1900 | while (l) { |
| 1901 | struct yahoo_pair *pair = l->data; | |
| 1902 | if (pair->key == 94) | |
| 1903 | seed = pair->value; | |
| 1904 | if (pair->key == 1) | |
| 1905 | sn = pair->value; | |
| 6986 | 1906 | if (pair->key == 13) |
| 1907 | m = atoi(pair->value); | |
| 3147 | 1908 | l = l->next; |
| 1909 | } | |
| 9277 | 1910 | |
| 3147 | 1911 | if (seed) { |
| 6986 | 1912 | switch (m) { |
| 1913 | case 0: | |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1914 | /* used to be for really old auth routine, dont support now */ |
| 3147 | 1915 | case 1: |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1916 | case 2: /* Yahoo ver 16 authentication */ |
|
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1917 | yahoo_auth16_stage1(gc, seed); |
| 3147 | 1918 | break; |
| 6986 | 1919 | default: |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1920 | { |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1921 | GHashTable *ui_info = purple_core_get_ui_info(); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1922 | |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1923 | buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized " |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1924 | "authentication method. You will probably not be able " |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1925 | "to successfully sign on to Yahoo. Check %s for updates."), |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1926 | ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE)); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1927 | purple_notify_error(gc, "", _("Failed Yahoo! Authentication"), |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1928 | buf); |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1929 | g_free(buf); |
|
27046
b5367e8dee23
Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26892
diff
changeset
|
1930 | yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */ |
|
23545
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1931 | break; |
|
676b13ddfd2c
Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents:
23542
diff
changeset
|
1932 | } |
| 3147 | 1933 | } |
| 1934 | } | |
| 1935 | } | |
| 2681 | 1936 | |
| 15884 | 1937 | static void ignore_buddy(PurpleBuddy *buddy) { |
| 1938 | PurpleGroup *group; | |
| 1939 | PurpleAccount *account; | |
| 6760 | 1940 | gchar *name; |
| 1941 | ||
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
1942 | if (!buddy) |
| 6792 | 1943 | return; |
| 6760 | 1944 | |
| 15884 | 1945 | group = purple_buddy_get_group(buddy); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1946 | name = g_strdup(purple_buddy_get_name(buddy)); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1947 | account = purple_buddy_get_account(buddy); |
| 6760 | 1948 | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
1949 | purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name); |
| 15884 | 1950 | purple_account_remove_buddy(account, buddy, group); |
| 1951 | purple_blist_remove_buddy(buddy); | |
| 6760 | 1952 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1953 | serv_add_deny(purple_account_get_connection(account), name); |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
1954 | |
| 6760 | 1955 | g_free(name); |
| 1956 | } | |
| 1957 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1958 | static void keep_buddy(PurpleBuddy *b) |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1959 | { |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1960 | purple_privacy_deny_remove(purple_buddy_get_account(b), |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
1961 | purple_buddy_get_name(b), 1); |
| 6760 | 1962 | } |
| 1963 | ||
| 15884 | 1964 | static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) { |
| 1965 | PurpleBuddy *b; | |
| 6760 | 1966 | GSList *l; |
| 1967 | gchar *who = NULL; | |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1968 | gchar *me = NULL; |
| 6760 | 1969 | gchar buf[BUF_LONG]; |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1970 | gboolean ignore = TRUE; |
| 6760 | 1971 | gint status = 0; |
| 1972 | ||
| 1973 | for (l = pkt->hash; l; l = l->next) { | |
| 1974 | struct yahoo_pair *pair = l->data; | |
| 1975 | switch (pair->key) { | |
| 1976 | case 0: | |
| 1977 | who = pair->value; | |
| 1978 | break; | |
| 1979 | case 1: | |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1980 | me = pair->value; |
| 6760 | 1981 | break; |
| 1982 | case 13: | |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1983 | /* 1 == ignore, 2 == unignore */ |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1984 | ignore = (strtol(pair->value, NULL, 10) == 1); |
| 6760 | 1985 | break; |
| 1986 | case 66: | |
| 1987 | status = strtol(pair->value, NULL, 10); | |
| 1988 | break; | |
| 1989 | default: | |
| 1990 | break; | |
| 1991 | } | |
| 1992 | } | |
| 1993 | ||
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1994 | /* |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1995 | * status |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1996 | * 0 - ok |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1997 | * 2 - already in ignore list, could not add |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1998 | * 3 - not in ignore list, could not delete |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
1999 | * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?) |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2000 | */ |
| 6760 | 2001 | switch (status) { |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2002 | case 12: |
|
22562
2e7123571ecd
Fix a missing a comma
Mark Doliner <markdoliner@pidgin.im>
parents:
22561
diff
changeset
|
2003 | purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s", |
|
22561
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2004 | who, (ignore ? "ignoring" : "unignoring")); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2005 | |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2006 | if (ignore) { |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2007 | b = purple_find_buddy(gc->account, who); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2008 | g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the " |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2009 | "user is on your buddy list. Clicking \"Yes\" " |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2010 | "will remove and ignore the buddy."), who); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2011 | purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2012 | gc->account, who, NULL, |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2013 | b, |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2014 | G_CALLBACK(ignore_buddy), |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2015 | G_CALLBACK(keep_buddy)); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2016 | break; |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2017 | } |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2018 | case 2: |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2019 | purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.", |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2020 | who); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2021 | break; |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2022 | case 3: |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2023 | purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete", |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2024 | who); |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2025 | case 0: |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2026 | default: |
|
0aeea64fa1dc
Added some comments and debug logging to yahoo_process_ignore() gleaned from libyahoo2's implementation, from which I guess our prpl was forked (?) given how similar many functions are.
Evan Schoenberg <evands@pidgin.im>
parents:
22552
diff
changeset
|
2027 | break; |
| 6760 | 2028 | } |
| 2029 | } | |
| 2030 | ||
| 15884 | 2031 | static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6761 | 2032 | { |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2033 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 9410 | 2034 | struct yahoo_data *yd = gc->proto_data; |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2035 | #endif /* TRY_WEBMESSENGER_LOGIN */ |
| 6761 | 2036 | GSList *l = pkt->hash; |
| 2037 | int err = 0; | |
| 2038 | char *msg; | |
| 7865 | 2039 | char *url = NULL; |
| 2040 | 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
|
2041 | PurpleAccount *account = gc->account; |
|
24855
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2042 | PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; |
| 6761 | 2043 | |
| 2044 | while (l) { | |
| 2045 | struct yahoo_pair *pair = l->data; | |
| 2046 | ||
| 2047 | if (pair->key == 66) | |
| 2048 | err = strtol(pair->value, NULL, 10); | |
|
21622
e9e85d3d0424
Fix #3421 by checking for an existing conversation in which to display a yahoo buzz.
Daniel Atallah <datallah@pidgin.im>
parents:
21510
diff
changeset
|
2049 | else if (pair->key == 20) |
| 7865 | 2050 | url = pair->value; |
| 6761 | 2051 | |
| 2052 | l = l->next; | |
| 2053 | } | |
| 2054 | ||
| 2055 | switch (err) { | |
|
24855
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2056 | case 0: |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2057 | msg = g_strdup(_("Unknown error")); |
|
24855
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2058 | reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR; |
|
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2059 | break; |
| 6761 | 2060 | case 3: |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2061 | msg = g_strdup(_("Username does not exist")); |
|
21510
eb2829adfd40
Use PURPLE_CONNECTION_ERROR_INVALID_USERNAME in oscar and yahoo, which were
Will Thompson <resiak@pidgin.im>
parents:
21503
diff
changeset
|
2062 | reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME; |
| 6761 | 2063 | break; |
| 2064 | case 13: | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
2065 | #ifdef TRY_WEBMESSENGER_LOGIN |
| 9410 | 2066 | if (!yd->wm) { |
| 15884 | 2067 | PurpleUtilFetchUrlData *url_data; |
| 9410 | 2068 | yd->wm = TRUE; |
| 2069 | if (yd->fd >= 0) | |
| 2070 | close(yd->fd); | |
| 2071 | if (gc->inpa) | |
| 15884 | 2072 | purple_input_remove(gc->inpa); |
| 2073 | url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE, | |
| 2074 | "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc); | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2075 | if (url_data != NULL) |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
2076 | yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
| 9410 | 2077 | return; |
| 2078 | } | |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2079 | #endif /* TRY_WEBMESSENGER_LOGIN */ |
|
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
|
2080 | 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
|
2081 | 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
|
2082 | |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2083 | msg = g_strdup(_("Incorrect password")); |
|
24855
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2084 | reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
| 7865 | 2085 | break; |
| 2086 | case 14: | |
| 9280 | 2087 | msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website.")); |
|
24855
db953b75304d
Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents:
24623
diff
changeset
|
2088 | reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED; |
| 6761 | 2089 | break; |
| 2090 | default: | |
| 9280 | 2091 | msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err); |
| 6761 | 2092 | } |
| 7865 | 2093 | |
| 2094 | if (url) | |
| 2095 | fullmsg = g_strdup_printf("%s\n%s", msg, url); | |
| 2096 | else | |
| 2097 | fullmsg = g_strdup(msg); | |
| 2098 | ||
|
21510
eb2829adfd40
Use PURPLE_CONNECTION_ERROR_INVALID_USERNAME in oscar and yahoo, which were
Will Thompson <resiak@pidgin.im>
parents:
21503
diff
changeset
|
2099 | purple_connection_error_reason(gc, reason, fullmsg); |
| 7865 | 2100 | g_free(msg); |
| 2101 | g_free(fullmsg); | |
| 6761 | 2102 | } |
| 2103 | ||
| 15884 | 2104 | static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 6840 | 2105 | { |
| 2106 | int err = 0; | |
| 2107 | char *who = NULL; | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2108 | char *temp = NULL; |
| 6840 | 2109 | char *group = NULL; |
| 7827 | 2110 | char *decoded_group; |
| 6840 | 2111 | char *buf; |
| 9278 | 2112 | YahooFriend *f; |
| 6840 | 2113 | GSList *l = pkt->hash; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2114 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2115 | int protocol = 0; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
2116 | gboolean msn = FALSE; |
| 6840 | 2117 | |
| 2118 | while (l) { | |
| 2119 | struct yahoo_pair *pair = l->data; | |
| 2120 | ||
| 2121 | switch (pair->key) { | |
| 2122 | case 66: | |
| 2123 | err = strtol(pair->value, NULL, 10); | |
| 2124 | break; | |
| 2125 | case 7: | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2126 | temp = pair->value; |
| 6840 | 2127 | break; |
| 2128 | case 65: | |
| 2129 | group = pair->value; | |
| 2130 | break; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2131 | case 241: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2132 | protocol = strtol(pair->value, NULL, 10); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2133 | if(protocol == 2) |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
2134 | msn = TRUE; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2135 | break; |
| 6840 | 2136 | } |
| 2137 | ||
| 2138 | l = l->next; | |
| 2139 | } | |
| 2140 | ||
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2141 | if (!temp) |
| 6840 | 2142 | return; |
| 2143 | if (!group) | |
| 2144 | group = ""; | |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2145 | |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
2146 | if(msn) |
|
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
2147 | who = g_strconcat("msn/", temp, NULL); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2148 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2149 | who = g_strdup(temp); |
| 6840 | 2150 | |
| 2151 | if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */ | |
| 9279 | 2152 | f = yahoo_friend_find_or_new(gc, who); |
| 2153 | yahoo_update_status(gc, who, f); | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2154 | if(protocol) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2155 | f->protocol = protocol; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2156 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2157 | if( !g_hash_table_lookup(yd->peers, who) ) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2158 | /* we are not connected as client, so set friend to not connected */ |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
2159 | if(msn) |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2160 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2161 | else { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2162 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2163 | f->p2p_packet_sent = 0; |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2164 | } |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2165 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2166 | else /* we are already connected. set friend to YAHOO_P2PSTATUS_WE_ARE_CLIENT */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2167 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); |
|
27460
ff88d5d2ecdb
Fix a small memory leak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27441
diff
changeset
|
2168 | g_free(who); |
| 6840 | 2169 | return; |
| 2170 | } | |
| 2171 | ||
| 7827 | 2172 | decoded_group = yahoo_string_decode(gc, group, FALSE); |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2173 | buf = g_strdup_printf(_("Unable to add buddy %s to group %s to the server list on account %s."), |
| 15884 | 2174 | who, decoded_group, purple_connection_get_display_name(gc)); |
| 2175 | if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf)) | |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2176 | purple_notify_error(gc, NULL, _("Unable to add buddy to server list"), buf); |
| 6840 | 2177 | g_free(buf); |
| 7827 | 2178 | g_free(decoded_group); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
2179 | g_free(who); |
| 6840 | 2180 | } |
| 2181 | ||
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2182 | /* write pkt to the source */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2183 | static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2184 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2185 | size_t pkt_len; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2186 | guchar *raw_packet; |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2187 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2188 | /*build the raw packet and send it to the host*/ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2189 | pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2190 | if(write(source, raw_packet, pkt_len) != pkt_len) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2191 | purple_debug_warning("yahoo","p2p: couldn't write to the source\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2192 | g_free(raw_packet); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2193 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2194 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2195 | static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2196 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2197 | struct yahoo_p2p_data *p2p_data = value; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2198 | PurpleConnection *gc = user_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2199 | struct yahoo_packet *pkt_to_send; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2200 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2201 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2202 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2203 | account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2204 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2205 | pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2206 | yahoo_packet_hash(pkt_to_send, "ssisi", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2207 | 4, purple_normalize(account, purple_account_get_username(account)), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2208 | 5, p2p_data->host_username, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2209 | 241, 0, /* Protocol identifier */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2210 | 49, "PEERTOPEER", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2211 | 13, 7); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2212 | yahoo_p2p_write_pkt(p2p_data->source, pkt_to_send); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2213 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2214 | yahoo_packet_free(pkt_to_send); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2215 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2216 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2217 | static gboolean yahoo_p2p_keepalive(gpointer data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2218 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2219 | PurpleConnection *gc = data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2220 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2221 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2222 | g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2223 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2224 | return TRUE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2225 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2226 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2227 | /* destroy p2p_data associated with a peer and close p2p connection. |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2228 | * g_hash_table_remove() calls this function to destroy p2p_data associated with the peer, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2229 | * call g_hash_table_remove() instead of this fucntion if peer has an entry in the table */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2230 | static void yahoo_p2p_disconnect_destroy_data(gpointer data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2231 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2232 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2233 | YahooFriend *f; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2234 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2235 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2236 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2237 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2238 | /* If friend, set him not connected */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2239 | f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2240 | if (f) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2241 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2242 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2243 | if(p2p_data->source >= 0) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2244 | close(p2p_data->source); |
|
27681
f6ba3163925e
Fix two errors when my p2p server connection times out.
Paul Aurich <darkrain42@pidgin.im>
parents:
27679
diff
changeset
|
2245 | if (p2p_data->input_event > 0) |
|
f6ba3163925e
Fix two errors when my p2p server connection times out.
Paul Aurich <darkrain42@pidgin.im>
parents:
27679
diff
changeset
|
2246 | purple_input_remove(p2p_data->input_event); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2247 | g_free(p2p_data->host_ip); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2248 | g_free(p2p_data->host_username); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2249 | g_free(p2p_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2250 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2251 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2252 | /* exchange of initial p2pfilexfer packets, service type YAHOO_SERVICE_P2PFILEXFER */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2253 | static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yahoo_packet *pkt) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2254 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2255 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2256 | char *who = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2257 | GSList *l = pkt->hash; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2258 | struct yahoo_packet *pkt_to_send; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2259 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2260 | int val_13_to_send = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2261 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2262 | YahooFriend *f; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2263 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2264 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2265 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2266 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2267 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2268 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2269 | /* lets see whats in the packet */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2270 | while (l) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2271 | struct yahoo_pair *pair = l->data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2272 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2273 | switch (pair->key) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2274 | case 4: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2275 | who = pair->value; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2276 | if(strncmp(who, p2p_data->host_username, strlen(p2p_data->host_username)) != 0) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2277 | /* from whom are we receiving the packets ?? */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2278 | purple_debug_warning("yahoo","p2p: received data from wrong user\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2279 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2280 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2281 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2282 | case 13: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2283 | p2p_data->val_13 = strtol(pair->value, NULL, 10); /* Value should be 5-7 */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2284 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2285 | /* case 5, 49 look laters, no use right now */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2286 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2287 | l = l->next; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2288 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2289 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2290 | account = purple_connection_get_account(p2p_data->gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2291 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2292 | /* key_13: sort of a counter. |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2293 | * WHEN WE ARE CLIENT: yahoo server sends val_13 = 0, we send to peer val_13 = 1, receive back val_13 = 5, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2294 | * we send val_13=6, receive val_13=7, we send val_13=7, HALT. Keep sending val_13 = 7 as keep alive. |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2295 | * WHEN WE ARE SERVER: we send val_13 = 0 to yahoo server, peer sends us val_13 = 1, we send val_13 = 5, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2296 | * receive val_13 = 6, send val_13 = 7, receive val_13 = 7. HALT. Keep sending val_13 = 7 as keep alive. */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2297 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2298 | switch(p2p_data->val_13) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2299 | case 1 : val_13_to_send = 5; break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2300 | case 5 : val_13_to_send = 6; break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2301 | case 6 : val_13_to_send = 7; break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2302 | case 7 : if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2303 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2304 | val_13_to_send = 7; break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2305 | default: purple_debug_warning("yahoo","p2p:Unknown value for key 13\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2306 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2307 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2308 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2309 | /* Build the yahoo packet */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2310 | pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2311 | yahoo_packet_hash(pkt_to_send, "ssisi", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2312 | 4, purple_normalize(account, purple_account_get_username(account)), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2313 | 5, p2p_data->host_username, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2314 | 241, 0, /* Protocol identifier */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2315 | 49, "PEERTOPEER", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2316 | 13, val_13_to_send); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2317 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2318 | /* build the raw packet and send it to the host */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2319 | yahoo_p2p_write_pkt(source, pkt_to_send); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2320 | yahoo_packet_free(pkt_to_send); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2321 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2322 | if( val_13_to_send == 7 ) |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2323 | if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2324 | g_hash_table_insert(yd->peers, g_strdup(p2p_data->host_username), p2p_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2325 | /* If the peer is a friend, set him connected */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2326 | f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2327 | if (f) { |
|
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2328 | if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2329 | p2p_data->session_id = f->session_id; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2330 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_SERVER); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2331 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2332 | else |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2333 | yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2334 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2335 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2336 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2337 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2338 | /* callback function associated with receiving of data, not considering receipt of multiple YMSG packets in a single TCP packet */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2339 | static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2340 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2341 | guchar buf[1024]; /* is it safe to assume a fixed array length of 1024 ?? */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2342 | int len; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2343 | int pos = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2344 | int pktlen; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2345 | struct yahoo_packet *pkt; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2346 | guchar *start = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2347 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2348 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2349 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2350 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2351 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2352 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2353 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2354 | len = read(source, buf, sizeof(buf)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2355 | if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK))) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2356 | return ; /* No Worries*/ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2357 | else if (len <= 0) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2358 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2359 | purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2360 | /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2361 | if( g_hash_table_lookup(yd->peers, p2p_data->host_username) ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2362 | g_hash_table_remove(yd->peers,p2p_data->host_username); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2363 | else |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2364 | yahoo_p2p_disconnect_destroy_data(data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2365 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2366 | } |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2367 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2368 | if(len < YAHOO_PACKET_HDRLEN) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2369 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2370 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2371 | if(strncmp((char *)buf, "YMSG", MIN(4, len)) != 0) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2372 | /* Not a YMSG packet */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2373 | purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2374 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2375 | start = memchr(buf + 1, 'Y', len - 1); |
|
27347
f5dfe20bd3fd
Yikes. buf is on the stack and shouldn't be freed. This fixes
Mark Doliner <markdoliner@pidgin.im>
parents:
27341
diff
changeset
|
2376 | if (start == NULL) |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2377 | return; |
|
27347
f5dfe20bd3fd
Yikes. buf is on the stack and shouldn't be freed. This fixes
Mark Doliner <markdoliner@pidgin.im>
parents:
27341
diff
changeset
|
2378 | |
|
f5dfe20bd3fd
Yikes. buf is on the stack and shouldn't be freed. This fixes
Mark Doliner <markdoliner@pidgin.im>
parents:
27341
diff
changeset
|
2379 | g_memmove(buf, start, len - (start - buf)); |
|
f5dfe20bd3fd
Yikes. buf is on the stack and shouldn't be freed. This fixes
Mark Doliner <markdoliner@pidgin.im>
parents:
27341
diff
changeset
|
2380 | len -= start - buf; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2381 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2382 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2383 | pos += 4; /* YMSG */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2384 | pos += 2; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2385 | pos += 2; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2386 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2387 | pktlen = yahoo_get16(buf + pos); pos += 2; |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
2388 | purple_debug_misc("yahoo", "p2p: %d bytes to read\n", len); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2389 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2390 | pkt = yahoo_packet_new(0, 0, 0); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2391 | pkt->service = yahoo_get16(buf + pos); pos += 2; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2392 | pkt->status = yahoo_get32(buf + pos); pos += 4; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2393 | pkt->id = yahoo_get32(buf + pos); pos += 4; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2394 | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
2395 | purple_debug_misc("yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2396 | yahoo_packet_read(pkt, buf + pos, pktlen); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2397 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2398 | /* packet processing */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2399 | switch(pkt->service) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2400 | case YAHOO_SERVICE_P2PFILEXFER: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2401 | yahoo_p2p_process_p2pfilexfer(data, source, pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2402 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2403 | case YAHOO_SERVICE_MESSAGE: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2404 | yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2405 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2406 | case YAHOO_SERVICE_NOTIFY: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2407 | yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2408 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2409 | default: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2410 | purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2411 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2412 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2413 | yahoo_packet_free(pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2414 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2415 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2416 | static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2417 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2418 | int acceptfd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2419 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2420 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2421 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2422 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2423 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2424 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2425 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2426 | acceptfd = accept(source, NULL, 0); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2427 | if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2428 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2429 | else if(acceptfd == -1) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2430 | purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2431 | yahoo_p2p_disconnect_destroy_data(data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2432 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2433 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2434 | |
|
26364
2f8986215c51
remove connection timeout if already connected
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26363
diff
changeset
|
2435 | /* remove timeout */ |
|
26888
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2436 | if (yd->yahoo_p2p_server_timeout_handle) { |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2437 | purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2438 | yd->yahoo_p2p_server_timeout_handle = 0; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2439 | } |
|
26364
2f8986215c51
remove connection timeout if already connected
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26363
diff
changeset
|
2440 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2441 | /* remove watcher and close p2p server */ |
|
26888
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2442 | if (yd->yahoo_p2p_server_watcher) { |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2443 | purple_input_remove(yd->yahoo_p2p_server_watcher); |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2444 | yd->yahoo_p2p_server_watcher = 0; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2445 | } |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2446 | if (yd->yahoo_local_p2p_server_fd >= 0) { |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2447 | close(yd->yahoo_local_p2p_server_fd); |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2448 | yd->yahoo_local_p2p_server_fd = -1; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
2449 | } |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2450 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2451 | /* Add an Input Read event to the file descriptor */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2452 | p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2453 | p2p_data->source = acceptfd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2454 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2455 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2456 | static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2457 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2458 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2459 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2460 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2461 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2462 | return FALSE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2463 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2464 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2465 | |
|
27681
f6ba3163925e
Fix two errors when my p2p server connection times out.
Paul Aurich <darkrain42@pidgin.im>
parents:
27679
diff
changeset
|
2466 | purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect\n"); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2467 | yahoo_p2p_disconnect_destroy_data(data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2468 | purple_input_remove(yd->yahoo_p2p_server_watcher); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2469 | yd->yahoo_p2p_server_watcher = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2470 | close(yd->yahoo_local_p2p_server_fd); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2471 | yd->yahoo_local_p2p_server_fd = -1; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2472 | yd->yahoo_p2p_server_timeout_handle = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2473 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2474 | return FALSE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2475 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2476 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2477 | static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2478 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2479 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2480 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2481 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2482 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2483 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2484 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2485 | if(listenfd == -1) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2486 | purple_debug_warning("yahoo","p2p: error starting p2p server\n"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2487 | yahoo_p2p_disconnect_destroy_data(data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2488 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2489 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2490 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2491 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2492 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2493 | /* Add an Input Read event to the file descriptor */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2494 | yd->yahoo_local_p2p_server_fd = listenfd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2495 | yd->yahoo_p2p_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_server_send_connected_cb,data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2496 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2497 | /* add timeout */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2498 | yd->yahoo_p2p_server_timeout_handle = purple_timeout_add_seconds(YAHOO_P2P_SERVER_TIMEOUT, yahoo_cancel_p2p_server_listen_cb, data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2499 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2500 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2501 | /* send p2p pkt containing our encoded ip, asking peer to connect to us */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2502 | void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2503 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2504 | const char *public_ip; |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2505 | guint32 temp[4]; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2506 | guint32 ip; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2507 | char temp_str[100]; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2508 | gchar *base64_ip = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2509 | YahooFriend *f; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2510 | struct yahoo_packet *pkt; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2511 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2512 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2513 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2514 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2515 | f = yahoo_friend_find(gc, who); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2516 | account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2517 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2518 | /* Do not send invitation if already listening for other connection */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2519 | if(yd->yahoo_local_p2p_server_fd >= 0) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2520 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2521 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2522 | /* One shouldn't try to connect to self */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2523 | if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2524 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2525 | |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2526 | /* send packet to only those friends who arent p2p connected and to whom we havent already sent. Do not send if this condition doesn't hold good */ |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2527 | if( !( f && (yahoo_friend_get_p2p_status(f) == YAHOO_P2PSTATUS_NOT_CONNECTED) && (f->p2p_packet_sent == 0)) ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2528 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2529 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2530 | /* Dont send p2p packet to buddies of other protocols */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2531 | if(f->protocol) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2532 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2533 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2534 | /* Finally, don't try to connect to buddies not online or on sms */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2535 | if( (f->status == YAHOO_STATUS_OFFLINE) || f->sms ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2536 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2537 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2538 | public_ip = purple_network_get_public_ip(); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2539 | if( (sscanf(public_ip, "%u.%u.%u.%u", &temp[0], &temp[1], &temp[2], &temp[3])) !=4 ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2540 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2541 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2542 | ip = (temp[3] << 24) | (temp[2] <<16) | (temp[1] << 8) | temp[0]; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2543 | sprintf(temp_str, "%d", ip); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2544 | base64_ip = purple_base64_encode( (guchar *)temp_str, strlen(temp_str) ); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2545 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2546 | pkt = yahoo_packet_new(YAHOO_SERVICE_PEERTOPEER, YAHOO_STATUS_AVAILABLE, 0); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2547 | yahoo_packet_hash(pkt, "sssissis", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2548 | 1, purple_normalize(account, purple_account_get_username(account)), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2549 | 4, purple_normalize(account, purple_account_get_username(account)), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2550 | 12, base64_ip, /* base64 encode ip */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2551 | 61, 0, /* To-do : figure out what is 61 for?? */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2552 | 2, "", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2553 | 5, who, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2554 | 13, val_13, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2555 | 49, "PEERTOPEER"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2556 | yahoo_packet_send_and_free(pkt, yd); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2557 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2558 | f->p2p_packet_sent = 1; /* set p2p_packet_sent to sent */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2559 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2560 | p2p_data = g_new0(struct yahoo_p2p_data, 1); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2561 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2562 | p2p_data->gc = gc; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2563 | p2p_data->host_ip = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2564 | p2p_data->host_username = g_strdup(who); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2565 | p2p_data->val_13 = val_13; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2566 | p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER; |
|
26735
bea12a762d15
Initialize file descriptors to -1.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26399
diff
changeset
|
2567 | p2p_data->source = -1; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2568 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2569 | purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2570 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2571 | g_free(base64_ip); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2572 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2573 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2574 | /* function called when connection to p2p host is setup */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2575 | static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2576 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2577 | struct yahoo_p2p_data *p2p_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2578 | struct yahoo_packet *pkt_to_send; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2579 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2580 | struct yahoo_data *yd; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2581 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2582 | if(!(p2p_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2583 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2584 | yd = p2p_data->gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2585 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2586 | if(error_message != NULL) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2587 | purple_debug_warning("yahoo","p2p: %s\n",error_message); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2588 | yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */ |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
2589 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2590 | yahoo_p2p_disconnect_destroy_data(p2p_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2591 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2592 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2593 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2594 | /* Add an Input Read event to the file descriptor */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2595 | p2p_data->input_event = purple_input_add(source, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2596 | p2p_data->source = source; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2597 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2598 | account = purple_connection_get_account(p2p_data->gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2599 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2600 | /* Build the yahoo packet */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2601 | pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2602 | yahoo_packet_hash(pkt_to_send, "ssisi", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2603 | 4, purple_normalize(account, purple_account_get_username(account)), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2604 | 5, p2p_data->host_username, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2605 | 241, 0, /* Protocol identifier */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2606 | 49, "PEERTOPEER", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2607 | 13, 1); /* we receive key13= 0 or 2, we send key13=1 */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2608 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2609 | yahoo_p2p_write_pkt(source, pkt_to_send); /* build raw packet and send */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2610 | yahoo_packet_free(pkt_to_send); |
| 6840 | 2611 | } |
| 2612 | ||
| 15884 | 2613 | static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9062 | 2614 | { |
| 2615 | GSList *l = pkt->hash; | |
| 2616 | char *who = NULL; | |
| 2617 | char *base64 = NULL; | |
|
11137
cf40226ddff7
[gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents:
11127
diff
changeset
|
2618 | guchar *decoded; |
|
11127
5e539d9d26a4
[gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents:
11111
diff
changeset
|
2619 | gsize len; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2620 | gint val_13 = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2621 | gint val_11 = 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2622 | PurpleAccount *account; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2623 | YahooFriend *f; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2624 | |
|
26365
a94adbb11084
identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26364
diff
changeset
|
2625 | /* if status is not 1 ie YAHOO_STATUS_BRB, the packet bounced back, so contains our own ip */ |
|
a94adbb11084
identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26364
diff
changeset
|
2626 | if(!(pkt->status == YAHOO_STATUS_BRB)) |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2627 | return ; |
| 9062 | 2628 | |
| 2629 | while (l) { | |
| 2630 | struct yahoo_pair *pair = l->data; | |
| 2631 | ||
| 2632 | switch (pair->key) { | |
| 2633 | case 5: | |
| 2634 | /* our identity */ | |
| 2635 | break; | |
| 2636 | case 4: | |
| 2637 | who = pair->value; | |
| 2638 | break; | |
| 2639 | case 1: | |
| 2640 | /* who again, the master identity this time? */ | |
| 2641 | break; | |
| 2642 | case 12: | |
| 2643 | base64 = pair->value; | |
| 2644 | /* so, this is an ip address. in base64. decoded it's in ascii. | |
| 2645 | after strtol, it's in reversed byte order. Who thought this up?*/ | |
| 2646 | break; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2647 | case 13: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2648 | val_13 = strtol(pair->value, NULL, 10); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2649 | break; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2650 | case 11: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2651 | val_11 = strtol(pair->value, NULL, 10); /* session id of peer */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2652 | if( (f = yahoo_friend_find(gc, who)) ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2653 | f->session_id = val_11; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2654 | break; |
| 9062 | 2655 | /* |
| 2656 | TODO: figure these out | |
| 2657 | yahoo: Key: 61 Value: 0 | |
| 2658 | yahoo: Key: 2 Value: | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2659 | yahoo: Key: 13 Value: 0 packet count ?? |
| 9062 | 2660 | yahoo: Key: 49 Value: PEERTOPEER |
| 2661 | yahoo: Key: 140 Value: 1 | |
| 2662 | */ | |
| 2663 | ||
| 2664 | } | |
| 2665 | ||
| 2666 | l = l->next; | |
| 2667 | } | |
| 2668 | ||
| 9277 | 2669 | if (base64) { |
| 9281 | 2670 | guint32 ip; |
| 2671 | YahooFriend *f; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2672 | char *host_ip; |
|
26736
a9c00905cb8b
Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26735
diff
changeset
|
2673 | struct yahoo_p2p_data *p2p_data; |
| 9281 | 2674 | |
| 15884 | 2675 | decoded = purple_base64_decode(base64, &len); |
| 9277 | 2676 | if (len) { |
| 15884 | 2677 | char *tmp = purple_str_binary_to_ascii(decoded, len); |
| 2678 | purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp); | |
| 9277 | 2679 | g_free(tmp); |
| 2680 | } | |
| 9281 | 2681 | |
|
26736
a9c00905cb8b
Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26735
diff
changeset
|
2682 | ip = strtol((gchar *)decoded, NULL, 10); |
| 9062 | 2683 | g_free(decoded); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2684 | host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff, |
| 9281 | 2685 | (ip >> 24) & 0xff); |
| 2686 | f = yahoo_friend_find(gc, who); | |
| 2687 | if (f) | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2688 | yahoo_friend_set_ip(f, host_ip); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2689 | purple_debug_info("yahoo", "IP : %s\n", host_ip); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2690 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2691 | account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2692 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
2693 | if(val_11==0) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2694 | if(!f) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2695 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2696 | else |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2697 | val_11 = f->session_id; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2698 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2699 | |
|
26736
a9c00905cb8b
Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26735
diff
changeset
|
2700 | p2p_data = g_new0(struct yahoo_p2p_data, 1); |
|
a9c00905cb8b
Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26735
diff
changeset
|
2701 | p2p_data->host_username = g_strdup(who); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2702 | p2p_data->val_13 = val_13; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2703 | p2p_data->session_id = val_11; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2704 | p2p_data->host_ip = host_ip; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2705 | p2p_data->gc = gc; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2706 | p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT; |
|
26736
a9c00905cb8b
Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26735
diff
changeset
|
2707 | p2p_data->source = -1; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2708 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2709 | /* connect to host */ |
|
27341
5a964f9c7cdc
Pass a handle to purple_proxy_connect() when making this connection.
Mark Doliner <markdoliner@pidgin.im>
parents:
27335
diff
changeset
|
2710 | if((purple_proxy_connect(gc, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2711 | purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip); |
|
26799
cce88cc18d12
Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26770
diff
changeset
|
2712 | g_free(p2p_data->host_ip); |
|
cce88cc18d12
Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26770
diff
changeset
|
2713 | g_free(p2p_data->host_username); |
|
cce88cc18d12
Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26770
diff
changeset
|
2714 | g_free(p2p_data); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2715 | } |
| 9062 | 2716 | } |
| 2717 | } | |
| 2718 | ||
| 15884 | 2719 | static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 9604 | 2720 | { |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
2721 | PurpleAccount *account; |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2722 | char *who = NULL, *msg = NULL, *id = NULL; |
| 9604 | 2723 | GSList *l = pkt->hash; |
| 2724 | ||
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
2725 | account = purple_connection_get_account(gc); |
|
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
2726 | |
| 9604 | 2727 | while (l) { |
| 2728 | struct yahoo_pair *pair = l->data; | |
| 2729 | ||
| 2730 | switch (pair->key) { | |
| 2731 | case 4: | |
| 2732 | who = pair->value; | |
| 2733 | break; | |
| 2734 | case 5: | |
| 2735 | /* us */ | |
| 2736 | break; | |
| 2737 | case 230: | |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2738 | /* the audible, in foo.locale.bar.baz format |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2739 | eg: base.tw.smiley.smiley43 */ |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2740 | id = pair->value; |
| 9604 | 2741 | break; |
| 2742 | case 231: | |
| 2743 | /* the text of the audible */ | |
| 2744 | msg = pair->value; | |
| 2745 | break; | |
| 2746 | case 232: | |
| 2747 | /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */ | |
| 2748 | break; | |
| 2749 | } | |
| 2750 | ||
| 2751 | l = l->next; | |
| 2752 | } | |
| 2753 | ||
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2754 | if (!msg) |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2755 | msg = id; |
| 9604 | 2756 | if (!who || !msg) |
| 2757 | return; | |
| 2758 | if (!g_utf8_validate(msg, -1, NULL)) { | |
| 15884 | 2759 | purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n"); |
| 9604 | 2760 | return; |
| 2761 | } | |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
2762 | if (!purple_privacy_check(account, who)) { |
| 15884 | 2763 | purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n", |
|
22366
5f5f96206385
Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents:
22364
diff
changeset
|
2764 | purple_account_get_username(account), who); |
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2765 | return; |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
2766 | } |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2767 | if (id) { |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2768 | /* "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
|
2769 | char **audible_locale = g_strsplit(id, ".", 0); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2770 | 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
|
2771 | g_strfreev(audible_locale); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2772 | |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2773 | serv_got_im(gc, who, buf, 0, time(NULL)); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2774 | g_free(buf); |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2775 | } else |
|
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2776 | serv_got_im(gc, who, msg, 0, time(NULL)); |
| 9604 | 2777 | } |
| 2778 | ||
| 15884 | 2779 | static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt) |
| 2681 | 2780 | { |
| 6760 | 2781 | switch (pkt->service) { |
| 2681 | 2782 | case YAHOO_SERVICE_LOGON: |
|
2771
8c214f13da39
[gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2741
diff
changeset
|
2783 | case YAHOO_SERVICE_LOGOFF: |
| 2681 | 2784 | case YAHOO_SERVICE_ISAWAY: |
|
2737
f7edb9c3f348
[gaim-migrate @ 2750]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2724
diff
changeset
|
2785 | case YAHOO_SERVICE_ISBACK: |
| 3019 | 2786 | case YAHOO_SERVICE_GAMELOGON: |
| 2787 | case YAHOO_SERVICE_GAMELOGOFF: | |
| 6686 | 2788 | case YAHOO_SERVICE_CHATLOGON: |
| 2789 | case YAHOO_SERVICE_CHATLOGOFF: | |
| 10373 | 2790 | case YAHOO_SERVICE_Y6_STATUS_UPDATE: |
| 14320 | 2791 | case YAHOO_SERVICE_STATUS_15: |
| 2681 | 2792 | yahoo_process_status(gc, pkt); |
| 2793 | break; | |
| 3019 | 2794 | case YAHOO_SERVICE_NOTIFY: |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2795 | yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER); |
| 2993 | 2796 | break; |
| 2681 | 2797 | case YAHOO_SERVICE_MESSAGE: |
| 2786 | 2798 | case YAHOO_SERVICE_GAMEMSG: |
| 5939 | 2799 | case YAHOO_SERVICE_CHATMSG: |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2800 | yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER); |
| 2681 | 2801 | break; |
| 7865 | 2802 | case YAHOO_SERVICE_SYSMESSAGE: |
| 2803 | yahoo_process_sysmessage(gc, pkt); | |
| 2804 | break; | |
| 2681 | 2805 | case YAHOO_SERVICE_NEWMAIL: |
| 2806 | yahoo_process_mail(gc, pkt); | |
| 2807 | break; | |
| 2808 | case YAHOO_SERVICE_NEWCONTACT: | |
| 2809 | yahoo_process_contact(gc, pkt); | |
| 2810 | break; | |
| 6784 | 2811 | case YAHOO_SERVICE_AUTHRESP: |
| 2812 | yahoo_process_authresp(gc, pkt); | |
| 2813 | break; | |
| 2681 | 2814 | case YAHOO_SERVICE_LIST: |
| 2815 | yahoo_process_list(gc, pkt); | |
| 2816 | break; | |
| 14320 | 2817 | case YAHOO_SERVICE_LIST_15: |
| 2818 | yahoo_process_list_15(gc, pkt); | |
| 2819 | break; | |
| 3147 | 2820 | case YAHOO_SERVICE_AUTH: |
| 2821 | yahoo_process_auth(gc, pkt); | |
| 2822 | break; | |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
2823 | 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
|
2824 | 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
|
2825 | break; |
| 6840 | 2826 | case YAHOO_SERVICE_ADDBUDDY: |
| 2827 | yahoo_process_addbuddy(gc, pkt); | |
| 2828 | break; | |
| 6760 | 2829 | case YAHOO_SERVICE_IGNORECONTACT: |
| 2830 | yahoo_process_ignore(gc, pkt); | |
| 2831 | break; | |
| 6729 | 2832 | case YAHOO_SERVICE_CONFINVITE: |
| 2833 | case YAHOO_SERVICE_CONFADDINVITE: | |
| 2834 | yahoo_process_conference_invite(gc, pkt); | |
| 2835 | break; | |
| 2836 | case YAHOO_SERVICE_CONFDECLINE: | |
| 2837 | yahoo_process_conference_decline(gc, pkt); | |
| 2838 | break; | |
| 2839 | case YAHOO_SERVICE_CONFLOGON: | |
| 2840 | yahoo_process_conference_logon(gc, pkt); | |
| 2841 | break; | |
| 2842 | case YAHOO_SERVICE_CONFLOGOFF: | |
| 2843 | yahoo_process_conference_logoff(gc, pkt); | |
| 2844 | break; | |
| 2845 | case YAHOO_SERVICE_CONFMSG: | |
| 2846 | yahoo_process_conference_message(gc, pkt); | |
| 2847 | break; | |
| 2848 | case YAHOO_SERVICE_CHATONLINE: | |
| 2849 | yahoo_process_chat_online(gc, pkt); | |
| 2850 | break; | |
| 2851 | case YAHOO_SERVICE_CHATLOGOUT: | |
| 2852 | yahoo_process_chat_logout(gc, pkt); | |
| 2853 | break; | |
| 2854 | case YAHOO_SERVICE_CHATGOTO: | |
| 2855 | yahoo_process_chat_goto(gc, pkt); | |
| 2856 | break; | |
| 2857 | case YAHOO_SERVICE_CHATJOIN: | |
| 2858 | yahoo_process_chat_join(gc, pkt); | |
| 2859 | break; | |
| 2860 | case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */ | |
| 2861 | case YAHOO_SERVICE_CHATEXIT: | |
| 2862 | yahoo_process_chat_exit(gc, pkt); | |
| 2863 | break; | |
| 2864 | case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */ | |
| 2865 | case YAHOO_SERVICE_CHATADDINVITE: | |
| 2866 | yahoo_process_chat_addinvite(gc, pkt); | |
| 2867 | break; | |
| 2868 | case YAHOO_SERVICE_COMMENT: | |
| 2869 | yahoo_process_chat_message(gc, pkt); | |
| 2870 | break; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2871 | case YAHOO_SERVICE_PRESENCE_PERM: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2872 | case YAHOO_SERVICE_PRESENCE_SESSION: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
2873 | yahoo_process_presence(gc, pkt); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
2874 | break; |
| 7651 | 2875 | case YAHOO_SERVICE_P2PFILEXFER: |
|
11644
939411169d01
[gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11643
diff
changeset
|
2876 | /* This case had no break and continued; thus keeping it this way.*/ |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2877 | yahoo_process_p2p(gc, pkt); /* P2PFILEXFER handled the same way as process_p2p */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2878 | yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */ |
| 7651 | 2879 | case YAHOO_SERVICE_FILETRANSFER: |
| 2880 | yahoo_process_filetransfer(gc, pkt); | |
| 2881 | break; | |
|
11180
4098d74c03c2
[gaim-migrate @ 13291]
Daniel Atallah <datallah@pidgin.im>
parents:
11153
diff
changeset
|
2882 | case YAHOO_SERVICE_PEERTOPEER: |
| 9062 | 2883 | yahoo_process_p2p(gc, pkt); |
| 2884 | break; | |
| 9284 | 2885 | case YAHOO_SERVICE_PICTURE: |
| 2886 | yahoo_process_picture(gc, pkt); | |
| 2887 | break; | |
| 9292 | 2888 | case YAHOO_SERVICE_PICTURE_CHECKSUM: |
| 2889 | yahoo_process_picture_checksum(gc, pkt); | |
| 2890 | break; | |
| 9306 | 2891 | case YAHOO_SERVICE_PICTURE_UPLOAD: |
| 2892 | yahoo_process_picture_upload(gc, pkt); | |
| 2893 | break; | |
|
27467
5fd6936c4ed7
Some more fixes for when unsetting buddy picture, for both when sending and receiving updates.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27463
diff
changeset
|
2894 | case YAHOO_SERVICE_PICTURE_UPDATE: |
|
14030
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2895 | case YAHOO_SERVICE_AVATAR_UPDATE: |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2896 | yahoo_process_avatar_update(gc, pkt); |
|
23144f1dc950
[gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents:
13941
diff
changeset
|
2897 | break; |
| 9604 | 2898 | case YAHOO_SERVICE_AUDIBLE: |
| 2899 | yahoo_process_audible(gc, pkt); | |
|
12798
f8d553043aee
[gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12797
diff
changeset
|
2900 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2901 | case YAHOO_SERVICE_FILETRANS_15: |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2902 | yahoo_process_filetrans_15(gc, pkt); |
|
21918
1c81e8b5df6b
Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <datallah@pidgin.im>
parents:
21916
diff
changeset
|
2903 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2904 | case YAHOO_SERVICE_FILETRANS_INFO_15: |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2905 | yahoo_process_filetrans_info_15(gc, pkt); |
|
21918
1c81e8b5df6b
Patch from Alex Badea to support receiving files from Yahoo users using the newer yahoo protocol. Committing this is very long overdue, it somehow slipped through the cracks for a long time. References #708.
Daniel Atallah <datallah@pidgin.im>
parents:
21916
diff
changeset
|
2906 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2907 | case YAHOO_SERVICE_FILETRANS_ACC_15: |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2908 | yahoo_process_filetrans_acc_15(gc, pkt); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2909 | break; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2910 | case YAHOO_SERVICE_SMS_MSG: |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2911 | yahoo_process_sms_message(gc, pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
2912 | break; |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
2913 | |
| 2681 | 2914 | default: |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
2915 | purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service); |
| 2681 | 2916 | break; |
| 2917 | } | |
| 2918 | } | |
| 2919 | ||
| 15884 | 2920 | static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 2681 | 2921 | { |
| 15884 | 2922 | PurpleConnection *gc = data; |
| 2681 | 2923 | struct yahoo_data *yd = gc->proto_data; |
| 2924 | char buf[1024]; | |
| 2925 | int len; | |
| 2926 | ||
| 2927 | len = read(yd->fd, buf, sizeof(buf)); | |
| 2928 | ||
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2929 | if (len < 0) { |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2930 | gchar *tmp; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2931 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2932 | if (errno == EAGAIN) |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2933 | /* No worries */ |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2934 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2935 | |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2936 | tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21106
diff
changeset
|
2937 | g_strerror(errno)); |
| 21279 | 2938 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2939 | g_free(tmp); |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2940 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
2941 | } else if (len == 0) { |
| 21279 | 2942 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
2943 | _("Server closed the connection")); |
| 2681 | 2944 | return; |
| 2945 | } | |
|
22277
7c386db62c81
Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@pidgin.im>
parents:
22225
diff
changeset
|
2946 | gc->last_received = time(NULL); |
| 2681 | 2947 | yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen); |
| 2948 | memcpy(yd->rxqueue + yd->rxlen, buf, len); | |
| 2949 | yd->rxlen += len; | |
| 2950 | ||
| 2951 | while (1) { | |
| 2952 | struct yahoo_packet *pkt; | |
| 2953 | int pos = 0; | |
| 2954 | int pktlen; | |
| 2955 | ||
| 2956 | if (yd->rxlen < YAHOO_PACKET_HDRLEN) | |
| 2957 | return; | |
| 2958 | ||
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11303
diff
changeset
|
2959 | if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) { |
| 10610 | 2960 | /* HEY! This isn't even a YMSG packet. What |
| 2961 | * are you trying to pull? */ | |
| 2962 | guchar *start; | |
| 2963 | ||
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
2964 | purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n"); |
| 10611 | 2965 | |
| 10635 | 2966 | start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1); |
| 10610 | 2967 | if (start) { |
| 2968 | g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue)); | |
| 2969 | yd->rxlen -= start - yd->rxqueue; | |
| 2970 | continue; | |
| 2971 | } else { | |
| 2972 | g_free(yd->rxqueue); | |
| 2973 | yd->rxqueue = NULL; | |
| 2974 | yd->rxlen = 0; | |
| 2975 | return; | |
| 2976 | } | |
| 2977 | } | |
| 2978 | ||
| 2681 | 2979 | pos += 4; /* YMSG */ |
| 2980 | pos += 2; | |
| 2981 | pos += 2; | |
| 2982 | ||
| 2983 | pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
2984 | purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen); |
| 2681 | 2985 | |
| 2986 | if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen)) | |
| 2987 | return; | |
| 2988 | ||
| 2989 | yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen); | |
| 2990 | ||
| 2991 | pkt = yahoo_packet_new(0, 0, 0); | |
| 2992 | ||
| 2993 | pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2; | |
| 3021 | 2994 | pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4; |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
2995 | purple_debug_misc("yahoo", "Yahoo Service: 0x%02x Status: %d\n", |
|
5216
13074c9a7ab0
[gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
2996 | pkt->service, pkt->status); |
| 2681 | 2997 | pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4; |
| 2998 | ||
| 2999 | yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen); | |
| 3000 | ||
| 3001 | yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen; | |
| 3002 | if (yd->rxlen) { | |
|
11318
13fa1d5134f3
[gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
11303
diff
changeset
|
3003 | guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen); |
| 2681 | 3004 | g_free(yd->rxqueue); |
| 3005 | yd->rxqueue = tmp; | |
| 3006 | } else { | |
| 3007 | g_free(yd->rxqueue); | |
| 3008 | yd->rxqueue = NULL; | |
| 3009 | } | |
| 3010 | ||
| 3011 | yahoo_packet_process(gc, pkt); | |
| 3012 | ||
| 3013 | yahoo_packet_free(pkt); | |
| 3014 | } | |
| 3015 | } | |
| 3016 | ||
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
3017 | static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message) |
| 2681 | 3018 | { |
| 15884 | 3019 | PurpleConnection *gc = data; |
| 2681 | 3020 | struct yahoo_data *yd; |
| 3021 | struct yahoo_packet *pkt; | |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
3022 | |
| 2681 | 3023 | if (source < 0) { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3024 | gchar *tmp; |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3025 | tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
| 21279 | 3026 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3027 | g_free(tmp); |
| 2681 | 3028 | return; |
| 3029 | } | |
| 3030 | ||
| 3031 | yd = gc->proto_data; | |
| 3032 | yd->fd = source; | |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
3033 | |
|
11078
b611f3a7800c
[gaim-migrate @ 13088]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11077
diff
changeset
|
3034 | pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0); |
| 2681 | 3035 | |
| 15884 | 3036 | yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc)))); |
| 10392 | 3037 | yahoo_packet_send_and_free(pkt, yd); |
| 2681 | 3038 | |
| 15884 | 3039 | gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
| 2681 | 3040 | } |
| 9370 | 3041 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3042 | #ifdef TRY_WEBMESSENGER_LOGIN |
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
3043 | static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message) |
| 7134 | 3044 | { |
| 15884 | 3045 | PurpleConnection *gc = data; |
| 7134 | 3046 | struct yahoo_data *yd; |
| 3047 | struct yahoo_packet *pkt; | |
| 3048 | ||
| 3049 | if (source < 0) { | |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3050 | gchar *tmp; |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3051 | tmp = g_strdup_printf(_("Unable to connect: %s"), error_message); |
| 21279 | 3052 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3053 | g_free(tmp); |
| 7134 | 3054 | return; |
| 3055 | } | |
| 3056 | ||
| 3057 | yd = gc->proto_data; | |
| 3058 | yd->fd = source; | |
| 3059 | ||
| 3060 | pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0); | |
| 3061 | ||
| 10394 | 3062 | yahoo_packet_hash(pkt, "sss", 0, |
| 15884 | 3063 | purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), |
| 3064 | 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))), | |
| 10394 | 3065 | 6, yd->auth); |
| 10392 | 3066 | yahoo_packet_send_and_free(pkt, yd); |
| 3067 | ||
| 7134 | 3068 | g_free(yd->auth); |
| 15884 | 3069 | gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc); |
| 7134 | 3070 | } |
| 3071 | ||
| 15884 | 3072 | static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond) |
| 7134 | 3073 | { |
| 15884 | 3074 | PurpleConnection *gc = data; |
| 3075 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 7134 | 3076 | struct yahoo_data *yd = gc->proto_data; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3077 | char bufread[2048], *i = bufread, *buf = bufread; |
| 8161 | 3078 | int len; |
| 3079 | GString *s; | |
| 7134 | 3080 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3081 | len = read(source, bufread, sizeof(bufread) - 1); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3082 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3083 | if (len < 0) { |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3084 | gchar *tmp; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3085 | |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3086 | if (errno == EAGAIN) |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3087 | /* No worries */ |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3088 | return; |
|
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3089 | |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3090 | tmp = g_strdup_printf(_("Lost connection with server: %s"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21106
diff
changeset
|
3091 | g_strerror(errno)); |
| 21279 | 3092 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3093 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3094 | return; |
|
14488
17cf9193cc88
[gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents:
14453
diff
changeset
|
3095 | } else if (len == 0) { |
| 21279 | 3096 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3097 | _("Server closed the connection")); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3098 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3099 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3100 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3101 | 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
|
3102 | yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3103 | memcpy(yd->rxqueue + yd->rxlen, buf, len); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3104 | yd->rxlen += len; |
| 14321 | 3105 | i = buf = (char *)yd->rxqueue; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3106 | len = yd->rxlen; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3107 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3108 | buf[len] = '\0'; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3109 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3110 | 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
|
3111 | strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) { |
| 21279 | 3112 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3113 | _("Received unexpected HTTP response from server")); |
|
24858
13177815fd88
Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <markdoliner@pidgin.im>
parents:
24855
diff
changeset
|
3114 | purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf); |
| 7134 | 3115 | return; |
| 3116 | } | |
| 8161 | 3117 | |
| 3118 | s = g_string_sized_new(len); | |
| 3119 | ||
| 3120 | while ((i = strstr(i, "Set-Cookie: "))) { | |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3121 | |
| 8161 | 3122 | i += strlen("Set-Cookie: "); |
| 8243 | 3123 | for (;*i != ';' && *i != '\0'; i++) |
| 8161 | 3124 | g_string_append_c(s, *i); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
3125 | |
| 8161 | 3126 | g_string_append(s, "; "); |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3127 | /* Should these cookies be included too when trying for xfer? |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3128 | * It seems to work without these |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3129 | */ |
| 7134 | 3130 | } |
| 8161 | 3131 | |
| 3132 | yd->auth = g_string_free(s, FALSE); | |
| 15884 | 3133 | purple_input_remove(gc->inpa); |
| 7134 | 3134 | close(source); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3135 | g_free(yd->rxqueue); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3136 | yd->rxqueue = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3137 | yd->rxlen = 0; |
| 7134 | 3138 | /* Now we have our cookies to login with. I'll go get the milk. */ |
| 15884 | 3139 | if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com", |
|
20460
5282ce7ac330
Add disconnection reasons to yahoo
Will Thompson <resiak@pidgin.im>
parents:
19918
diff
changeset
|
3140 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
|
5282ce7ac330
Add disconnection reasons to yahoo
Will Thompson <resiak@pidgin.im>
parents:
19918
diff
changeset
|
3141 | yahoo_got_web_connected, gc) == NULL) { |
| 21279 | 3142 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3143 | _("Unable to connect")); |
| 7134 | 3144 | return; |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
3145 | } |
| 7134 | 3146 | } |
| 3147 | ||
| 15884 | 3148 | static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond) |
| 7134 | 3149 | { |
| 15884 | 3150 | PurpleConnection *gc; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3151 | struct yahoo_data *yd; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3152 | int written, remaining; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3153 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3154 | gc = data; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3155 | yd = gc->proto_data; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3156 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3157 | remaining = strlen(yd->auth) - yd->auth_written; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3158 | written = write(source, yd->auth + yd->auth_written, remaining); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3159 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3160 | if (written < 0 && errno == EAGAIN) |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3161 | written = 0; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3162 | else if (written <= 0) { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3163 | gchar *tmp; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3164 | g_free(yd->auth); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3165 | yd->auth = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3166 | if (gc->inpa) |
| 15884 | 3167 | purple_input_remove(gc->inpa); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3168 | gc->inpa = 0; |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3169 | tmp = g_strdup_printf(_("Lost connection with %s: %s"), |
|
21389
e1dd8142bb87
replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents:
21106
diff
changeset
|
3170 | "login.yahoo.com:80", g_strerror(errno)); |
| 21279 | 3171 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3172 | g_free(tmp); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3173 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3174 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3175 | |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3176 | if (written < remaining) { |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3177 | yd->auth_written += written; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3178 | return; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3179 | } |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3180 | |
| 7134 | 3181 | g_free(yd->auth); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3182 | yd->auth = NULL; |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3183 | yd->auth_written = 0; |
| 15884 | 3184 | purple_input_remove(gc->inpa); |
| 3185 | gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc); | |
| 7134 | 3186 | } |
| 3187 | ||
|
14182
517f4531b8a0
[gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents:
14170
diff
changeset
|
3188 | 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
|
3189 | { |
| 15884 | 3190 | PurpleConnection *gc = data; |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3191 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3192 | if (source < 0) { |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3193 | gchar *tmp; |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3194 | tmp = g_strdup_printf(_("Unable to establish a connection with %s: %s"), |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3195 | "login.yahoo.com:80", error_message); |
| 21279 | 3196 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp); |
|
17540
460543cd1004
Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents:
17151
diff
changeset
|
3197 | g_free(tmp); |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3198 | return; |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3199 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3200 | |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3201 | if (gc->inpa == 0) |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3202 | { |
| 15884 | 3203 | gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE, |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3204 | yahoo_got_cookies_send_cb, gc); |
| 15884 | 3205 | yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE); |
|
14146
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3206 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3207 | } |
|
4413802cb7a9
[gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents:
14133
diff
changeset
|
3208 | |
| 7134 | 3209 | static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url) |
| 3210 | { | |
|
24858
13177815fd88
Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <markdoliner@pidgin.im>
parents:
24855
diff
changeset
|
3211 | if (!strcmp(key, "passwd") || !strcmp(key, "login")) |
| 7134 | 3212 | return; |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3213 | g_string_append_c(url, '&'); |
|
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3214 | g_string_append(url, key); |
|
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3215 | g_string_append_c(url, '='); |
| 7134 | 3216 | if (!strcmp(key, ".save") || !strcmp(key, ".js")) |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3217 | g_string_append_c(url, '1'); |
| 7134 | 3218 | else if (!strcmp(key, ".challenge")) |
|
13713
1ae8790174a4
[gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents:
13707
diff
changeset
|
3219 | g_string_append(url, val); |
| 7134 | 3220 | else |
| 15884 | 3221 | g_string_append(url, purple_url_encode(val)); |
| 7134 | 3222 | } |
| 3223 | ||
| 3224 | static GHashTable *yahoo_login_page_hash(const char *buf, size_t len) | |
| 3225 | { | |
| 3226 | 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
|
3227 | const char *c = buf; |
|
12b7979bce6e
[gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents:
7134
diff
changeset
|
3228 | char *d; |
| 7134 | 3229 | char name[64], value[64]; |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3230 | int count; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3231 | int input_len = strlen("<input "); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3232 | int name_len = strlen("name=\""); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3233 | int value_len = strlen("value=\""); |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3234 | while ((len > ((c - buf) + input_len)) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3235 | && (c = strstr(c, "<input "))) { |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3236 | if (!(c = g_strstr_len(c, len - (c - buf), "name=\""))) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3237 | continue; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3238 | c += name_len; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3239 | count = sizeof(name)-1; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3240 | for (d = name; (len > ((c - buf) + 1)) && *c!='"' |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3241 | && count; c++, d++, count--) |
| 7134 | 3242 | *d = *c; |
| 3243 | *d = '\0'; | |
|
8118
7f5315bb4506
[gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents:
8113
diff
changeset
|
3244 | count = sizeof(value)-1; |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3245 | if (!(d = g_strstr_len(c, len - (c - buf), "value=\""))) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3246 | continue; |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3247 | d += value_len; |
| 7134 | 3248 | if (strchr(c, '>') < d) |
| 3249 | break; | |
|
11188
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3250 | for (c = d, d = value; (len > ((c - buf) + 1)) |
|
71daefd15649
[gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents:
11183
diff
changeset
|
3251 | && *c!='"' && count; c++, d++, count--) |
| 7134 | 3252 | *d = *c; |
| 3253 | *d = '\0'; | |
| 3254 | g_hash_table_insert(hash, g_strdup(name), g_strdup(value)); | |
| 3255 | } | |
| 3256 | return hash; | |
| 3257 | } | |
| 3258 | ||
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3259 | static void |
| 15884 | 3260 | yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3261 | const gchar *url_text, size_t len, const gchar *error_message) |
| 7134 | 3262 | { |
| 15884 | 3263 | PurpleConnection *gc = (PurpleConnection *)user_data; |
| 3264 | PurpleAccount *account = purple_connection_get_account(gc); | |
| 7134 | 3265 | struct yahoo_data *yd = gc->proto_data; |
| 15884 | 3266 | const char *sn = purple_account_get_username(account); |
| 3267 | const char *pass = purple_connection_get_password(gc); | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3268 | GHashTable *hash = yahoo_login_page_hash(url_text, len); |
|
10575
f360d2dc8a1c
[gaim-migrate @ 11968]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10553
diff
changeset
|
3269 | GString *url = g_string_new("GET http://login.yahoo.com/config/login?login="); |
| 7134 | 3270 | char md5[33], *hashp = md5, *chal; |
| 3271 | int i; | |
| 15884 | 3272 | PurpleCipher *cipher; |
| 3273 | PurpleCipherContext *context; | |
|
11183
be87fe695c93
[gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents:
11180
diff
changeset
|
3274 | guchar digest[16]; |
|
7191
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
3275 | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3276 | yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3277 | |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3278 | if (error_message != NULL) |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3279 | { |
| 21279 | 3280 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
20460
5282ce7ac330
Add disconnection reasons to yahoo
Will Thompson <resiak@pidgin.im>
parents:
19918
diff
changeset
|
3281 | error_message); |
|
15807
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3282 | return; |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3283 | } |
|
a075bef0d8dd
Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents:
15685
diff
changeset
|
3284 | |
|
7191
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
3285 | url = g_string_append(url, sn); |
|
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
3286 | url = g_string_append(url, "&passwd="); |
|
6c67ab87df26
[gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents:
7161
diff
changeset
|
3287 | |
| 15884 | 3288 | cipher = purple_ciphers_find_cipher("md5"); |
| 3289 | context = purple_cipher_context_new(cipher, NULL); | |
| 3290 | ||
| 3291 | purple_cipher_context_append(context, (const guchar *)pass, strlen(pass)); | |
| 3292 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 3293 | for (i = 0; i < 16; ++i) { |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3294 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 3295 | hashp += 2; |
| 3296 | } | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3297 | |
| 7134 | 3298 | chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL); |
| 15884 | 3299 | purple_cipher_context_reset(context, NULL); |
| 3300 | purple_cipher_context_append(context, (const guchar *)chal, strlen(chal)); | |
| 3301 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 3302 | hashp = md5; |
| 3303 | for (i = 0; i < 16; ++i) { | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3304 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 3305 | hashp += 2; |
| 3306 | } | |
| 3307 | /* | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3308 | * 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
|
3309 | * I updated it.. |
|
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3310 | |
| 15884 | 3311 | purple_cipher_context_reset(context, NULL); |
| 3312 | purple_cipher_context_append(context, md5, strlen(md5)); | |
| 3313 | purple_cipher_context_digest(context, sizeof(digest), digest, NULL); | |
| 7134 | 3314 | hashp = md5; |
| 3315 | for (i = 0; i < 16; ++i) { | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3316 | g_snprintf(hashp, 3, "%02x", digest[i]); |
| 7134 | 3317 | hashp += 2; |
| 3318 | } | |
| 3319 | */ | |
| 3320 | g_free(chal); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
3321 | |
| 7134 | 3322 | url = g_string_append(url, md5); |
|
7138
12b7979bce6e
[gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents:
7134
diff
changeset
|
3323 | 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
|
3324 | |
| 7134 | 3325 | url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n" |
| 3326 | "Host: login.yahoo.com\r\n\r\n"); | |
| 3327 | g_hash_table_destroy(hash); | |
| 3328 | yd->auth = g_string_free(url, FALSE); | |
| 15884 | 3329 | if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) { |
| 21279 | 3330 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3331 | _("Unable to connect")); |
| 7134 | 3332 | return; |
| 3333 | } | |
|
10684
0325b164a7eb
[gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents:
10662
diff
changeset
|
3334 | |
| 15884 | 3335 | purple_cipher_context_destroy(context); |
| 7134 | 3336 | } |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
3337 | #endif /* TRY_WEBMESSENGER_LOGIN */ |
| 7134 | 3338 | |
| 15884 | 3339 | static void yahoo_server_check(PurpleAccount *account) |
| 7883 | 3340 | { |
| 3341 | const char *server; | |
| 3342 | ||
| 15884 | 3343 | server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST); |
| 7883 | 3344 | |
|
27396
9e19aff0bf0b
Update the Pager server at login to the new default if "" or old default.
Paul Aurich <darkrain42@pidgin.im>
parents:
27393
diff
changeset
|
3345 | if (*server == '\0' || g_str_equal(server, "scs.yahoo.com") || |
|
9e19aff0bf0b
Update the Pager server at login to the new default if "" or old default.
Paul Aurich <darkrain42@pidgin.im>
parents:
27393
diff
changeset
|
3346 | g_str_equal(server, "scs.msg.yahoo.com")) |
| 15884 | 3347 | purple_account_set_string(account, "server", YAHOO_PAGER_HOST); |
| 7883 | 3348 | } |
| 9306 | 3349 | |
| 15884 | 3350 | static void yahoo_picture_check(PurpleAccount *account) |
| 9306 | 3351 | { |
| 15884 | 3352 | 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
|
3353 | 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
|
3354 | |
|
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
|
3355 | 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
|
3356 | purple_imgstore_unref(img); |
| 9306 | 3357 | } |
| 3358 | ||
| 15884 | 3359 | static int get_yahoo_status_from_purple_status(PurpleStatus *status) |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3360 | { |
| 15884 | 3361 | PurplePresence *presence; |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3362 | const char *status_id; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3363 | const char *msg; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3364 | |
| 15884 | 3365 | presence = purple_status_get_presence(status); |
| 3366 | status_id = purple_status_get_id(status); | |
| 3367 | msg = purple_status_get_attr_string(status, "message"); | |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3368 | |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3369 | if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3370 | if ((msg != NULL) && (*msg != '\0')) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3371 | return YAHOO_STATUS_CUSTOM; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3372 | else |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3373 | return YAHOO_STATUS_AVAILABLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3374 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3375 | return YAHOO_STATUS_BRB; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3376 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3377 | return YAHOO_STATUS_BUSY; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3378 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3379 | return YAHOO_STATUS_NOTATHOME; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3380 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3381 | return YAHOO_STATUS_NOTATDESK; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3382 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3383 | return YAHOO_STATUS_NOTINOFFICE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3384 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3385 | return YAHOO_STATUS_ONPHONE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3386 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3387 | return YAHOO_STATUS_ONVACATION; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3388 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3389 | return YAHOO_STATUS_OUTTOLUNCH; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3390 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3391 | return YAHOO_STATUS_STEPPEDOUT; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3392 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3393 | return YAHOO_STATUS_INVISIBLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3394 | } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) { |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3395 | return YAHOO_STATUS_CUSTOM; |
| 15884 | 3396 | } else if (purple_presence_is_idle(presence)) { |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3397 | return YAHOO_STATUS_IDLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3398 | } else { |
| 15884 | 3399 | purple_debug_error("yahoo", "Unexpected PurpleStatus!\n"); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3400 | return YAHOO_STATUS_AVAILABLE; |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3401 | } |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3402 | } |
| 7883 | 3403 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3404 | void yahoo_login(PurpleAccount *account) { |
| 15884 | 3405 | PurpleConnection *gc = purple_account_get_connection(account); |
| 2681 | 3406 | struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
| 15884 | 3407 | PurpleStatus *status = purple_account_get_active_status(account); |
| 3408 | gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC; | |
| 3409 | ||
| 3410 | purple_connection_update_progress(gc, _("Connecting"), 1, 2); | |
| 3411 | ||
| 3412 | purple_connection_set_display_name(gc, purple_account_get_username(account)); | |
| 8235 | 3413 | |
|
26363
63cb37543cbf
set fd to -1 initially, if not done, no p2p connection is initiated ever.
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26362
diff
changeset
|
3414 | yd->yahoo_local_p2p_server_fd = -1; |
| 2681 | 3415 | 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
|
3416 | yd->txhandler = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3417 | /* TODO: Is there a good grow size for the buffer? */ |
| 15884 | 3418 | yd->txbuf = purple_circ_buffer_new(0); |
| 6784 | 3419 | 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
|
3420 | yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
22204
78dc320dad31
Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22202
diff
changeset
|
3421 | yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3422 | yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_p2p_disconnect_destroy_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3423 | yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3424 | yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, yahoo_p2p_keepalive, gc); |
| 6729 | 3425 | yd->confs = NULL; |
| 3426 | yd->conf_id = 2; | |
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
3427 | yd->last_keepalive = yd->last_ping = time(NULL); |
|
11076
f6c4835e68ee
[gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents:
11043
diff
changeset
|
3428 | |
| 15884 | 3429 | yd->current_status = get_yahoo_status_from_purple_status(status); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
3430 | |
| 7883 | 3431 | yahoo_server_check(account); |
| 9306 | 3432 | yahoo_picture_check(account); |
| 7883 | 3433 | |
|
27561
86add5f08943
Correctly determine if the prpl calling a given function is the Yahoo! JAPAN
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27560
diff
changeset
|
3434 | if (yahoo_is_japan(account)) { |
| 9164 | 3435 | yd->jp = TRUE; |
| 15884 | 3436 | if (purple_proxy_connect(gc, account, |
|
27558
5791909ea26d
I believe this will correctly handle setting the yd->jp value under the new
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27557
diff
changeset
|
3437 | purple_account_get_string(account, "server", YAHOOJP_PAGER_HOST), |
| 15884 | 3438 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
3439 | yahoo_got_connected, gc) == NULL) |
| 9164 | 3440 | { |
| 21279 | 3441 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3442 | _("Unable to connect")); |
| 9164 | 3443 | return; |
| 3444 | } | |
| 3445 | } else { | |
| 3446 | yd->jp = FALSE; | |
| 15884 | 3447 | if (purple_proxy_connect(gc, account, |
| 3448 | purple_account_get_string(account, "server", YAHOO_PAGER_HOST), | |
| 3449 | purple_account_get_int(account, "port", YAHOO_PAGER_PORT), | |
|
14170
f611621bc8a0
[gaim-migrate @ 16742]
Mark Doliner <markdoliner@pidgin.im>
parents:
14151
diff
changeset
|
3450 | yahoo_got_connected, gc) == NULL) |
| 9164 | 3451 | { |
| 21279 | 3452 | purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, |
|
27635
0cd19038c417
More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents:
27547
diff
changeset
|
3453 | _("Unable to connect")); |
| 9164 | 3454 | return; |
| 3455 | } | |
| 2681 | 3456 | } |
| 3457 | } | |
| 3458 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3459 | void yahoo_close(PurpleConnection *gc) { |
| 2681 | 3460 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 9782 | 3461 | GSList *l; |
| 3462 | ||
| 11608 | 3463 | if (gc->inpa) |
| 15884 | 3464 | purple_input_remove(gc->inpa); |
| 11608 | 3465 | |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3466 | while (yd->url_datas) { |
| 15884 | 3467 | purple_util_fetch_url_cancel(yd->url_datas->data); |
|
14416
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3468 | 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
|
3469 | } |
|
c95ffd983a39
[gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents:
14378
diff
changeset
|
3470 | |
| 9782 | 3471 | for (l = yd->confs; l; l = l->next) { |
| 15884 | 3472 | PurpleConversation *conv = l->data; |
| 3473 | ||
| 3474 | yahoo_conf_leave(yd, purple_conversation_get_name(conv), | |
| 3475 | purple_connection_get_display_name(gc), | |
| 3476 | purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv))); | |
| 9782 | 3477 | } |
| 3478 | g_slist_free(yd->confs); | |
| 6729 | 3479 | |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3480 | for (l = yd->cookies; l; l = l->next) { |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3481 | g_free(l->data); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3482 | l->data=NULL; |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3483 | } |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3484 | g_slist_free(yd->cookies); |
|
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3485 | |
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
3486 | yd->chat_online = FALSE; |
|
12841
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
3487 | if (yd->in_chat) |
|
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
3488 | yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */ |
|
939ceff2a3ba
[gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents:
12798
diff
changeset
|
3489 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3490 | purple_timeout_remove(yd->yahoo_p2p_timer); |
|
26888
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3491 | if(yd->yahoo_p2p_server_timeout_handle != 0) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3492 | purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle); |
|
26888
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3493 | yd->yahoo_p2p_server_timeout_handle = 0; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3494 | } |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3495 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3496 | /* close p2p server if it is waiting for a peer to connect */ |
|
26888
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3497 | if (yd->yahoo_p2p_server_watcher) { |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3498 | purple_input_remove(yd->yahoo_p2p_server_watcher); |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3499 | yd->yahoo_p2p_server_watcher = 0; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3500 | } |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3501 | if (yd->yahoo_local_p2p_server_fd >= 0) { |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3502 | close(yd->yahoo_local_p2p_server_fd); |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3503 | yd->yahoo_local_p2p_server_fd = -1; |
|
acbf9c5429f9
Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
26799
diff
changeset
|
3504 | } |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3505 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3506 | g_hash_table_destroy(yd->sms_carrier); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
3507 | g_hash_table_destroy(yd->peers); |
| 6784 | 3508 | g_hash_table_destroy(yd->friends); |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
3509 | g_hash_table_destroy(yd->imvironments); |
|
22202
e42ab2e3eba1
This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents:
22201
diff
changeset
|
3510 | g_hash_table_destroy(yd->xfer_peer_idstring_map); |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3511 | g_free(yd->chat_name); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3512 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3513 | g_free(yd->cookie_y); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3514 | g_free(yd->cookie_t); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3515 | |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3516 | if (yd->txhandler) |
| 15884 | 3517 | purple_input_remove(yd->txhandler); |
| 3518 | ||
| 3519 | purple_circ_buffer_destroy(yd->txbuf); | |
| 7651 | 3520 | |
| 2681 | 3521 | if (yd->fd >= 0) |
| 3522 | close(yd->fd); | |
|
3720
dbba62e0d603
[gaim-migrate @ 3853]
Herman Bloggs <herman@bluedigits.com>
parents:
3642
diff
changeset
|
3523 | |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3524 | g_free(yd->rxqueue); |
|
2687
664e22f507cf
[gaim-migrate @ 2700]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2686
diff
changeset
|
3525 | yd->rxlen = 0; |
|
13201
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3526 | g_free(yd->picture_url); |
|
8c224ef70efa
[gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents:
13107
diff
changeset
|
3527 | |
|
14693
9e3d4f9609e1
[gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents:
14604
diff
changeset
|
3528 | if (yd->buddy_icon_connect_data) |
| 15884 | 3529 | purple_proxy_connect_cancel(yd->buddy_icon_connect_data); |
| 9306 | 3530 | if (yd->picture_upload_todo) |
| 3531 | yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo); | |
| 9376 | 3532 | if (yd->ycht) |
| 3533 | ycht_connection_close(yd->ycht); | |
| 11608 | 3534 | |
|
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
|
3535 | 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
|
3536 | 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
|
3537 | 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
|
3538 | g_free(yd->pending_chat_goto); |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
3539 | g_strfreev(yd->profiles); |
|
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
|
3540 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
3541 | yahoo_personal_details_reset(&yd->ypd); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
3542 | |
|
22552
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
3543 | g_free(yd->current_list15_grp); |
|
21bcf7de74f1
Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents:
22462
diff
changeset
|
3544 | |
| 2681 | 3545 | g_free(yd); |
|
13344
fde4e6dc84f8
[gaim-migrate @ 15713]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13297
diff
changeset
|
3546 | gc->proto_data = NULL; |
| 2681 | 3547 | } |
| 3548 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3549 | const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b) |
| 2681 | 3550 | { |
| 4687 | 3551 | return "yahoo"; |
| 2681 | 3552 | } |
| 4916 | 3553 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3554 | const char *yahoo_list_emblem(PurpleBuddy *b) |
| 4916 | 3555 | { |
| 15884 | 3556 | PurpleAccount *account; |
| 3557 | PurpleConnection *gc; | |
| 6784 | 3558 | struct yahoo_data *yd; |
| 9278 | 3559 | YahooFriend *f; |
| 15884 | 3560 | PurplePresence *presence; |
| 3561 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3562 | if (!b || !(account = purple_buddy_get_account(b)) || |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3563 | !(gc = purple_account_get_connection(account)) || |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3564 | !(yd = gc->proto_data)) |
|
15558
6fb7a0ad8a0b
clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents:
15524
diff
changeset
|
3565 | return NULL; |
| 6784 | 3566 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3567 | f = yahoo_friend_find(gc, purple_buddy_get_name(b)); |
| 6784 | 3568 | if (!f) { |
| 15524 | 3569 | return "not-authorized"; |
| 6784 | 3570 | } |
| 3571 | ||
| 15884 | 3572 | presence = purple_buddy_get_presence(b); |
| 3573 | ||
| 3574 | if (purple_presence_is_online(presence)) { | |
| 9283 | 3575 | if (yahoo_friend_get_game(f)) |
| 15524 | 3576 | return "game"; |
| 14366 | 3577 | if (f->protocol == 2) |
| 15524 | 3578 | return "msn"; |
| 4916 | 3579 | } |
| 15524 | 3580 | return NULL; |
| 4916 | 3581 | } |
| 2681 | 3582 | |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3583 | static const char *yahoo_get_status_string(enum yahoo_status a) |
| 2681 | 3584 | { |
| 3585 | switch (a) { | |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3586 | case YAHOO_STATUS_BRB: |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3587 | return _("Be Right Back"); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3588 | case YAHOO_STATUS_BUSY: |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3589 | return _("Busy"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3590 | case YAHOO_STATUS_NOTATHOME: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3591 | return _("Not at Home"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3592 | case YAHOO_STATUS_NOTATDESK: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3593 | return _("Not at Desk"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3594 | case YAHOO_STATUS_NOTINOFFICE: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3595 | return _("Not in Office"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3596 | case YAHOO_STATUS_ONPHONE: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3597 | return _("On the Phone"); |
|
12206
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3598 | case YAHOO_STATUS_ONVACATION: |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3599 | return _("On Vacation"); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
3600 | case YAHOO_STATUS_OUTTOLUNCH: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3601 | return _("Out to Lunch"); |
|
12203
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3602 | case YAHOO_STATUS_STEPPEDOUT: |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
3603 | return _("Stepped Out"); |
|
2873
9e56887eeb06
[gaim-migrate @ 2886]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2856
diff
changeset
|
3604 | case YAHOO_STATUS_INVISIBLE: |
|
4596
64e72bf4ece4
[gaim-migrate @ 4881]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents:
4491
diff
changeset
|
3605 | return _("Invisible"); |
| 4730 | 3606 | case YAHOO_STATUS_IDLE: |
| 3607 | return _("Idle"); | |
| 6784 | 3608 | case YAHOO_STATUS_OFFLINE: |
| 3609 | return _("Offline"); | |
|
2879
e417cf7111c4
[gaim-migrate @ 2892]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
2878
diff
changeset
|
3610 | default: |
|
12467
94948d1eb8cf
[gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents:
12417
diff
changeset
|
3611 | return _("Available"); |
| 2681 | 3612 | } |
| 3613 | } | |
| 3614 | ||
| 15884 | 3615 | static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) { |
| 3616 | ||
| 3617 | PurpleBuddy *buddy; | |
| 3618 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3619 | |
| 6729 | 3620 | GHashTable *components; |
| 3621 | struct yahoo_data *yd; | |
| 3622 | int id; | |
| 3623 | ||
| 15884 | 3624 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 3625 | ||
| 3626 | buddy = (PurpleBuddy *) node; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3627 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
| 6729 | 3628 | yd = gc->proto_data; |
| 3629 | id = yd->conf_id; | |
| 3630 | ||
| 3631 | components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 3632 | g_hash_table_replace(components, g_strdup("room"), | |
| 15884 | 3633 | g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id)); |
| 6729 | 3634 | g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference...")); |
| 3635 | g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference")); | |
| 3636 | yahoo_c_join(gc, components); | |
| 3637 | g_hash_table_destroy(components); | |
| 3638 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3639 | yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy)); |
| 6729 | 3640 | } |
| 3641 | ||
| 15884 | 3642 | static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) { |
| 3643 | PurpleBuddy *buddy; | |
| 3644 | PurpleConnection *gc; | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3645 | int presence_val = GPOINTER_TO_INT(data); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3646 | |
| 15884 | 3647 | buddy = (PurpleBuddy *) node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3648 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3649 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3650 | yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3651 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3652 | |
| 15884 | 3653 | static void yahoo_game(PurpleBlistNode *node, gpointer data) { |
| 3654 | ||
| 3655 | PurpleBuddy *buddy; | |
| 3656 | PurpleConnection *gc; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3657 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3658 | struct yahoo_data *yd; |
| 9283 | 3659 | const char *game; |
| 3660 | char *game2; | |
| 3019 | 3661 | char *t; |
| 3662 | char url[256]; | |
| 9278 | 3663 | YahooFriend *f; |
| 3019 | 3664 | |
| 15884 | 3665 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); |
| 3666 | ||
| 3667 | buddy = (PurpleBuddy *) node; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3668 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3669 | yd = (struct yahoo_data *) gc->proto_data; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3670 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3671 | f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
| 6784 | 3672 | if (!f) |
| 3673 | return; | |
| 3674 | ||
| 9283 | 3675 | game = yahoo_friend_get_game(f); |
| 3019 | 3676 | if (!game) |
| 3677 | return; | |
| 6784 | 3678 | |
| 9283 | 3679 | t = game2 = g_strdup(strstr(game, "ante?room=")); |
| 3680 | while (*t && *t != '\t') | |
| 3019 | 3681 | t++; |
| 3682 | *t = 0; | |
| 9283 | 3683 | g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2); |
| 15884 | 3684 | purple_notify_uri(gc, url); |
| 9283 | 3685 | g_free(game2); |
| 3019 | 3686 | } |
| 4722 | 3687 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3688 | char *yahoo_status_text(PurpleBuddy *b) |
| 4722 | 3689 | { |
| 9278 | 3690 | YahooFriend *f = NULL; |
| 9283 | 3691 | const char *msg; |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3692 | char *msg2; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3693 | PurpleAccount *account; |
|
27682
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3694 | PurpleConnection *gc; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3695 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3696 | account = purple_buddy_get_account(b); |
|
27682
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3697 | gc = purple_account_get_connection(account); |
|
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3698 | if (!gc || !purple_connection_get_protocol_data(gc)) |
|
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3699 | return NULL; |
|
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3700 | |
|
05810ff93040
yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents:
27681
diff
changeset
|
3701 | f = yahoo_friend_find(gc, purple_buddy_get_name(b)); |
| 6784 | 3702 | if (!f) |
| 3703 | return g_strdup(_("Not on server list")); | |
| 3704 | ||
| 3705 | switch (f->status) { | |
| 3706 | case YAHOO_STATUS_AVAILABLE: | |
| 3707 | return NULL; | |
| 3708 | case YAHOO_STATUS_IDLE: | |
| 3709 | if (f->idle == -1) | |
| 3710 | return g_strdup(yahoo_get_status_string(f->status)); | |
| 3711 | return NULL; | |
| 3712 | case YAHOO_STATUS_CUSTOM: | |
| 9283 | 3713 | if (!(msg = yahoo_friend_get_status_message(f))) |
| 6784 | 3714 | return NULL; |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3715 | msg2 = g_markup_escape_text(msg, strlen(msg)); |
| 15884 | 3716 | purple_util_chrreplace(msg2, '\n', ' '); |
|
11920
be80617ec59b
[gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
11914
diff
changeset
|
3717 | return msg2; |
| 9224 | 3718 | |
| 6784 | 3719 | default: |
| 3720 | return g_strdup(yahoo_get_status_string(f->status)); | |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
3721 | } |
| 4722 | 3722 | } |
| 3723 | ||
| 15884 | 3724 | void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full) |
| 4724 | 3725 | { |
| 9278 | 3726 | YahooFriend *f; |
|
13107
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3727 | char *escaped; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3728 | char *status = NULL; |
|
704041197f4d
[gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents:
13041
diff
changeset
|
3729 | const char *presence = NULL; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3730 | PurpleAccount *account; |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3731 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3732 | account = purple_buddy_get_account(b); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3733 | f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b)); |
| 6784 | 3734 | if (!f) |
|
8591
ae42ad1cd127
[gaim-migrate @ 9342]
Mark Doliner <markdoliner@pidgin.im>
parents:
8589
diff
changeset
|
3735 | status = g_strdup_printf("\n%s", _("Not on server list")); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3736 | else { |
| 6784 | 3737 | switch (f->status) { |
| 3738 | case YAHOO_STATUS_CUSTOM: | |
| 9283 | 3739 | if (!yahoo_friend_get_status_message(f)) |
|
12970
c2f3b4dcf711
[gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents:
12945
diff
changeset
|
3740 | return; |
| 9283 | 3741 | status = g_strdup(yahoo_friend_get_status_message(f)); |
| 6784 | 3742 | break; |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3743 | case YAHOO_STATUS_OFFLINE: |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3744 | break; |
| 6784 | 3745 | default: |
| 3746 | status = g_strdup(yahoo_get_status_string(f->status)); | |
| 3747 | break; | |
| 4745 | 3748 | } |
| 6784 | 3749 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3750 | switch (f->presence) { |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3751 | case YAHOO_PRESENCE_ONLINE: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3752 | presence = _("Appear Online"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3753 | break; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3754 | case YAHOO_PRESENCE_PERM_OFFLINE: |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3755 | presence = _("Appear Permanently Offline"); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3756 | break; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3757 | case YAHOO_PRESENCE_DEFAULT: |
|
12945
69f429d29451
[gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
3758 | break; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3759 | default: |
| 15884 | 3760 | 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
|
3761 | break; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3762 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3763 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3764 | |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3765 | if (status != NULL) { |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3766 | escaped = g_markup_escape_text(status, strlen(status)); |
| 15884 | 3767 | purple_notify_user_info_add_pair(user_info, _("Status"), escaped); |
|
10992
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3768 | g_free(status); |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3769 | g_free(escaped); |
|
ccf59743dae4
[gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents:
10989
diff
changeset
|
3770 | } |
| 6784 | 3771 | |
|
12945
69f429d29451
[gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents:
12943
diff
changeset
|
3772 | if (presence != NULL) |
| 15884 | 3773 | purple_notify_user_info_add_pair(user_info, _("Presence"), presence); |
| 4729 | 3774 | } |
| 3775 | ||
| 15884 | 3776 | static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3777 | { |
| 15884 | 3778 | PurpleBuddy *buddy; |
| 3779 | PurpleConnection *gc; | |
| 3780 | ||
| 3781 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | |
| 3782 | ||
| 3783 | buddy = (PurpleBuddy *) node; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3784 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3785 | |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
3786 | yahoo_add_buddy(gc, buddy, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3787 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3788 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3789 | |
| 15884 | 3790 | static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data) |
| 6796 | 3791 | { |
| 15884 | 3792 | PurpleBuddy *buddy; |
| 3793 | PurpleConnection *gc; | |
| 3794 | ||
| 3795 | g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node)); | |
| 3796 | ||
| 3797 | buddy = (PurpleBuddy *) node; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3798 | gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3799 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3800 | yahoo_chat_goto(gc, purple_buddy_get_name(buddy)); |
| 6796 | 3801 | } |
| 3802 | ||
| 15884 | 3803 | static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) { |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3804 | GList *m = NULL; |
| 15884 | 3805 | PurpleMenuAction *act; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3806 | struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3807 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3808 | if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3809 | if (f->presence != YAHOO_PRESENCE_ONLINE) { |
| 15884 | 3810 | act = purple_menu_action_new(_("Appear Online"), |
| 3811 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3812 | GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE), |
| 3813 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3814 | m = g_list_append(m, act); |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3815 | } else if (f->presence != YAHOO_PRESENCE_DEFAULT) { |
| 15884 | 3816 | act = purple_menu_action_new(_("Appear Offline"), |
| 3817 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3818 | GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
| 3819 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3820 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3821 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3822 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3823 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
3824 | if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) { |
| 15884 | 3825 | act = purple_menu_action_new(_("Don't Appear Permanently Offline"), |
| 3826 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3827 | GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT), |
| 3828 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3829 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3830 | } else { |
| 15884 | 3831 | act = purple_menu_action_new(_("Appear Permanently Offline"), |
| 3832 | PURPLE_CALLBACK(yahoo_presence_settings), | |
| 13021 | 3833 | GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE), |
| 3834 | NULL); | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3835 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3836 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3837 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3838 | return m; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3839 | } |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3840 | |
| 15884 | 3841 | 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
|
3842 | { |
| 15884 | 3843 | PurpleBuddy *b = (PurpleBuddy *)node; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3844 | PurpleAccount *account = purple_buddy_get_account(b); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3845 | PurpleConnection *gc = purple_account_get_connection(account); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3846 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3847 | yahoo_doodle_initiate(gc, purple_buddy_get_name(b)); |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3848 | } |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3849 | |
| 15884 | 3850 | static GList *yahoo_buddy_menu(PurpleBuddy *buddy) |
| 2681 | 3851 | { |
| 3852 | GList *m = NULL; | |
| 15884 | 3853 | PurpleMenuAction *act; |
| 3854 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3855 | PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy)); |
| 9370 | 3856 | struct yahoo_data *yd = gc->proto_data; |
| 3019 | 3857 | static char buf2[1024]; |
| 9278 | 3858 | YahooFriend *f; |
| 6784 | 3859 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
3860 | f = yahoo_friend_find(gc, purple_buddy_get_name(buddy)); |
| 6784 | 3861 | |
| 9370 | 3862 | if (!f && !yd->wm) { |
| 15884 | 3863 | act = purple_menu_action_new(_("Add Buddy"), |
| 3864 | PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb), | |
| 12919 | 3865 | NULL, NULL); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3866 | m = g_list_append(m, act); |
| 6784 | 3867 | |
| 3868 | return m; | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3869 | |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3870 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3871 | |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3872 | if (f && f->status != YAHOO_STATUS_OFFLINE) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3873 | if (!yd->wm) { |
| 15884 | 3874 | act = purple_menu_action_new(_("Join in Chat"), |
| 3875 | PURPLE_CALLBACK(yahoo_chat_goto_menu), | |
| 12919 | 3876 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3877 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3878 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3879 | |
| 15884 | 3880 | act = purple_menu_action_new(_("Initiate Conference"), |
| 3881 | PURPLE_CALLBACK(yahoo_initiate_conference), | |
| 12919 | 3882 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3883 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3884 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3885 | if (yahoo_friend_get_game(f)) { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3886 | const char *game = yahoo_friend_get_game(f); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3887 | char *room; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3888 | char *t; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3889 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3890 | if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3891 | while (*room && *room != '\t') /* skip to the tab */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3892 | room++; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3893 | t = room++; /* room as now at the name */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3894 | while (*t != '\n') |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3895 | t++; /* replace the \n with a space */ |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3896 | *t = ' '; |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3897 | g_snprintf(buf2, sizeof buf2, "%s", room); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3898 | |
| 15884 | 3899 | act = purple_menu_action_new(buf2, |
| 3900 | PURPLE_CALLBACK(yahoo_game), | |
| 12919 | 3901 | NULL, NULL); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3902 | m = g_list_append(m, act); |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3903 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3904 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3905 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3906 | |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
3907 | if (f) { |
| 15884 | 3908 | act = purple_menu_action_new(_("Presence Settings"), NULL, NULL, |
| 12919 | 3909 | build_presence_submenu(f, gc)); |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3910 | m = g_list_append(m, act); |
| 3019 | 3911 | } |
| 6729 | 3912 | |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3913 | if (f) { |
| 15884 | 3914 | act = purple_menu_action_new(_("Start Doodling"), |
| 3915 | PURPLE_CALLBACK(yahoo_doodle_blist_node), | |
| 12919 | 3916 | NULL, NULL); |
|
11800
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3917 | m = g_list_append(m, act); |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3918 | } |
|
622741e6201c
[gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11718
diff
changeset
|
3919 | |
| 2681 | 3920 | return m; |
| 3921 | } | |
| 3922 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
3923 | GList *yahoo_blist_node_menu(PurpleBlistNode *node) |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3924 | { |
| 15884 | 3925 | if(PURPLE_BLIST_NODE_IS_BUDDY(node)) { |
| 3926 | return yahoo_buddy_menu((PurpleBuddy *) node); | |
|
9030
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3927 | } else { |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3928 | return NULL; |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3929 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3930 | } |
|
7b574a641391
[gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents:
9015
diff
changeset
|
3931 | |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
3932 | static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields) |
| 2681 | 3933 | { |
| 3934 | struct yahoo_data *yd = gc->proto_data; | |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
3935 | const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")]; |
| 2681 | 3936 | |
| 3937 | struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0); | |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
3938 | yahoo_packet_hash_str(pkt, 3, name); |
| 10392 | 3939 | yahoo_packet_send_and_free(pkt, yd); |
| 2681 | 3940 | |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
3941 | purple_connection_set_display_name(gc, name); |
| 2681 | 3942 | } |
| 3943 | ||
|
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
|
3944 | 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
|
3945 | 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
|
3946 | 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
|
3947 | { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3948 | 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
|
3949 | gboolean set_cookie = FALSE; |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
3950 | gchar *url; |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
3951 | 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
|
3952 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3953 | g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc)); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
3954 | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
3955 | yd->url_datas = g_slist_remove(yd->url_datas, url_data); |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3956 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3957 | 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
|
3958 | 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
|
3959 | 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
|
3960 | /* 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
|
3961 | 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
|
3962 | "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
|
3963 | ".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
|
3964 | "&.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
|
3965 | 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
|
3966 | 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
|
3967 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3968 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3969 | if (!set_cookie) { |
|
19832
84b69b21672b
Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
19716
diff
changeset
|
3970 | 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
|
3971 | 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
|
3972 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3973 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3974 | /* 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
|
3975 | 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
|
3976 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3977 | 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
|
3978 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3979 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3980 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3981 | 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
|
3982 | { |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3983 | /* 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
|
3984 | /* 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
|
3985 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3986 | 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
|
3987 | 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
|
3988 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
3989 | 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
|
3990 | const char* base_url = "http://login.yahoo.com"; |
|
24181
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
24032
diff
changeset
|
3991 | /* use whole URL if using HTTP Proxy */ |
|
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
24032
diff
changeset
|
3992 | gboolean use_whole_url = yahoo_account_use_http_proxy(gc); |
|
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
24032
diff
changeset
|
3993 | gchar *request = g_strdup_printf( |
|
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
24032
diff
changeset
|
3994 | "POST %s/config/cookie_token HTTP/1.0\r\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
|
3995 | "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n" |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
3996 | "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\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
|
3997 | "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
|
3998 | "Content-Length: 0\r\n\r\n", |
|
24181
e028e31dcc67
Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <datallah@pidgin.im>
parents:
24032
diff
changeset
|
3999 | use_whole_url ? base_url : "", |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
4000 | yd->cookie_t, yd->cookie_y); |
|
22145
458640401515
A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
21918
diff
changeset
|
4001 | |
|
27195
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4002 | url_data = purple_util_fetch_url_request_len_with_account( |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4003 | purple_connection_get_account(gc), base_url, use_whole_url, |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4004 | YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, |
|
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
|
4005 | 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
|
4006 | |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
4007 | 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
|
4008 | |
|
22980
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
4009 | if (url_data != NULL) |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
4010 | yd->url_datas = g_slist_prepend(yd->url_datas, url_data); |
|
b5c23c9bbd24
Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents:
22942
diff
changeset
|
4011 | else { |
|
19038
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
4012 | 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
|
4013 | 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
|
4014 | "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
|
4015 | 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
|
4016 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
4017 | } |
|
e54f19f8521b
Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents:
18946
diff
changeset
|
4018 | |
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4019 | static void |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4020 | yahoo_set_userinfo_fn(PurplePluginAction *action) |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4021 | { |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4022 | yahoo_set_userinfo(action->context); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4023 | } |
|
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
|
4024 | |
| 15884 | 4025 | static void yahoo_show_act_id(PurplePluginAction *action) |
| 2681 | 4026 | { |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4027 | PurpleRequestFields *fields; |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4028 | PurpleRequestFieldGroup *group; |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4029 | PurpleRequestField *field; |
| 15884 | 4030 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
27416
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4031 | struct yahoo_data *yd = purple_connection_get_protocol_data(gc); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4032 | const char *name = purple_connection_get_display_name(gc); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4033 | int iter; |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4034 | |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4035 | fields = purple_request_fields_new(); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4036 | group = purple_request_field_group_new(NULL); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4037 | purple_request_fields_add_group(fields, group); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4038 | field = purple_request_field_choice_new("id", "Activate which ID?", 0); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4039 | purple_request_field_group_add_field(group, field); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4040 | |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4041 | for (iter = 0; yd->profiles[iter]; iter++) { |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4042 | purple_request_field_choice_add(field, yd->profiles[iter]); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4043 | if (purple_strequal(yd->profiles[iter], name)) |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4044 | purple_request_field_choice_set_default_value(field, iter); |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4045 | } |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4046 | |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4047 | purple_request_fields(gc, NULL, _("Select the ID you want to activate"), NULL, |
|
e99beec5e5c7
Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27415
diff
changeset
|
4048 | fields, |
|
5493
f30de3b116ea
[gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents:
5436
diff
changeset
|
4049 | _("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
|
4050 | _("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
|
4051 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
4052 | gc); |
| 2681 | 4053 | } |
| 4054 | ||
| 15884 | 4055 | static void yahoo_show_chat_goto(PurplePluginAction *action) |
| 7878 | 4056 | { |
| 15884 | 4057 | PurpleConnection *gc = (PurpleConnection *) action->context; |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
4058 | purple_request_input(gc, NULL, _("Join whom in chat?"), NULL, |
| 8697 | 4059 | "", FALSE, FALSE, NULL, |
| 7878 | 4060 | _("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
|
4061 | _("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
|
4062 | purple_connection_get_account(gc), NULL, NULL, |
|
21175
c6d76b49c206
disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents:
21174
diff
changeset
|
4063 | gc); |
| 7878 | 4064 | } |
| 4065 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4066 | GList *yahoo_actions(PurplePlugin *plugin, gpointer context) { |
| 2681 | 4067 | GList *m = NULL; |
| 15884 | 4068 | PurplePluginAction *act; |
| 4069 | ||
|
27716
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4070 | act = purple_plugin_action_new(_("Set User Info..."), |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4071 | yahoo_set_userinfo_fn); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4072 | m = g_list_append(m, act); |
|
a3ed37ab91b8
Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27700
diff
changeset
|
4073 | |
| 15884 | 4074 | act = purple_plugin_action_new(_("Activate ID..."), |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
4075 | yahoo_show_act_id); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
4076 | m = g_list_append(m, act); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
4077 | |
| 15884 | 4078 | act = purple_plugin_action_new(_("Join User in Chat..."), |
|
9015
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
4079 | yahoo_show_chat_goto); |
|
3c27e9074fa2
[gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents:
8993
diff
changeset
|
4080 | m = g_list_append(m, act); |
| 7878 | 4081 | |
|
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
|
4082 | 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
|
4083 | 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
|
4084 | 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
|
4085 | 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
|
4086 | |
| 2681 | 4087 | return m; |
| 4088 | } | |
| 4089 | ||
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4090 | struct yahoo_sms_carrier_cb_data { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4091 | PurpleConnection *gc; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4092 | char *who; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4093 | char *what; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4094 | }; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4095 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4096 | static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4097 | const gchar *webdata, size_t len, const gchar *error_message) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4098 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4099 | struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4100 | PurpleConnection *gc = sms_cb_data->gc; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4101 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4102 | char *mobile_no = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4103 | char *status = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4104 | char *carrier = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4105 | PurpleAccount *account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4106 | PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4107 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4108 | if (error_message != NULL) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4109 | purple_conversation_write(conv, NULL, "Cant send SMS, Unable to obtain mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4110 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4111 | g_free(sms_cb_data->who); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4112 | g_free(sms_cb_data->what); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4113 | g_free(sms_cb_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4114 | return ; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4115 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4116 | else if (len > 0 && webdata && *webdata) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4117 | xmlnode *validate_data_root = xmlnode_from_str(webdata, -1); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4118 | xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4119 | mobile_no = (char *)xmlnode_get_attrib(validate_data_child, "msisdn"); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
4120 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4121 | validate_data_root = xmlnode_copy(validate_data_child); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4122 | validate_data_child = xmlnode_get_child(validate_data_root, "status"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4123 | status = xmlnode_get_data(validate_data_child); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4124 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4125 | validate_data_child = xmlnode_get_child(validate_data_root, "carrier"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4126 | carrier = xmlnode_get_data(validate_data_child); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4127 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4128 | purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4129 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4130 | if( strcmp(status, "Valid") == 0) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4131 | g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4132 | yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4133 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4134 | else { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4135 | g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown")); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4136 | purple_conversation_write(conv, NULL, "Cant send SMS, Unknown mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4137 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4138 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4139 | xmlnode_free(validate_data_child); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4140 | xmlnode_free(validate_data_root); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4141 | g_free(sms_cb_data->who); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4142 | g_free(sms_cb_data->what); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4143 | g_free(sms_cb_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4144 | g_free(mobile_no); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4145 | g_free(status); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4146 | g_free(carrier); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4147 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4148 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4149 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4150 | static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4151 | { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4152 | struct yahoo_data *yd = gc->proto_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4153 | PurpleUtilFetchUrlData *url_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4154 | struct yahoo_sms_carrier_cb_data *sms_cb_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4155 | char *validate_request_str = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4156 | char *request = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4157 | gboolean use_whole_url = FALSE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4158 | xmlnode *validate_request_root = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4159 | xmlnode *validate_request_child = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4160 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4161 | if(!(sms_cb_data = data)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4162 | return; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4163 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4164 | validate_request_root = xmlnode_new("validate"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4165 | xmlnode_set_attrib(validate_request_root, "intl", "us"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4166 | xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4167 | xmlnode_set_attrib(validate_request_root, "qos", "0"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4168 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4169 | validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4170 | xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4171 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4172 | validate_request_str = xmlnode_to_str(validate_request_root, NULL); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4173 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4174 | xmlnode_free(validate_request_child); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4175 | xmlnode_free(validate_request_root); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4176 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4177 | request = g_strdup_printf( |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4178 | "POST /mobileno?intl=us&version=%s HTTP/1.1\r\n" |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4179 | "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n" |
|
27051
122397350352
Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents:
27049
diff
changeset
|
4180 | "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n" |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4181 | "Host: validate.msg.yahoo.com\r\n" |
|
26770
19f31dff1150
Fix two int/size_t format build warnings on 64-bit
Paul Aurich <darkrain42@pidgin.im>
parents:
26736
diff
changeset
|
4182 | "Content-Length: %" G_GSIZE_FORMAT "\r\n" |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4183 | "Cache-Control: no-cache\r\n\r\n%s", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4184 | YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4185 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4186 | /* use whole URL if using HTTP Proxy */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4187 | if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP)) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4188 | use_whole_url = TRUE; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4189 | |
|
27195
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4190 | url_data = purple_util_fetch_url_request_len_with_account( |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4191 | purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url, |
|
b93a3d408d3f
Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27107
diff
changeset
|
4192 | YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1, |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4193 | yahoo_get_sms_carrier_cb, data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4194 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4195 | g_free(request); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4196 | g_free(validate_request_str); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4197 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4198 | if (!url_data) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4199 | PurpleAccount *account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4200 | PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4201 | purple_conversation_write(conv, NULL, "Cant send SMS, Unable to obtain mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4202 | g_free(sms_cb_data->who); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4203 | g_free(sms_cb_data->what); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4204 | g_free(sms_cb_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4205 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4206 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4207 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4208 | int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags) |
| 2681 | 4209 | { |
| 4210 | struct yahoo_data *yd = gc->proto_data; | |
|
26369
acdd165124a2
initialize *pkt to NULL, remove a warning from the compiler
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26368
diff
changeset
|
4211 | struct yahoo_packet *pkt = NULL; |
| 6629 | 4212 | char *msg = yahoo_html_to_codes(what); |
| 7827 | 4213 | char *msg2; |
| 4214 | gboolean utf8 = TRUE; | |
| 15884 | 4215 | PurpleWhiteboard *wb; |
| 9828 | 4216 | int ret = 1; |
| 14320 | 4217 | YahooFriend *f = NULL; |
|
24623
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4218 | gsize lenb = 0; |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4219 | glong lenc = 0; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4220 | struct yahoo_p2p_data *p2p_data; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4221 | gboolean msn = FALSE; |
| 7827 | 4222 | msg2 = yahoo_string_encode(gc, msg, &utf8); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
4223 | |
|
24623
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4224 | if(msg2) { |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4225 | lenb = strlen(msg2); |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4226 | lenc = g_utf8_strlen(msg2, -1); |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4227 | |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4228 | if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) { |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4229 | purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4230 | " bytes, %ld characters. Max is %d bytes, %d chars." |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4231 | " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES, |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4232 | YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2); |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4233 | g_free(msg); |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4234 | g_free(msg2); |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4235 | return -E2BIG; |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4236 | } |
|
cc86f44f12d0
This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
24334
diff
changeset
|
4237 | } |
| 2681 | 4238 | |
|
27461
d5207759c711
We should not be sensitive about the case.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27460
diff
changeset
|
4239 | msn = !g_strncasecmp(who, "msn/", 4); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4240 | |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4241 | if( strncmp(who, "+", 1) == 0 ) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4242 | /* we have an sms to be sent */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4243 | gchar *carrier = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4244 | const char *alias = NULL; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4245 | PurpleAccount *account = purple_connection_get_account(gc); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4246 | PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4247 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4248 | carrier = g_hash_table_lookup(yd->sms_carrier, who); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4249 | if (!carrier) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4250 | struct yahoo_sms_carrier_cb_data *sms_cb_data; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4251 | sms_cb_data = g_malloc(sizeof(struct yahoo_sms_carrier_cb_data)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4252 | sms_cb_data->gc = gc; |
|
27331
b4b9f3ee3c52
NULL terminate some strings. Hopefully stop Yahoo texting crashes.
Michael Ruprecht <maiku@pidgin.im>
parents:
27272
diff
changeset
|
4253 | sms_cb_data->who = g_strdup(who); |
|
b4b9f3ee3c52
NULL terminate some strings. Hopefully stop Yahoo texting crashes.
Michael Ruprecht <maiku@pidgin.im>
parents:
27272
diff
changeset
|
4254 | sms_cb_data->what = g_strdup(what); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4255 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4256 | purple_conversation_write(conv, NULL, "Getting mobile carrier to send the sms", PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
4257 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4258 | yahoo_get_sms_carrier(gc, sms_cb_data); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4259 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4260 | g_free(msg); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4261 | g_free(msg2); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4262 | return ret; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4263 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4264 | else if( strcmp(carrier,"Unknown") == 0 ) { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4265 | purple_conversation_write(conv, NULL, "Cant send SMS, Unknown mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL)); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4266 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4267 | g_free(msg); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4268 | g_free(msg2); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4269 | return -1; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4270 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4271 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4272 | alias = purple_account_get_alias(account); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4273 | pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, 0); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4274 | yahoo_packet_hash(pkt, "sssss", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4275 | 1, purple_connection_get_display_name(gc), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4276 | 69, alias, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4277 | 5, who + 1, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4278 | 68, carrier, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4279 | 14, msg2); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4280 | yahoo_packet_send_and_free(pkt, yd); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4281 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4282 | g_free(msg); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4283 | g_free(msg2); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4284 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4285 | return ret; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4286 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4287 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4288 | pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4289 | if(msn) { |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4290 | yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who+4); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4291 | yahoo_packet_hash_int(pkt, 241, 2); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4292 | } |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4293 | else { |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4294 | yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4295 | if ((f = yahoo_friend_find(gc, who)) && f->protocol) |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4296 | yahoo_packet_hash_int(pkt, 241, f->protocol); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4297 | } |
| 14320 | 4298 | |
| 7827 | 4299 | if (utf8) |
| 10394 | 4300 | yahoo_packet_hash_str(pkt, 97, "1"); |
| 4301 | yahoo_packet_hash_str(pkt, 14, msg2); | |
| 4302 | ||
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4303 | /* |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4304 | * IMVironment. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4305 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4306 | * 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
|
4307 | * 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
|
4308 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4309 | * Otherwise attempt to use the same IMVironment as the remote user, |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4310 | * just so that we don't inadvertantly reset their IMVironment back |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4311 | * to nothing. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4312 | * |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4313 | * If they have no set an IMVironment, then use the default. |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4314 | */ |
| 15884 | 4315 | wb = purple_whiteboard_get_session(gc->account, who); |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4316 | 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
|
4317 | yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY); |
|
11475
1e222e6e52a0
[gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents:
11338
diff
changeset
|
4318 | else |
|
13851
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4319 | { |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4320 | const char *imv; |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4321 | imv = g_hash_table_lookup(yd->imvironments, who); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4322 | if (imv != NULL) |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4323 | yahoo_packet_hash_str(pkt, 63, imv); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4324 | else |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4325 | yahoo_packet_hash_str(pkt, 63, ";0"); |
|
27bc39ea07f8
[gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents:
13844
diff
changeset
|
4326 | } |
| 11608 | 4327 | |
| 10394 | 4328 | yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */ |
| 4329 | yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */ | |
| 9306 | 4330 | if (!yd->picture_url) |
| 10394 | 4331 | yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */ |
| 9306 | 4332 | else |
| 10394 | 4333 | yahoo_packet_hash_str(pkt, 206, "2"); |
| 2681 | 4334 | |
| 9828 | 4335 | /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4336 | if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4337 | /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4338 | if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4339 | yahoo_packet_hash_int(pkt, 11, p2p_data->session_id); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4340 | yahoo_p2p_write_pkt(p2p_data->source, pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4341 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4342 | else { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4343 | yahoo_packet_send(pkt, yd); |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4344 | if(!msn) |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4345 | yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */ |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4346 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4347 | } |
| 9828 | 4348 | else |
| 4349 | ret = -E2BIG; | |
| 2681 | 4350 | |
| 4351 | yahoo_packet_free(pkt); | |
| 6629 | 4352 | |
| 4353 | g_free(msg); | |
| 7827 | 4354 | g_free(msg2); |
| 6629 | 4355 | |
| 9828 | 4356 | return ret; |
| 2681 | 4357 | } |
| 4358 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4359 | unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state) |
| 2993 | 4360 | { |
| 4361 | struct yahoo_data *yd = gc->proto_data; | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4362 | struct yahoo_p2p_data *p2p_data; |
|
27461
d5207759c711
We should not be sensitive about the case.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27460
diff
changeset
|
4363 | gboolean msn = !g_strncasecmp(who, "msn/", 4); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4364 | struct yahoo_packet *pkt = NULL; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4365 | |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4366 | /* Don't do anything if sms is being typed */ |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4367 | if( strncmp(who, "+", 1) == 0 ) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4368 | return 0; |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4369 | |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4370 | pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4371 | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4372 | /* check to see if p2p link exists, send through it */ |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4373 | if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4374 | yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
| 15884 | 4375 | 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
|
27335
06a805d4e690
Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents:
27331
diff
changeset
|
4376 | 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */ |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4377 | yahoo_p2p_write_pkt(p2p_data->source, pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4378 | yahoo_packet_free(pkt); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4379 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4380 | else { /* send through yahoo server */ |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4381 | if(msn) |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4382 | yahoo_packet_hash(pkt, "sssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
| 15884 | 4383 | 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4384 | 5, who+4, 1002, "1", 241, "2"); |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4385 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4386 | yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc), |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4387 | 14, " ", 13, state == PURPLE_TYPING ? "1" : "0", |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4388 | 5, who+4, 1002, "1"); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4389 | yahoo_packet_send_and_free(pkt, yd); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4390 | } |
| 2993 | 4391 | |
| 3001 | 4392 | return 0; |
| 2993 | 4393 | } |
| 4394 | ||
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
4395 | 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
|
4396 | { |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
4397 | YahooFriend *f = value; |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
4398 | if (f && f->presence == YAHOO_PRESENCE_ONLINE) |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
4399 | f->presence = YAHOO_PRESENCE_DEFAULT; |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
4400 | } |
|
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
4401 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4402 | void yahoo_set_status(PurpleAccount *account, PurpleStatus *status) |
| 2681 | 4403 | { |
| 15884 | 4404 | PurpleConnection *gc; |
| 4405 | PurplePresence *presence; | |
| 10400 | 4406 | struct yahoo_data *yd; |
| 2681 | 4407 | struct yahoo_packet *pkt; |
| 10400 | 4408 | int old_status; |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4409 | const char *msg = NULL; |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4410 | char *tmp = NULL; |
| 7827 | 4411 | 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
|
4412 | gboolean utf8 = TRUE; |
| 9984 | 4413 | |
| 15884 | 4414 | if (!purple_status_is_active(status)) |
| 10400 | 4415 | return; |
| 4416 | ||
| 15884 | 4417 | gc = purple_account_get_connection(account); |
| 4418 | presence = purple_status_get_presence(status); | |
| 10400 | 4419 | yd = (struct yahoo_data *)gc->proto_data; |
| 4420 | old_status = yd->current_status; | |
| 9984 | 4421 | |
| 15884 | 4422 | yd->current_status = get_yahoo_status_from_purple_status(status); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4423 | |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4424 | if (yd->current_status == YAHOO_STATUS_CUSTOM) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4425 | { |
| 15884 | 4426 | msg = purple_status_get_attr_string(status, "message"); |
| 4427 | ||
| 4428 | 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
|
4429 | tmp = yahoo_string_encode(gc, msg, &utf8); |
| 15884 | 4430 | conv_msg = purple_markup_strip_html(tmp); |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4431 | g_free(tmp); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4432 | } else { |
|
11972
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4433 | if ((msg == NULL) || (*msg == '\0')) |
|
23ac6d9de1fa
[gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents:
11970
diff
changeset
|
4434 | 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
|
4435 | tmp = yahoo_string_encode(gc, msg, &utf8); |
| 15884 | 4436 | conv_msg = purple_markup_strip_html(tmp); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4437 | g_free(tmp); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4438 | } |
| 2681 | 4439 | } |
| 4440 | ||
| 10373 | 4441 | if (yd->current_status == YAHOO_STATUS_INVISIBLE) { |
| 4442 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 4443 | yahoo_packet_hash_str(pkt, 13, "2"); |
| 10392 | 4444 | yahoo_packet_send_and_free(pkt, yd); |
| 10373 | 4445 | |
| 4446 | return; | |
| 4447 | } | |
| 4448 | ||
| 4449 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 4450 | yahoo_packet_hash_int(pkt, 10, yd->current_status); |
| 6847 | 4451 | |
| 9984 | 4452 | 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
|
4453 | yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4454 | yahoo_packet_hash_str(pkt, 19, conv_msg); |
| 10373 | 4455 | } else { |
| 10394 | 4456 | yahoo_packet_hash_str(pkt, 19, ""); |
| 10373 | 4457 | } |
| 4458 | ||
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4459 | g_free(conv_msg); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4460 | |
| 15884 | 4461 | if (purple_presence_is_idle(presence)) |
| 10394 | 4462 | yahoo_packet_hash_str(pkt, 47, "2"); |
| 15884 | 4463 | else if (!purple_status_is_available(status)) |
| 10394 | 4464 | yahoo_packet_hash_str(pkt, 47, "1"); |
| 2681 | 4465 | |
| 10392 | 4466 | yahoo_packet_send_and_free(pkt, yd); |
| 9984 | 4467 | |
| 10373 | 4468 | if (old_status == YAHOO_STATUS_INVISIBLE) { |
| 4469 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0); | |
| 10394 | 4470 | yahoo_packet_hash_str(pkt, 13, "1"); |
| 10392 | 4471 | yahoo_packet_send_and_free(pkt, yd); |
|
10989
ea41b63cfea5
[gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents:
10963
diff
changeset
|
4472 | |
|
12010
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
4473 | /* Any per-session presence settings are removed */ |
|
aa2f3b07ec09
[gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents:
11985
diff
changeset
|
4474 | 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
|
4475 | |
| 10373 | 4476 | } |
| 2681 | 4477 | } |
| 4478 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4479 | void yahoo_set_idle(PurpleConnection *gc, int idle) |
| 2681 | 4480 | { |
| 4481 | struct yahoo_data *yd = gc->proto_data; | |
| 4482 | struct yahoo_packet *pkt = NULL; | |
| 8503 | 4483 | char *msg = NULL, *msg2 = NULL; |
| 15884 | 4484 | PurpleStatus *status = NULL; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
4485 | |
|
13688
240e5b90adb4
[gaim-migrate @ 16089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13559
diff
changeset
|
4486 | if (idle && yd->current_status != YAHOO_STATUS_CUSTOM) |
| 2681 | 4487 | yd->current_status = YAHOO_STATUS_IDLE; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
4488 | else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
| 15884 | 4489 | status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
| 4490 | 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
|
4491 | } |
| 10373 | 4492 | |
| 4493 | pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0); | |
| 4494 | ||
| 10394 | 4495 | yahoo_packet_hash_int(pkt, 10, yd->current_status); |
| 10373 | 4496 | if (yd->current_status == YAHOO_STATUS_CUSTOM) { |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
4497 | const char *tmp; |
|
13559
c7256daef931
[gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13462
diff
changeset
|
4498 | if (status == NULL) |
| 15884 | 4499 | status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc))); |
| 4500 | tmp = purple_status_get_attr_string(status, "message"); | |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
4501 | if (tmp != NULL) { |
|
27104
86b2bd63ee1c
Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27079
diff
changeset
|
4502 | gboolean utf8 = TRUE; |
|
86b2bd63ee1c
Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27079
diff
changeset
|
4503 | msg = yahoo_string_encode(gc, tmp, &utf8); |
| 15884 | 4504 | msg2 = purple_markup_strip_html(msg); |
|
27104
86b2bd63ee1c
Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27079
diff
changeset
|
4505 | yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
4506 | yahoo_packet_hash_str(pkt, 19, msg2); |
|
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
4507 | } else { |
| 15884 | 4508 | /* 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
|
4509 | * 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
|
4510 | yahoo_packet_hash_str(pkt, 19, _("Away")); |
|
10504
eae130eefbfe
[gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
10401
diff
changeset
|
4511 | } |
| 6847 | 4512 | } else { |
| 10394 | 4513 | yahoo_packet_hash_str(pkt, 19, ""); |
| 2681 | 4514 | } |
| 4515 | ||
| 10373 | 4516 | if (idle) |
| 10394 | 4517 | yahoo_packet_hash_str(pkt, 47, "2"); |
| 15884 | 4518 | else if (!purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc)))) |
| 10394 | 4519 | yahoo_packet_hash_str(pkt, 47, "1"); |
| 10373 | 4520 | |
| 10392 | 4521 | yahoo_packet_send_and_free(pkt, yd); |
| 10373 | 4522 | |
| 4523 | g_free(msg); | |
| 4524 | g_free(msg2); | |
| 2681 | 4525 | } |
| 4526 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4527 | GList *yahoo_status_types(PurpleAccount *account) |
| 2681 | 4528 | { |
| 15884 | 4529 | PurpleStatusType *type; |
| 9979 | 4530 | GList *types = NULL; |
| 4531 | ||
| 15884 | 4532 | 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
|
4533 | NULL, TRUE, TRUE, FALSE, |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4534 | "message", _("Message"), |
| 15884 | 4535 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4536 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4537 | |
| 15884 | 4538 | 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
|
4539 | NULL, TRUE, TRUE, FALSE, |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4540 | "message", _("Message"), |
| 15884 | 4541 | purple_value_new(PURPLE_TYPE_STRING), NULL); |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4542 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4543 | |
| 15884 | 4544 | 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
|
4545 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4546 | |
| 15884 | 4547 | 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
|
4548 | types = g_list_append(types, type); |
|
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4549 | |
| 15884 | 4550 | 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
|
4551 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4552 | |
| 15884 | 4553 | 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
|
4554 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4555 | |
| 15884 | 4556 | 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
|
4557 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4558 | |
| 15884 | 4559 | 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
|
4560 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4561 | |
| 15884 | 4562 | 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
|
4563 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4564 | |
| 15884 | 4565 | 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
|
4566 | types = g_list_append(types, type); |
|
f59128c6d479
[gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents:
12203
diff
changeset
|
4567 | |
| 15884 | 4568 | 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
|
4569 | types = g_list_append(types, type); |
|
a8ac8491df3a
[gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents:
12152
diff
changeset
|
4570 | |
|
11970
5160cebfa5e0
[gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents:
11969
diff
changeset
|
4571 | |
| 15884 | 4572 | type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE); |
| 9979 | 4573 | types = g_list_append(types, type); |
| 4574 | ||
| 15884 | 4575 | 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
|
4576 | types = g_list_append(types, type); |
|
4aa7a873628d
[gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents:
12645
diff
changeset
|
4577 | |
| 15884 | 4578 | type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE); |
| 15589 | 4579 | types = g_list_append(types, type); |
| 4580 | ||
| 9979 | 4581 | return types; |
| 2681 | 4582 | } |
| 4583 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4584 | void yahoo_keepalive(PurpleConnection *gc) |
| 2681 | 4585 | { |
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4586 | struct yahoo_packet *pkt; |
| 2681 | 4587 | struct yahoo_data *yd = gc->proto_data; |
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4588 | time_t now = time(NULL); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4589 | |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4590 | /* We're only allowed to send a ping once an hour or the servers will boot us */ |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4591 | if ((now - yd->last_ping) >= PING_TIMEOUT) { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4592 | yd->last_ping = now; |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4593 | |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4594 | /* The native client will only send PING or CHATPING */ |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4595 | if (yd->chat_online) { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4596 | if (yd->wm) { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4597 | ycht_chat_send_keepalive(yd->ycht); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4598 | } else { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4599 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4600 | yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc)); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4601 | yahoo_packet_send_and_free(pkt, yd); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4602 | } |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4603 | } else { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4604 | pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4605 | yahoo_packet_send_and_free(pkt, yd); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4606 | } |
| 9376 | 4607 | } |
| 4608 | ||
|
24334
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4609 | if ((now - yd->last_keepalive) >= KEEPALIVE_TIMEOUT) { |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4610 | yd->last_keepalive = now; |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4611 | pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, 0); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4612 | yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc)); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4613 | yahoo_packet_send_and_free(pkt, yd); |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4614 | } |
|
63714c02b0fd
Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <datallah@pidgin.im>
parents:
24235
diff
changeset
|
4615 | |
| 2681 | 4616 | } |
| 4617 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4618 | void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g) |
| 2681 | 4619 | { |
| 4620 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
| 4621 | struct yahoo_packet *pkt; | |
|
19534
ac814f829edf
Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <datallah@pidgin.im>
parents:
19411
diff
changeset
|
4622 | 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
|
4623 | char *group2; |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
4624 | YahooFriend *f; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4625 | const char *bname; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4626 | gboolean msn = FALSE; |
| 2681 | 4627 | |
| 4628 | if (!yd->logged_in) | |
| 4629 | return; | |
| 4630 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4631 | bname = purple_buddy_get_name(buddy); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4632 | if (!purple_privacy_check(purple_connection_get_account(gc), bname)) |
|
10963
8011e6bc10b5
[gaim-migrate @ 12768]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10944
diff
changeset
|
4633 | return; |
|
8011e6bc10b5
[gaim-migrate @ 12768]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10944
diff
changeset
|
4634 | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4635 | f = yahoo_friend_find(gc, bname); |
|
27461
d5207759c711
We should not be sensitive about the case.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
27460
diff
changeset
|
4636 | msn = !g_strncasecmp(bname, "msn/", 4); |
|
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
|
4637 | |
|
22367
7e33f5d352f5
Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents:
22366
diff
changeset
|
4638 | g = purple_buddy_get_group(buddy); |
|
7e33f5d352f5
Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents:
22366
diff
changeset
|
4639 | if (g) |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4640 | group = purple_group_get_name(g); |
|
22367
7e33f5d352f5
Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents:
22366
diff
changeset
|
4641 | else |
|
7e33f5d352f5
Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents:
22366
diff
changeset
|
4642 | group = "Buddies"; |
| 2681 | 4643 | |
| 7829 | 4644 | group2 = yahoo_string_encode(gc, group, NULL); |
| 2681 | 4645 | pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4646 | if(msn) { |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4647 | yahoo_packet_hash(pkt, "sssssssssss", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4648 | 14, "", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4649 | 65, group2, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4650 | 97, "1", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4651 | 1, purple_connection_get_display_name(gc), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4652 | 302, "319", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4653 | 300, "319", |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4654 | 7, bname + 4, |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4655 | 241, "2", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4656 | 334, "0", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4657 | 301, "319", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4658 | 303, "319" |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4659 | ); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4660 | } |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4661 | else { |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4662 | yahoo_packet_hash(pkt, "ssssssssss", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4663 | 14, "", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4664 | 65, group2, |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4665 | 97, "1", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4666 | 1, purple_connection_get_display_name(gc), |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4667 | 302, "319", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4668 | 300, "319", |
|
26378
e85d894af8a5
propagate from branch 'im.pidgin.pidgin' (head 168b66075e088f3baaa85ebba520e37d42aa3d0c)
Sulabh Mahajan <sulabh@pidgin.im>
diff
changeset
|
4669 | 7, bname, |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4670 | 334, "0", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4671 | 301, "319", |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4672 | 303, "319" |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4673 | ); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4674 | } |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4675 | if (f && f->protocol && !msn) |
|
19411
450006e4bfc2
Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents:
19339
diff
changeset
|
4676 | yahoo_packet_hash_int(pkt, 241, f->protocol); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4677 | |
| 10392 | 4678 | yahoo_packet_send_and_free(pkt, yd); |
| 7829 | 4679 | g_free(group2); |
| 2681 | 4680 | } |
| 4681 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4682 | void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group) |
| 2681 | 4683 | { |
| 4684 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4685 | struct yahoo_packet *pkt; |
| 6840 | 4686 | GSList *buddies, *l; |
| 15884 | 4687 | PurpleGroup *g; |
| 6840 | 4688 | gboolean remove = TRUE; |
| 7827 | 4689 | char *cg; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4690 | const char *bname, *gname; |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4691 | YahooFriend *f = NULL; |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4692 | gboolean msn = FALSE; |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4693 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4694 | bname = purple_buddy_get_name(buddy); |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4695 | f = yahoo_friend_find(gc, bname); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4696 | if (!f) |
| 6784 | 4697 | return; |
| 4698 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4699 | gname = purple_group_get_name(group); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4700 | buddies = purple_find_buddies(purple_connection_get_account(gc), bname); |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4701 | if(f->protocol == 2) |
|
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4702 | msn = TRUE; |
| 6840 | 4703 | for (l = buddies; l; l = l->next) { |
| 15884 | 4704 | g = purple_buddy_get_group(l->data); |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4705 | if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) { |
| 6840 | 4706 | remove = FALSE; |
| 4707 | break; | |
| 4708 | } | |
| 4709 | } | |
| 4710 | ||
| 4711 | g_slist_free(buddies); | |
| 4712 | ||
| 4713 | if (remove) | |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4714 | g_hash_table_remove(yd->friends, bname); |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4715 | |
|
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4716 | cg = yahoo_string_encode(gc, gname, NULL); |
|
6795
396b24cfeeb6
[gaim-migrate @ 7334]
Herman Bloggs <herman@bluedigits.com>
parents:
6793
diff
changeset
|
4717 | pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4718 | |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4719 | if(msn) |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4720 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
|
26377
9124a345ed3a
Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26376
diff
changeset
|
4721 | 7, bname+4, 65, cg); |
|
26366
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4722 | else |
|
d12f442c3117
implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26365
diff
changeset
|
4723 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4724 | 7, bname, 65, cg); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4725 | if(f->protocol) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4726 | yahoo_packet_hash_int(pkt, 241, f->protocol); |
| 10392 | 4727 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 4728 | g_free(cg); |
| 2681 | 4729 | } |
| 4730 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4731 | void yahoo_add_deny(PurpleConnection *gc, const char *who) { |
| 6760 | 4732 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 4733 | struct yahoo_packet *pkt; | |
| 4734 | ||
| 4735 | if (!yd->logged_in) | |
| 4736 | return; | |
| 8113 | 4737 | |
| 4738 | if (!who || who[0] == '\0') | |
| 4739 | return; | |
| 4740 | ||
| 6760 | 4741 | pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); |
| 15884 | 4742 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
| 10394 | 4743 | 7, who, 13, "1"); |
| 10392 | 4744 | yahoo_packet_send_and_free(pkt, yd); |
| 6760 | 4745 | } |
| 4746 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4747 | void yahoo_rem_deny(PurpleConnection *gc, const char *who) { |
| 6760 | 4748 | struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
| 4749 | struct yahoo_packet *pkt; | |
| 4750 | ||
| 4751 | if (!yd->logged_in) | |
| 4752 | return; | |
| 4753 | ||
| 4754 | if (!who || who[0] == '\0') | |
| 4755 | return; | |
| 4756 | ||
| 4757 | pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0); | |
| 15884 | 4758 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2"); |
| 10392 | 4759 | yahoo_packet_send_and_free(pkt, yd); |
| 6760 | 4760 | } |
| 4761 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4762 | void yahoo_set_permit_deny(PurpleConnection *gc) |
| 22371 | 4763 | { |
| 4764 | PurpleAccount *account; | |
| 6760 | 4765 | GSList *deny; |
| 4766 | ||
| 22371 | 4767 | account = purple_connection_get_account(gc); |
| 4768 | ||
| 4769 | switch (account->perm_deny) | |
| 4770 | { | |
| 15884 | 4771 | case PURPLE_PRIVACY_ALLOW_ALL: |
| 22371 | 4772 | for (deny = account->deny; deny; deny = deny->next) |
| 10143 | 4773 | yahoo_rem_deny(gc, deny->data); |
| 4774 | break; | |
| 22371 | 4775 | |
| 15884 | 4776 | case PURPLE_PRIVACY_ALLOW_BUDDYLIST: |
|
22373
a80b7230e94c
Our Yahoo! protocol has this crappy implementation where it tries
Mark Doliner <markdoliner@pidgin.im>
parents:
22371
diff
changeset
|
4777 | case PURPLE_PRIVACY_ALLOW_USERS: |
| 15884 | 4778 | case PURPLE_PRIVACY_DENY_USERS: |
|
22373
a80b7230e94c
Our Yahoo! protocol has this crappy implementation where it tries
Mark Doliner <markdoliner@pidgin.im>
parents:
22371
diff
changeset
|
4779 | case PURPLE_PRIVACY_DENY_ALL: |
| 22371 | 4780 | for (deny = account->deny; deny; deny = deny->next) |
| 6760 | 4781 | yahoo_add_deny(gc, deny->data); |
| 4782 | break; | |
| 4783 | } | |
| 4784 | } | |
| 4785 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4786 | void yahoo_change_buddys_group(PurpleConnection *gc, const char *who, |
| 6793 | 4787 | const char *old_group, const char *new_group) |
| 4788 | { | |
| 4789 | struct yahoo_data *yd = gc->proto_data; | |
| 4790 | struct yahoo_packet *pkt; | |
| 7827 | 4791 | char *gpn, *gpo; |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4792 | YahooFriend *f = yahoo_friend_find(gc, who); |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4793 | gboolean msn = FALSE; |
|
26370
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4794 | const char *temp = NULL; |
| 6793 | 4795 | |
| 4796 | /* Step 0: If they aren't on the server list anyway, | |
| 4797 | * don't bother letting the server know. | |
| 4798 | */ | |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4799 | if (!f) |
| 6793 | 4800 | return; |
| 4801 | ||
|
27049
7017af815679
Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <darkrain42@pidgin.im>
parents:
27048
diff
changeset
|
4802 | if(f->protocol == 2) { |
|
26372
2db123cb3f4f
use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26370
diff
changeset
|
4803 | msn = TRUE; |
|
26370
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4804 | temp = who+4; |
|
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4805 | } else |
|
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4806 | temp = who; |
|
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4807 | |
| 7827 | 4808 | /* If old and new are the same, we would probably |
| 4809 | * end up deleting the buddy, which would be bad. | |
| 4810 | * This might happen because of the charset conversation. | |
| 4811 | */ | |
| 4812 | gpn = yahoo_string_encode(gc, new_group, NULL); | |
| 4813 | gpo = yahoo_string_encode(gc, old_group, NULL); | |
| 4814 | if (!strcmp(gpn, gpo)) { | |
| 4815 | g_free(gpn); | |
| 4816 | g_free(gpo); | |
| 4817 | return; | |
| 4818 | } | |
| 4819 | ||
|
19329
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
4820 | pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, 0); |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4821 | if(f->protocol) |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4822 | yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc), |
|
26370
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4823 | 302, "240", 300, "240", 7, temp, 241, f->protocol, 224, gpo, 264, gpn, 301, |
|
26362
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4824 | "240", 303, "240"); |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4825 | else |
|
de9cf498a73a
resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26360
diff
changeset
|
4826 | yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc), |
|
26370
2f3de165c4bf
msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents:
26369
diff
changeset
|
4827 | 302, "240", 300, "240", 7, temp, 224, gpo, 264, gpn, 301, |
|
19329
2acabedbaa3e
Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents:
19064
diff
changeset
|
4828 | "240", 303, "240"); |
| 10392 | 4829 | yahoo_packet_send_and_free(pkt, yd); |
| 6793 | 4830 | |
| 7827 | 4831 | g_free(gpn); |
| 4832 | g_free(gpo); | |
| 6793 | 4833 | } |
| 4834 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4835 | void yahoo_rename_group(PurpleConnection *gc, const char *old_name, |
| 15884 | 4836 | PurpleGroup *group, GList *moved_buddies) |
| 6793 | 4837 | { |
| 4838 | struct yahoo_data *yd = gc->proto_data; | |
| 4839 | struct yahoo_packet *pkt; | |
| 7827 | 4840 | char *gpn, *gpo; |
| 4841 | ||
|
24398
4865c2ee6ea8
Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
24334
diff
changeset
|
4842 | gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL); |
|
9285
9cedf5d26577
[gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents:
9284
diff
changeset
|
4843 | gpo = yahoo_string_encode(gc, old_name, NULL); |
| 7827 | 4844 | if (!strcmp(gpn, gpo)) { |
| 4845 | g_free(gpn); | |
| 4846 | g_free(gpo); | |
| 4847 | return; | |
| 4848 | } | |
| 6793 | 4849 | |
| 4850 | pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0); | |
| 15884 | 4851 | yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), |
| 10394 | 4852 | 65, gpo, 67, gpn); |
| 10392 | 4853 | yahoo_packet_send_and_free(pkt, yd); |
| 7827 | 4854 | g_free(gpn); |
| 4855 | g_free(gpo); | |
| 6793 | 4856 | } |
| 4857 | ||
|
10937
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4858 | /********************************* Commands **********************************/ |
|
1753f4709889
[gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents:
10784
diff
changeset
|
4859 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4860 | PurpleCmdRet |
| 15884 | 4861 | yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) { |
| 4862 | PurpleAccount *account = purple_conversation_get_account(c); | |
| 10119 | 4863 | |
| 4864 | if (*args && args[0]) | |
| 15884 | 4865 | return PURPLE_CMD_RET_FAILED; |
| 4866 | ||
|
24032
d5c04a8cc62a
Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
23545
diff
changeset
|
4867 | purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ); |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4868 | |
| 15884 | 4869 | return PURPLE_CMD_RET_OK; |
| 10119 | 4870 | } |
| 4871 | ||
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4872 | PurpleCmdRet |
| 15884 | 4873 | yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd, |
| 10119 | 4874 | char **args, char **error, void *data) |
| 4875 | { | |
| 4876 | GHashTable *comp; | |
| 15884 | 4877 | PurpleConnection *gc; |
| 10119 | 4878 | struct yahoo_data *yd; |
| 4879 | int id; | |
| 4880 | ||
| 4881 | if (!args || !args[0]) | |
| 15884 | 4882 | return PURPLE_CMD_RET_FAILED; |
| 4883 | ||
| 4884 | gc = purple_conversation_get_gc(conv); | |
| 10119 | 4885 | yd = gc->proto_data; |
| 4886 | id = yd->conf_id; | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
4887 | purple_debug_info("yahoo", "Trying to join %s \n", args[0]); |
| 10119 | 4888 | |
| 4889 | comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); | |
| 25335 | 4890 | g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1)); |
|
11077
c189de76c00e
[gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents:
11076
diff
changeset
|
4891 | g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat")); |
| 10119 | 4892 | |
| 4893 | yahoo_c_join(gc, comp); | |
| 4894 | ||
| 4895 | g_hash_table_destroy(comp); | |
| 15884 | 4896 | return PURPLE_CMD_RET_OK; |
| 10119 | 4897 | } |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4898 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4899 | PurpleCmdRet |
| 15884 | 4900 | yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd, |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4901 | char **args, char **error, void *data) |
|
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4902 | { |
| 15884 | 4903 | PurpleAccount *account = purple_conversation_get_account(conv); |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4904 | if (*args && args[0]) |
| 15884 | 4905 | return PURPLE_CMD_RET_FAILED; |
| 4906 | purple_roomlist_show_with_account(account); | |
| 4907 | return PURPLE_CMD_RET_OK; | |
|
13041
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4908 | } |
|
0eebc22048e6
[gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents:
13021
diff
changeset
|
4909 | |
|
27560
95e7692b99eb
Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27558
diff
changeset
|
4910 | gboolean yahoo_offline_message(const PurpleBuddy *buddy) |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4911 | { |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4912 | return TRUE; |
|
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4913 | } |
|
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
|
4914 | |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4915 | 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
|
4916 | { |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4917 | 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
|
4918 | |
|
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
|
4919 | 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
|
4920 | 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
|
4921 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4922 | 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
|
4923 | |
|
27547
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
4924 | purple_debug_info("yahoo", "Sending <ding> on account %s to buddy %s.\n", |
|
c136491361eb
Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
27529
diff
changeset
|
4925 | 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
|
4926 | 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
|
4927 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4928 | 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
|
4929 | } |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4930 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4931 | 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
|
4932 | { |
|
19643
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4933 | 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
|
4934 | |
|
1794c23309d3
In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19642
diff
changeset
|
4935 | 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
|
4936 | /* 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
|
4937 | /* This is index number YAHOO_BUZZ. */ |
|
22225
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22207
diff
changeset
|
4938 | list = g_list_append(list, purple_attention_type_new("Buzz", _("Buzz"), |
|
6cd802a8c5ad
This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
22207
diff
changeset
|
4939 | _("%s has buzzed you!"), _("Buzzing %s..."))); |
|
20658
91594d39738c
Clear the password consistently when we get a "Signed-On elsewhere" or a "Invalid Password" disconnection. Disconnection reason codes will take care of this in the core, but until then, this is ok. Fixes #3204.
Daniel Atallah <datallah@pidgin.im>
parents:
19918
diff
changeset
|
4940 | } |
|
19642
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4941 | |
|
f27b0a59548e
Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents:
19609
diff
changeset
|
4942 | 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
|
4943 | } |
|
12645
a907ba243930
[gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
4944 |