libpurple/protocols/yahoo/libymsg.c

Fri, 11 Mar 2011 02:00:15 +0000

author
John Bailey <rekkanoryo@rekkanoryo.org>
date
Fri, 11 Mar 2011 02:00:15 +0000
changeset 31542
3efb6fbae94a
parent 31294
73607ab89c6f
child 31565
1138b2c998ec
permissions
-rw-r--r--

Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
pointer dereferences, leading to denial of service.

2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2 * purple
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3 *
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
8046
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8045
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
c581b20a47d6 [gaim-migrate @ 8730]
Sean Egan <seanegan@pidgin.im>
parents: 8045
diff changeset
6 * source distribution.
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
7 *
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
11 * (at your option) any later version.
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
12 *
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
16 * GNU General Public License for more details.
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
17 *
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
21 *
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
22 */
9369
6c8dc8a5311c [gaim-migrate @ 10177]
Sean Egan <seanegan@pidgin.im>
parents: 9329
diff changeset
23
5872
754c63f29b77 [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
24 #include "internal.h"
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
28 #include "blist.h"
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
29 #include "cipher.h"
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
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
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
35 #include "privacy.h"
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
36 #include "prpl.h"
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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
b54a762f60fa [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
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
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
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
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
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
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
73 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
74 {
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
75 char *status = NULL;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
76
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
77 if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name))
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
78 return;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
79
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
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
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
84 case YAHOO_STATUS_AVAILABLE:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
85 status = YAHOO_STATUS_TYPE_AVAILABLE;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
86 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
87 case YAHOO_STATUS_BRB:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
88 status = YAHOO_STATUS_TYPE_BRB;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
89 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
90 case YAHOO_STATUS_BUSY:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
91 status = YAHOO_STATUS_TYPE_BUSY;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
92 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
93 case YAHOO_STATUS_NOTATHOME:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
94 status = YAHOO_STATUS_TYPE_NOTATHOME;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
95 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
96 case YAHOO_STATUS_NOTATDESK:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
97 status = YAHOO_STATUS_TYPE_NOTATDESK;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
98 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
99 case YAHOO_STATUS_NOTINOFFICE:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
100 status = YAHOO_STATUS_TYPE_NOTINOFFICE;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
101 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
102 case YAHOO_STATUS_ONPHONE:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
103 status = YAHOO_STATUS_TYPE_ONPHONE;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
104 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
105 case YAHOO_STATUS_ONVACATION:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
106 status = YAHOO_STATUS_TYPE_ONVACATION;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
107 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
108 case YAHOO_STATUS_OUTTOLUNCH:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
109 status = YAHOO_STATUS_TYPE_OUTTOLUNCH;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
110 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
111 case YAHOO_STATUS_STEPPEDOUT:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
112 status = YAHOO_STATUS_TYPE_STEPPEDOUT;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
113 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
114 case YAHOO_STATUS_INVISIBLE: /* this should never happen? */
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
115 status = YAHOO_STATUS_TYPE_INVISIBLE;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
116 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
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
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
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
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
121 else
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
122 status = YAHOO_STATUS_TYPE_AWAY;
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
123 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
124 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
125 purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status);
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
126 break;
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
127 }
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
128
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
129 if (status) {
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
130 if (f->status == YAHOO_STATUS_CUSTOM)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
131 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message",
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
132 yahoo_friend_get_status_message(f), NULL);
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
133 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
134 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL);
9983
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
135 }
912b3ca807b4 [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
136
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
137 if (f->idle != 0)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
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
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
140 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0);
15589
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
141
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
142 if (f->sms)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
143 purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL);
15589
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
144 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
145 purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
146 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
147
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
148 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
149 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
150 PurpleAccount *account = purple_connection_get_account(gc);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
151 GSList *l = pkt->hash;
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
152 YahooFriend *f = NULL;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
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;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
156 YahooFederation fed = YAHOO_FEDERATION_NONE;
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
157 char *fedname = NULL;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
158
7892
227c27d0183d [gaim-migrate @ 8552]
Daniel Atallah <datallah@pidgin.im>
parents: 7883
diff changeset
159 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
160 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
161 purple_account_set_password(account, NULL);
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
162 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
163 _("You have signed on from another location"));
7892
227c27d0183d [gaim-migrate @ 8552]
Daniel Atallah <datallah@pidgin.im>
parents: 7883
diff changeset
164 return;
227c27d0183d [gaim-migrate @ 8552]
Daniel Atallah <datallah@pidgin.im>
parents: 7883
diff changeset
165 }
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
166
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
167 while (l) {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
168 struct yahoo_pair *pair = l->data;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
169
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
170 switch (pair->key) {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
171 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
172 case 1: /* we won't actually do anything with this */
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
173 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
174 case 8: /* how many online buddies we have */
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
175 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
176 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
177 /* 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
178 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
179 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
180 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
181 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
182 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
183 }
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 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
185 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
186 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
187 GSList *tmplist;
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
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
191 /* Look ahead to see if we have the federation info about the buddy */
27392
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) {
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
197 fed = strtol(p->value, NULL, 10);
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
198 g_free(fedname);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
199 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
200 case YAHOO_FEDERATION_MSN:
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
201 name = fedname = g_strconcat("msn/", name, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
202 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
203 case YAHOO_FEDERATION_OCS:
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
204 name = fedname = g_strconcat("ocs/", name, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
205 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
206 case YAHOO_FEDERATION_IBM:
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
207 name = fedname = g_strconcat("ibm/", name, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
208 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
209 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
210 default:
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
211 fedname = NULL;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
212 break;
27392
6f8b494ffe86 Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27391
diff changeset
213 }
6f8b494ffe86 Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27391
diff changeset
214 break;
6f8b494ffe86 Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27391
diff changeset
215 }
6f8b494ffe86 Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27391
diff changeset
216 }
9886
ea7433072a8f [gaim-migrate @ 10771]
Tim Ringenbach <marv@pidgin.im>
parents: 9835
diff changeset
217 f = yahoo_friend_find_or_new(gc, name);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
218 f->fed = fed;
9888
162a02f2ac9d [gaim-migrate @ 10773]
Dave Bell
parents: 9886
diff changeset
219 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
220 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
221 case 10: /* state */
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
222 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
223 break;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
224
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
225 f->status = strtol(pair->value, NULL, 10);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
226 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT))
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
227 f->away = 1;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
228 else
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
229 f->away = 0;
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
230
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
231 if (f->status == YAHOO_STATUS_IDLE) {
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
232 /* 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
233 if (f->idle == 0)
28519
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
234 {
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
235 if(pkt->service == YAHOO_SERVICE_STATUS_15)
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
236 f->idle = -1;
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
237 else
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
238 f->idle = time(NULL);
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
239 }
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
240 } else
6804
8247ddcbdf53 [gaim-migrate @ 7344]
Tim Ringenbach <marv@pidgin.im>
parents: 6796
diff changeset
241 f->idle = 0;
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
242
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
243 if (f->status != YAHOO_STATUS_CUSTOM)
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
244 yahoo_friend_set_status_message(f, NULL);
6847
0fda06bb588a [gaim-migrate @ 7392]
Tim Ringenbach <marv@pidgin.im>
parents: 6840
diff changeset
245
0fda06bb588a [gaim-migrate @ 7392]
Tim Ringenbach <marv@pidgin.im>
parents: 6840
diff changeset
246 f->sms = 0;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
247 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
248 case 19: /* custom message */
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
249 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
250 message = pair->value;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
251 break;
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
252 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
253 if (f)
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
254 f->session_id = strtol(pair->value, NULL, 10);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
255 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
256 case 17: /* in chat? */
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
257 break;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
258 case 47: /* is custom status away or not? 2=idle*/
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
259 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
260 break;
8441
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
261
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
262 /* I have no idea what it means when this is
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
263 * set when someone's available, but it doesn't
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
264 * mean idle. */
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
265 if (f->status == YAHOO_STATUS_AVAILABLE)
94a84c00e8e0 [gaim-migrate @ 9171]
Tim Ringenbach <marv@pidgin.im>
parents: 8383
diff changeset
266 break;
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
267
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
268 f->away = strtol(pair->value, NULL, 10);
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
269 if (f->away == 2) {
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
270 /* 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
271 if (f->idle == 0)
28519
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
272 {
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
273 if(pkt->service == YAHOO_SERVICE_STATUS_15)
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
274 f->idle = -1;
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
275 else
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
276 f->idle = time(NULL);
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
277 }
10141
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
278 }
3db22fc14161 [gaim-migrate @ 11212]
Evan Schoenberg <evands@pidgin.im>
parents: 10126
diff changeset
279
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
280 break;
28519
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
281 case 138: /* when value is 1, either we're not idle, or we are but won't say how long */
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
282 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
283 break;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
284
28519
0f966960f1b4 Better, accurate handling of idle time for a yahoo buddy. Fixes #10099
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28517
diff changeset
285 if( (strtol(pair->value, NULL, 10) == 1) && (f->idle) )
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
286 f->idle = -1;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
287 break;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
288 case 137: /* usually idle time in seconds, sometimes login time */
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
289 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
290 break;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
291
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
292 if (f->status != YAHOO_STATUS_AVAILABLE)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
293 f->idle = time(NULL) - strtol(pair->value, NULL, 10);
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
294 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
295 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
296 if (strtol(pair->value, NULL, 10) == 0) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
297 if (f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
298 f->status = YAHOO_STATUS_OFFLINE;
15589
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
299 if (name) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
300 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
301 purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE);
15589
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
302 }
2807
fe1ea0453890 [gaim-migrate @ 2820]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2805
diff changeset
303 break;
2805
31c7645db097 [gaim-migrate @ 2818]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2795
diff changeset
304 }
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
305 break;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
306 case 60: /* SMS */
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
307 if (f) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
308 f->sms = strtol(pair->value, NULL, 10);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
309 yahoo_update_status(gc, name, f);
2771
8c214f13da39 [gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2741
diff changeset
310 }
8c214f13da39 [gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2741
diff changeset
311 break;
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
312 case 197: /* Avatars */
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
313 {
11137
cf40226ddff7 [gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents: 11127
diff changeset
314 guchar *decoded;
11127
5e539d9d26a4 [gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents: 11111
diff changeset
315 char *tmp;
5e539d9d26a4 [gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents: 11111
diff changeset
316 gsize len;
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
317
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
318 if (pair->value) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
319 decoded = purple_base64_decode(pair->value, &len);
30857
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
320 if (decoded && len > 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
321 tmp = purple_str_binary_to_ascii(decoded, len);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
322 purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp);
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
323 g_free(tmp);
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
324 }
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
325 g_free(decoded);
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
326 }
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
327 break;
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
328 }
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
329 case 192: /* Pictures, aka Buddy Icons, checksum */
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
330 {
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
331 /* 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
332 * FIXME: fix up the strtol() stuff if possible. */
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
333 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
334 const char *locksum = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
335 PurpleBuddy *b;
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
336
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
337 if (!name)
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
338 break;
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
339
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
340 b = purple_find_buddy(gc->account, name);
9325
310b99e76887 [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
341
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
342 if (!cksum || (cksum == -1)) {
9325
310b99e76887 [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
343 if (f)
310b99e76887 [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
344 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
345 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL);
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
346 break;
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
347 }
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
348
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
349 if (!f)
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
350 break;
9325
310b99e76887 [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
351
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
352 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
353 if (b) {
7d28dd13c4db Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@pidgin.im>
parents: 17044
diff changeset
354 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
355 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
356 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
357 }
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
358
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
359 break;
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
360 }
2979
ea91012810b3 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2951
diff changeset
361 case 16: /* Custom error message */
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
362 {
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
363 char *tmp = yahoo_string_decode(gc, pair->value, TRUE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
364 purple_notify_error(gc, NULL, tmp, NULL);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
365 g_free(tmp);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
366 }
2951
fa9b438bf678 [gaim-migrate @ 2964]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
367 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
368 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
369 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
370 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
371 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
372 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
373 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
374 break;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
375 case 241: /* Federated network buddy belongs to */
27392
6f8b494ffe86 Deal with buddies on MSN more gracefully.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27391
diff changeset
376 break; /* We process this when get '7' */
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
377 default:
22811
2e0dca7ea23e I don't consider this an error.
Mark Doliner <markdoliner@pidgin.im>
parents: 22562
diff changeset
378 purple_debug_warning("yahoo",
5216
13074c9a7ab0 [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
379 "Unknown status key %d\n", pair->key);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
380 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
381 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
382
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
383 l = l->next;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
384 }
10553
89697092b958 [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
385
27393
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
386 if (f) {
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
387 if (pkt->service == YAHOO_SERVICE_LOGOFF)
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
388 f->status = YAHOO_STATUS_OFFLINE;
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
389 if (message)
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
390 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
391
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
392 if (name) /* update the last buddy */
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
393 yahoo_update_status(gc, name, f);
273326282c26 Detect properly when yahoo buddies go offline.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27392
diff changeset
394 }
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
395
28770
e4c2bbd158bc Fix a leak on status updates from federated buddies on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28737
diff changeset
396 g_free(fedname);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
397 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
398
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
399 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group)
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
400 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
401 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
402 PurpleGroup *g;
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
403 GSList *list, *i;
30459
f4706af0f5b9 Minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 30438
diff changeset
404 gboolean onlist = FALSE;
30463
0783be54e5d5 Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 30459
diff changeset
405 char *oname = NULL;
30459
f4706af0f5b9 Minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 30438
diff changeset
406
30467
3386dfa8ef65 So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30464
diff changeset
407 if (g_hash_table_lookup_extended(ht, name, (gpointer *)&oname, (gpointer *)&list))
3386dfa8ef65 So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30464
diff changeset
408 g_hash_table_steal(ht, oname);
30459
f4706af0f5b9 Minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 30438
diff changeset
409 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
410 list = purple_find_buddies(account, name);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
411
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
412 for (i = list; i; i = i->next) {
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
413 b = i->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
414 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
415 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
416 purple_debug_misc("yahoo",
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
417 "Oh good, %s is in the right group (%s).\n", name, group);
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
418 list = g_slist_delete_link(list, i);
30459
f4706af0f5b9 Minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 30438
diff changeset
419 onlist = TRUE;
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
420 break;
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
421 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
422 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
423
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
424 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
425 purple_debug_misc("yahoo",
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
426 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
427 if (!(g = purple_find_group(group))) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
428 g = purple_group_new(group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
429 purple_blist_add_group(g, NULL);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
430 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
431 b = purple_buddy_new(account, name, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
432 purple_blist_add_buddy(b, NULL, g, NULL);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
433 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
434
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
435 if (list) {
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
436 if (!oname)
30467
3386dfa8ef65 So it turns out the name vs oname thing wasn't a typo on Mark's part. I just
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30464
diff changeset
437 oname = g_strdup(name);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
438 g_hash_table_insert(ht, oname, list);
30459
f4706af0f5b9 Minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 30438
diff changeset
439 } else
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
440 g_free(oname);
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
441 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
442
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
443 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data)
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
444 {
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
445 char *name = key;
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
446 GSList *list = value, *i;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
447 PurpleBuddy *b;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
448 PurpleGroup *g;
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
449
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
450 for (i = list; i; i = i->next) {
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
451 b = i->data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
452 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
453 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
454 purple_group_get_name(g));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
455 purple_blist_remove_buddy(b);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
456 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
457 }
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
458
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
459 static char *_getcookie(char *rawcookie)
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
460 {
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
461 char *cookie = NULL;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
462 char *tmpcookie;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
463 char *cookieend;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
464
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
465 if (strlen(rawcookie) < 2)
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
466 return NULL;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
467 tmpcookie = g_strdup(rawcookie+2);
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
468 cookieend = strchr(tmpcookie, ';');
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
469
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
470 if (cookieend)
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
471 *cookieend = '\0';
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
472
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
473 cookie = g_strdup(tmpcookie);
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
474 g_free(tmpcookie);
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
475
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
476 return cookie;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
477 }
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
478
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
479 static void yahoo_process_cookie(YahooData *yd, char *c)
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
480 {
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
481 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
482 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
483 g_free(yd->cookie_y);
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
484 yd->cookie_y = _getcookie(c);
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
485 } 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
486 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
487 g_free(yd->cookie_t);
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
488 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
489 } else
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
490 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
491 yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c));
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
492 }
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
493
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
494 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt)
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
495 {
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
496 GSList *l = pkt->hash;
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
497
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
498 PurpleAccount *account = purple_connection_get_account(gc);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
499 YahooData *yd = gc->proto_data;
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
500 GHashTable *ht;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
501 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
502 char *temp = NULL;
14362
2174bcc05489 [gaim-migrate @ 16990]
Tim Ringenbach <marv@pidgin.im>
parents: 14347
diff changeset
503 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
2174bcc05489 [gaim-migrate @ 16990]
Tim Ringenbach <marv@pidgin.im>
parents: 14347
diff changeset
504 /* But what if you had no friends? */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
505 YahooFederation fed = YAHOO_FEDERATION_NONE;
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
506 int stealth = 0;
14362
2174bcc05489 [gaim-migrate @ 16990]
Tim Ringenbach <marv@pidgin.im>
parents: 14347
diff changeset
507
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
508 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
509
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
510 while (l) {
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
511 struct yahoo_pair *pair = l->data;
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
512 l = l->next;
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
513
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
514 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
515 case 302:
14699
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
516 /* 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
517 * 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
518 * 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
519 * 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
520 */
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
521 if (pair->value && !strcmp(pair->value, "320")) {
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
522 /* 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
523 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
524 yd->current_list15_grp = NULL;
14699
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
525 }
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
526
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
527 break;
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
528 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
529 if(temp != NULL) {
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
530 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
531 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
532 norm_bud = g_strconcat("msn/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
533 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
534 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
535 norm_bud = g_strconcat("ocs/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
536 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
537 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
538 norm_bud = g_strconcat("ibm/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
539 break;
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
540 case YAHOO_FEDERATION_PBX:
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
541 norm_bud = g_strconcat("pbx/", temp, NULL);
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
542 break;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
543 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
544 norm_bud = g_strdup(temp);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
545 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
546 }
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
547 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
548 /* 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
549 f = yahoo_friend_find_or_new(gc, norm_bud);
30626
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
550 if (!purple_find_buddy(account, norm_bud)) {
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
551 PurpleBuddy *b;
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
552 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
553 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
554 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
555 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
556 }
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
557 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
558 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
559 }
27390
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
560 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
561 if(fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
562 f->fed = fed;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
563 purple_debug_info("yahoo", "Setting federation to %d\n", f->fed);
27390
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
564 }
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
565 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
566 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
567
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
568 /* set p2p status not connected and no p2p packet sent */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
569 if(fed == YAHOO_FEDERATION_NONE) {
27390
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
570 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
571 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
572 } else
ef13fccec009 Fix another small leak. And update formatting of some code for readability.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27362
diff changeset
573 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
574 } 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
575 /* 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
576 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
577 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
578 }
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
579
28098
3f47f9bab77a Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <markdoliner@pidgin.im>
parents: 28076
diff changeset
580 g_free(norm_bud);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
581 norm_bud=NULL;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
582 fed = YAHOO_FEDERATION_NONE;
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
583 stealth = 0;
28098
3f47f9bab77a Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <markdoliner@pidgin.im>
parents: 28076
diff changeset
584 g_free(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
585 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
586 }
14699
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
587 break;
f4953b1a192e [gaim-migrate @ 17383]
Evan Schoenberg <evands@pidgin.im>
parents: 14693
diff changeset
588 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
589 break;
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
590 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
591 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
592 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
593 break;
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
594 case 7: /* buddy's s/n */
28098
3f47f9bab77a Fix two memory leaks. We were setting norm_bud and temp to NULL without
Mark Doliner <markdoliner@pidgin.im>
parents: 28076
diff changeset
595 g_free(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
596 temp = g_strdup(purple_normalize(account, pair->value));
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
597 break;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
598 case 241: /* user on federated network */
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
599 fed = strtol(pair->value, NULL, 10);
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
600 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
601 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
602 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
603 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
604 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
605 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
606 break;
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
607 /* case 242: */ /* this seems related to 241 */
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
608 /* break; */
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
609 }
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
610 }
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
611
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
612 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
613
27939
c483b6484733 Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27897
diff changeset
614 /* The reporter of ticket #9745 determined that we weren't retrieving the
c483b6484733 Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27897
diff changeset
615 * aliases during buddy list retrieval, so we never updated aliases that
c483b6484733 Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27897
diff changeset
616 * changed while we were signed off. */
c483b6484733 Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27897
diff changeset
617 yahoo_fetch_aliases(gc);
c483b6484733 Fix #9745 as the submitter suggested. This doesn't appear to hurt anything.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27897
diff changeset
618
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
619 /* 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
620 purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account)));
27897
7fac8d75d211 kevin_BB on irc was reporting that doing things on connect didn't work,
Ka-Hing Cheung <khc@pidgin.im>
parents: 27875
diff changeset
621 yd->logged_in = TRUE;
7fac8d75d211 kevin_BB on irc was reporting that doing things on connect didn't work,
Ka-Hing Cheung <khc@pidgin.im>
parents: 27875
diff changeset
622 purple_debug_info("yahoo","Authentication: Connection established\n");
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
623 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
624 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
625 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
626 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
627 }
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
628 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
629
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
630 g_hash_table_destroy(ht);
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
631 g_free(temp);
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
632 }
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
633
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
634 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
635 {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
636 GSList *l = pkt->hash;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
637 gboolean export = FALSE;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
638 gboolean got_serv_list = FALSE;
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
639 YahooFriend *f = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
640 PurpleAccount *account = purple_connection_get_account(gc);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
641 YahooData *yd = gc->proto_data;
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
642 GHashTable *ht;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
643
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
644 char **lines;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
645 char **split;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
646 char **buddies;
7823
88f397380ed3 [gaim-migrate @ 8475]
Tim Ringenbach <marv@pidgin.im>
parents: 7771
diff changeset
647 char **tmp, **bud, *norm_bud;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
648 char *grp = NULL;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
649
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
650 if (pkt->id)
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
651 yd->session_id = pkt->id;
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
652
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
653 while (l) {
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
654 struct yahoo_pair *pair = l->data;
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
655 l = l->next;
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
656
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
657 switch (pair->key) {
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
658 case 87:
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
659 if (!yd->tmp_serv_blist)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
660 yd->tmp_serv_blist = g_string_new(pair->value);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
661 else
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
662 g_string_append(yd->tmp_serv_blist, pair->value);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
663 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
664 case 88:
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
665 if (!yd->tmp_serv_ilist)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
666 yd->tmp_serv_ilist = g_string_new(pair->value);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
667 else
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
668 g_string_append(yd->tmp_serv_ilist, pair->value);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
669 break;
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
670 case 89:
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
671 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
672 break;
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
673 case 59: /* cookies, yum */
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
674 yahoo_process_cookie(yd, pair->value);
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
675 break;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
676 case YAHOO_SERVICE_PRESENCE_PERM:
12203
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
677 if (!yd->tmp_serv_plist)
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
678 yd->tmp_serv_plist = g_string_new(pair->value);
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
679 else
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
680 g_string_append(yd->tmp_serv_plist, pair->value);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
681 break;
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
682 }
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
683 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
684
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
685 if (pkt->status != 0)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
686 return;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
687
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
688 if (yd->tmp_serv_blist) {
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
689 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
690
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
691 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
692 for (tmp = lines; *tmp; tmp++) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
693 split = g_strsplit(*tmp, ":", 2);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
694 if (!split)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
695 continue;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
696 if (!split[0] || !split[1]) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
697 g_strfreev(split);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
698 continue;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
699 }
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
700 grp = yahoo_string_decode(gc, split[0], FALSE);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
701 buddies = g_strsplit(split[1], ",", -1);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
702 for (bud = buddies; bud && *bud; bud++) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
703 norm_bud = g_strdup(purple_normalize(account, *bud));
9279
f2884065a001 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
704 f = yahoo_friend_find_or_new(gc, norm_bud);
f2884065a001 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
705
30626
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
706 if (!purple_find_buddy(account, norm_bud)) {
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
707 PurpleBuddy *b;
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
708 PurpleGroup *g;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
709 if (!(g = purple_find_group(grp))) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
710 g = purple_group_new(grp);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
711 purple_blist_add_group(g, NULL);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
712 }
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
713 b = purple_buddy_new(account, norm_bud, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
714 purple_blist_add_buddy(b, NULL, g, NULL);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
715 export = TRUE;
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
716 }
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
717
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9284
diff changeset
718 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
719 /* 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
720 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
721 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
722
7823
88f397380ed3 [gaim-migrate @ 8475]
Tim Ringenbach <marv@pidgin.im>
parents: 7771
diff changeset
723 g_free(norm_bud);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
724 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
725 g_strfreev(buddies);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
726 g_strfreev(split);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
727 g_free(grp);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
728 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
729 g_strfreev(lines);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
730
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
731 g_string_free(yd->tmp_serv_blist, TRUE);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
732 yd->tmp_serv_blist = NULL;
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9284
diff changeset
733 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
6820
17d946b9bfe8 [gaim-migrate @ 7364]
Tim Ringenbach <marv@pidgin.im>
parents: 6810
diff changeset
734 g_hash_table_destroy(ht);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
735 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
736
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
737 if (yd->tmp_serv_ilist) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
738 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
739 for (bud = buddies; bud && *bud; bud++) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
740 /* The server is already ignoring the user */
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
741 got_serv_list = TRUE;
22364
1719b9cced93 Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 22359
diff changeset
742 purple_privacy_deny_add(account, *bud, 1);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
743 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
744 g_strfreev(buddies);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
745
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
746 g_string_free(yd->tmp_serv_ilist, TRUE);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
747 yd->tmp_serv_ilist = NULL;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
748 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
749
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
750 if (got_serv_list &&
22364
1719b9cced93 Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 22359
diff changeset
751 ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) &&
1719b9cced93 Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 22359
diff changeset
752 (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) &&
1719b9cced93 Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 22359
diff changeset
753 (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS)))
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
754 {
22364
1719b9cced93 Some very minor cleanup
Mark Doliner <markdoliner@pidgin.im>
parents: 22359
diff changeset
755 account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
756 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
757 account->username);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
758 }
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
759
12203
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
760 if (yd->tmp_serv_plist) {
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
761 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
762 for (bud = buddies; bud && *bud; bud++) {
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
763 f = yahoo_friend_find(gc, *bud);
12138
fcf3d84824d7 [gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12088
diff changeset
764 if (f) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
765 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
766 account->username, *bud);
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
767 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
12138
fcf3d84824d7 [gaim-migrate @ 14439]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12088
diff changeset
768 }
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
769 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
770 g_strfreev(buddies);
12203
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
771 g_string_free(yd->tmp_serv_plist, TRUE);
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
772 yd->tmp_serv_plist = NULL;
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
773
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
774 }
19058
9facc10e1c01 Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@pidgin.im>
parents: 19053
diff changeset
775 /* 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
776 yahoo_fetch_aliases(gc);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
777 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
778
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
779 /* 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
780 static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
781 {
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
782 PurpleAccount *account;
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
783 char *msg = NULL;
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
784 char *from = NULL;
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
785 char *stat = NULL;
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
786 char *game = NULL;
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
787 YahooFriend *f = NULL;
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
788 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
789 gint val_11 = 0;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
790 YahooData *yd = gc->proto_data;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
791 YahooFederation fed = YAHOO_FEDERATION_NONE;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
792
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
793 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
794
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
795 while (l) {
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
796 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
797 if (pair->key == 4 || pair->key == 1)
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
798 from = pair->value;
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
799 if (pair->key == 49)
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
800 msg = pair->value;
3001
9fc89391c8fa [gaim-migrate @ 3014]
Sean Egan <seanegan@pidgin.im>
parents: 2993
diff changeset
801 if (pair->key == 13)
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
802 stat = pair->value;
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
803 if (pair->key == 14)
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
804 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
805 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
806 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
807 if (pair->key == 241)
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
808 fed = strtol(pair->value, NULL, 10);
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
809 l = l->next;
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
810 }
3640
870c747e2117 [gaim-migrate @ 3763]
Sean Egan <seanegan@pidgin.im>
parents: 3630
diff changeset
811
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
812 if (!from || !msg)
3640
870c747e2117 [gaim-migrate @ 3763]
Sean Egan <seanegan@pidgin.im>
parents: 3630
diff changeset
813 return;
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
814
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
815 /* 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
816 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
817 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
818 /* 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
819 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
820 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
821 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
822
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
823 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
824 && (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
825 {
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
826 char *fed_from = from;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
827 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
828 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
829 fed_from = g_strconcat("msn/", from, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
830 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
831 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
832 fed_from = g_strconcat("ocs/", from, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
833 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
834 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
835 fed_from = g_strconcat("ibm/", from, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
836 break;
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
837 case YAHOO_FEDERATION_PBX:
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
838 fed_from = g_strconcat("pbx/", from, NULL);
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
839 break;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
840 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
841 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
842 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
843 }
30463
0783be54e5d5 Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 30459
diff changeset
844
31542
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
845 if (stat && *stat == '1')
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
846 serv_got_typing(gc, fed_from, 0, PURPLE_TYPING);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
847 else
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
848 serv_got_typing_stopped(gc, fed_from);
30463
0783be54e5d5 Initialize pointer, fix a typo to fix a crash.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 30459
diff changeset
849
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
850 if (fed_from != from)
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
851 g_free(fed_from);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
852
4793
1da93f6c80f3 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
853 } 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
854 PurpleBuddy *bud = purple_find_buddy(account, from);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
855
5216
13074c9a7ab0 [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
856 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
857 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
858 "%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
859 }
13074c9a7ab0 [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
860
9279
f2884065a001 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
861 f = yahoo_friend_find(gc, from);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
862 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
863 return; /* if they're not on the list, don't bother */
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
864
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
865 yahoo_friend_set_game(f, NULL);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
866
31542
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
867 if (stat && *stat == '1') {
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
868 yahoo_friend_set_game(f, game);
3020
121e08802117 [gaim-migrate @ 3033]
Sean Egan <seanegan@pidgin.im>
parents: 3019
diff changeset
869 if (bud)
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
870 yahoo_update_status(gc, from, f);
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
871 }
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
872 } 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
873 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
874 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
875 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
876 g_free(buf);
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
877 }
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
878 }
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
879
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
880
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
881 struct _yahoo_im {
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
882 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
883 char *active_id;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
884 int time;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
885 int utf8;
9284
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
886 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
887 char *id;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
888 char *msg;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
889 YahooFederation fed;
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
890 char *fed_from;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
891 };
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
892
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
893 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
894 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
895 PurpleAccount *account;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
896 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
897 struct _yahoo_im *sms = NULL;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
898 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
899 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
900 char *m;
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
901
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
902 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
903 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
904
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
905 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
906 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
907 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
908 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
909 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
910 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
911 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
912 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
913 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
914 if (sms)
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
915 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
916 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
917 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
918 if(sms)
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
919 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
920 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
921 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
922 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
923 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
924
31542
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
925 if(!sms) {
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
926 purple_debug_info("yahoo", "Received a malformed SMS packet!\n");
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
927 return;
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
928 }
3efb6fbae94a Fix CVE-2011-1091, improper handling of malformed YMSG packets cause NULL
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 31294
diff changeset
929
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
930 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
931 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
932 PurpleConversation *c;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
933 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
934 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
935 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
936 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
937 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
938 else
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
939 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
940
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
941 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
942 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
943 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
944 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
945
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
946 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
947 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
948 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
949 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
950
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
951 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
952 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
953
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
954 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
955 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
956 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
957 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
958
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
959 /* 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
960 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
961 {
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
962 PurpleAccount *account;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
963 YahooData *yd = gc->proto_data;
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
964 GSList *l = pkt->hash;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
965 GSList *list = NULL;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
966 struct _yahoo_im *im = NULL;
6069
9f46466c89f8 [gaim-migrate @ 6519]
Luke Schierer <lschiere@pidgin.im>
parents: 6061
diff changeset
967
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
968 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
969
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
970 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
971 /* 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
972 while (l != NULL) {
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
973 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
974 if (pair->key == 4 || pair->key == 1) {
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
975 im = g_new0(struct _yahoo_im, 1);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
976 list = g_slist_append(list, im);
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
977 im->from = pair->value;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
978 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
979 im->utf8 = TRUE;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
980 im->fed = YAHOO_FEDERATION_NONE;
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
981 im->fed_from = g_strdup(im->from);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
982 }
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
983 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
984 im->active_id = pair->value;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
985 if (pair->key == 97)
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
986 if (im)
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
987 im->utf8 = strtol(pair->value, NULL, 10);
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
988 if (pair->key == 15)
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
989 if (im)
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
990 im->time = strtol(pair->value, NULL, 10);
9284
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
991 if (pair->key == 206)
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
992 if (im)
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
993 im->buddy_icon = strtol(pair->value, NULL, 10);
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
994 if (pair->key == 14) {
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
995 if (im)
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
996 im->msg = pair->value;
6687
39462117d34d [gaim-migrate @ 7213]
Nandan Dixit
parents: 6686
diff changeset
997 }
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
998 if (im && pair->key == 241) {
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
999 im->fed = strtol(pair->value, NULL, 10);
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1000 g_free(im->fed_from);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1001 switch (im->fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1002 case YAHOO_FEDERATION_MSN:
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1003 im->fed_from = g_strconcat("msn/",im->from, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1004 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1005 case YAHOO_FEDERATION_OCS:
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1006 im->fed_from = g_strconcat("ocs/",im->from, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1007 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1008 case YAHOO_FEDERATION_IBM:
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1009 im->fed_from = g_strconcat("ibm/",im->from, NULL);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1010 break;
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
1011 case YAHOO_FEDERATION_PBX:
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
1012 im->fed_from = g_strconcat("pbx/",im->from, NULL);
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
1013 break;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1014 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1015 default:
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1016 im->fed_from = g_strdup(im->from);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1017 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1018 }
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1019 purple_debug_info("yahoo", "Message from federated (%d) buddy %s.\n", im->fed, im->fed_from);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1020
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
1021 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
1022 /* peer session id */
28736
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1023 if (im && (pair->key == 11)) {
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1024 /* disconnect the peer if connected through p2p and sends wrong value for session id */
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
1025 if( (im->fed == YAHOO_FEDERATION_NONE) && (pkt_type == YAHOO_PKT_TYPE_P2P)
28736
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1026 && (yd->session_id != strtol(pair->value, NULL, 10)) )
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1027 {
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1028 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->fed_from);
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1029 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1030 g_hash_table_remove(yd->peers, im->fed_from);
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1031 g_free(im->fed_from);
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1032 g_free(im);
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1033 return; /* Not sure whether we should process remaining IMs in this packet */
a6850b9696d3 Make checking of p2p packet with invalid id per IM instead of per packet.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28735
diff changeset
1034 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
1035 }
11801
c19b37ac661b [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
1036 /* IMV key */
28737
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1037 if (im && pair->key == 63)
11475
1e222e6e52a0 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
1038 {
28737
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1039 /* Check for the Doodle IMV, no IMvironment for federated buddies */
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1040 if (im->from != NULL && im->fed == YAHOO_FEDERATION_NONE)
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1041 {
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1042 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(pair->value));
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1043
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1044 if (strstr(pair->value, "doodle;") != NULL)
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1045 {
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1046 PurpleWhiteboard *wb;
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1047
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1048 if (!purple_privacy_check(account, im->from)) {
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1049 purple_debug_info("yahoo", "Doodle request from %s dropped.\n",
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1050 im->from);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1051 g_free(im->fed_from);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1052 g_free(im);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1053 return;
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1054 }
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1055 /* I'm not sure the following ever happens -DAA */
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1056 wb = purple_whiteboard_get_session(account, im->from);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1057
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1058 /* If a Doodle session doesn't exist between this user */
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1059 if(wb == NULL)
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1060 {
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1061 doodle_session *ds;
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1062 wb = purple_whiteboard_create(account, im->from,
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1063 DOODLE_STATE_REQUESTED);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1064 ds = wb->proto_data;
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1065 ds->imv_key = g_strdup(pair->value);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1066
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1067 yahoo_doodle_command_send_request(gc, im->from, pair->value);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1068 yahoo_doodle_command_send_ready(gc, im->from, pair->value);
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1069 }
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1070 }
937fe5fc26bb Implement IMvironment check per IM, not global
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28736
diff changeset
1071 }
11475
1e222e6e52a0 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
1072 }
27353
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1073 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
1074 if (im)
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1075 im->id = pair->value;
6691
fecdc585c292 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
1076 l = l->next;
6687
39462117d34d [gaim-migrate @ 7213]
Nandan Dixit
parents: 6686
diff changeset
1077 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1078 } else if (pkt->status == 2) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1079 purple_notify_error(gc, NULL,
10386
6fcc45a26a16 [gaim-migrate @ 11612]
Daniel Atallah <datallah@pidgin.im>
parents: 10379
diff changeset
1080 _("Your Yahoo! message did not get sent."), NULL);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1081 }
11608
07a4d5ffdb08 [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
1082
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1083 for (l = list; l; l = l->next) {
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
1084 YahooFriend *f;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1085 char *m, *m2;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1086 im = l->data;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1087
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1088 if (!im->fed_from || !im->msg) {
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1089 g_free(im->fed_from);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1090 g_free(im);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1091 continue;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1092 }
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1093
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1094 if (!purple_privacy_check(account, im->fed_from)) {
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1095 purple_debug_info("yahoo", "Message from %s dropped.\n", im->fed_from);
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
1096 return;
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
1097 }
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
1098
27353
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1099 /*
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1100 * 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
1101 * 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
1102 */
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1103 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
1104 /* 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
1105 * 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
1106 * 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
1107 * 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
1108 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
1109 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
1110 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
1111 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
1112 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
1113 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
1114 302, 430,
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1115 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
1116 303, 430,
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1117 450, 0);
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1118 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
1119 }
f45f69e45658 New versions of the official Yahoo Messenger client for Windows XP (tested
Mark Doliner <markdoliner@pidgin.im>
parents: 27350
diff changeset
1120
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1121 m = yahoo_string_decode(gc, im->msg, im->utf8);
12994
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1122 /* This may actually not be necessary, but it appears
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1123 * that at least at one point some clients were sending
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1124 * "\r\n" as line delimiters, so we want to avoid double
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1125 * lines. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1126 m2 = purple_strreplace(m, "\r\n", "\n");
12994
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1127 g_free(m);
8340178b7b16 [gaim-migrate @ 15347]
Daniel Atallah <datallah@pidgin.im>
parents: 12970
diff changeset
1128 m = m2;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1129 purple_util_chrreplace(m, '\r', '\n');
8375
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1130 if (!strcmp(m, "<ding>")) {
29481
d35bf64a2082 Fix compilation error
Marcus Lundblad <malu@pidgin.im>
parents: 29478
diff changeset
1131 PurpleConversation *conv = NULL;
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
1132 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
1133
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1134 username = g_markup_escape_text(im->fed_from, -1);
29481
d35bf64a2082 Fix compilation error
Marcus Lundblad <malu@pidgin.im>
parents: 29478
diff changeset
1135 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_ANY,
d35bf64a2082 Fix compilation error
Marcus Lundblad <malu@pidgin.im>
parents: 29478
diff changeset
1136 username, account);
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
1137 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
1138 g_free(username);
8375
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1139 g_free(m);
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1140 g_free(im->fed_from);
8375
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1141 g_free(im);
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1142 continue;
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1143 }
13448d864067 [gaim-migrate @ 9102]
Tim Ringenbach <marv@pidgin.im>
parents: 8357
diff changeset
1144
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1145 m2 = yahoo_codes_to_html(m);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1146 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
1147
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1148 serv_got_im(gc, im->fed_from, m2, 0, im->time);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1149 g_free(m2);
9284
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
1150
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1151 /* Official clients don't share buddy images with federated buddies */
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1152 if (im->fed == YAHOO_FEDERATION_NONE) {
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
1153 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
1154 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
1155 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
1156 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
1157 }
9284
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
1158 }
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
1159 }
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
1160
28735
9b4309506bb1 Fix a crash on receiving an offline message from a federated buddy. Also handle federated buddy per IM. Refs #9814
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28680
diff changeset
1161 g_free(im->fed_from);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1162 g_free(im);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1163 }
28680
732d7332dd15 Yahoo prpl is crashing everytime a message from a yahoo buddy is received (have not checked federated ids).
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28660
diff changeset
1164
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1165 g_slist_free(list);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1166 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1167
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1168 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt)
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1169 {
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1170 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
1171 char *prim, *me = NULL, *msg = NULL;
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1172
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1173 while (l) {
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1174 struct yahoo_pair *pair = l->data;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1175
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1176 if (pair->key == 5)
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1177 me = pair->value;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1178 if (pair->key == 14)
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1179 msg = pair->value;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1180
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1181 l = l->next;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1182 }
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1183
10070
a0439e0afbb0 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
1184 if (!msg || !g_utf8_validate(msg, -1, NULL))
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1185 return;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1186
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1187 prim = g_strdup_printf(_("Yahoo! system message for %s:"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1188 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
1189 purple_notify_info(NULL, NULL, prim, msg);
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1190 g_free(prim);
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1191 }
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
1192
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1193 struct yahoo_add_request {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1194 PurpleConnection *gc;
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1195 char *id;
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1196 char *who;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1197 YahooFederation fed;
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1198 };
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1199
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1200 static void
22359
64502566f95b Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents: 22277
diff changeset
1201 yahoo_buddy_add_authorize_cb(gpointer data)
64502566f95b Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents: 22277
diff changeset
1202 {
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
1203 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
1204 struct yahoo_packet *pkt;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
1205 YahooData *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
1206 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
1207
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1208 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, yd->session_id);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1209 if (add_req->fed) {
27391
5c3a78516695 Turns out we need to exclude 'msn/' when authorizing a buddy.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27390
diff changeset
1210 who += 4;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1211 yahoo_packet_hash(pkt, "ssiii",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1212 1, add_req->id,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1213 5, who,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1214 241, add_req->fed,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1215 13, 1,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1216 334, 0);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1217 }
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1218 else {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1219 yahoo_packet_hash(pkt, "ssii",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1220 1, add_req->id,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1221 5, who,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1222 13, 1,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1223 334, 0);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1224 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1225
19411
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1226 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
1227
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1228 g_free(add_req->id);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1229 g_free(add_req->who);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1230 g_free(add_req);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1231 }
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1232
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1233 static void
22359
64502566f95b Revert d893d4c42706b930232e3b4007bc5bed063cda32 because the code is
Mark Doliner <markdoliner@pidgin.im>
parents: 22277
diff changeset
1234 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
1235 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
1236 YahooData *yd = add_req->gc->proto_data;
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1237 struct yahoo_packet *pkt;
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1238 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
1239 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
1240
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1241 if (msg && *msg)
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1242 encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1243
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1244 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
1245 YAHOO_STATUS_AVAILABLE, yd->session_id);
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1246
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1247 if (add_req->fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1248 who += 4; /* Skip fed identifier (msn|ocs|ibm)/' */
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1249 yahoo_packet_hash(pkt, "ssiiiis",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1250 1, add_req->id,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1251 5, who,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1252 241, add_req->fed,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1253 13, 2,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1254 334, 0,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1255 97, 1,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1256 14, encoded_msg ? encoded_msg : "");
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1257 }
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1258 else {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1259 yahoo_packet_hash(pkt, "ssiiis",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1260 1, add_req->id,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1261 5, who,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1262 13, 2,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1263 334, 0,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1264 97, 1,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1265 14, encoded_msg ? encoded_msg : "");
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1266 }
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1267
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1268
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1269 yahoo_packet_send_and_free(pkt, yd);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1270
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1271 g_free(encoded_msg);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1272
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1273 g_free(add_req->id);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1274 g_free(add_req->who);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1275 g_free(add_req);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1276 }
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1277
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1278 static void
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1279 yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg)
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1280 {
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1281 yahoo_buddy_add_deny_cb(add_req, NULL);
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1282 }
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1283
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1284 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
1285 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
1286 struct yahoo_add_request *add_req = data;
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
1287 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
1288 NULL, _("No reason given."), TRUE, FALSE, NULL,
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1289 _("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
1290 _("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
1291 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
1292 add_req);
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1293 }
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1294
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1295 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
1296 {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1297 char *notify_msg;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
1298 YahooData *yd = gc->proto_data;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1299
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1300 if (who == NULL)
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1301 return;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1302
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1303 if (reason != NULL) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1304 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
1305 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
1306 g_free(msg2);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1307 } else
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1308 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
1309
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1310 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
1311 g_free(notify_msg);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1312
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1313 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
1314 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
1315 /* 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
1316 }
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1317
19411
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1318 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
1319 PurpleAccount *account;
19411
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1320 GSList *l = pkt->hash;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1321 const char *msg = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1322
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1323 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
1324
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1325 /* Buddy authorized/declined our addition */
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1326 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
1327 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
1328 char *who = NULL;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1329 int response = 0;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1330 YahooFederation fed = YAHOO_FEDERATION_NONE;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1331
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1332 while (l) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1333 struct yahoo_pair *pair = l->data;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1334
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1335 switch (pair->key) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1336 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
1337 temp = pair->value;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1338 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1339 case 13:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1340 response = strtol(pair->value, NULL, 10);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1341 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1342 case 14:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1343 msg = pair->value;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1344 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
1345 case 241:
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1346 fed = 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
1347 break;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1348 }
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1349 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
1350 }
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1351
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1352 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1353 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1354 who = g_strconcat("msn/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1355 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1356 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1357 who = g_strconcat("ocs/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1358 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1359 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1360 who = g_strconcat("ibm/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1361 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1362 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1363 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1364 who = g_strdup(temp);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1365 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1366 }
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
1367
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1368 if (response == 1) /* Authorized */
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1369 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
1370 else if (response == 2) { /* Declined */
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1371 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
1372 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
1373 } else
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1374 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
1375 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
1376 }
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1377 /* Buddy requested authorization to add us. */
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1378 else if (pkt->status == 3) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1379 struct yahoo_add_request *add_req;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1380 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
1381 char *temp = NULL;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1382
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1383 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
1384 add_req->gc = gc;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1385 add_req->fed = YAHOO_FEDERATION_NONE;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1386
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1387 while (l) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1388 struct yahoo_pair *pair = l->data;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1389
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1390 switch (pair->key) {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1391 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
1392 temp = pair->value;
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1393 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1394 case 5:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1395 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
1396 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1397 case 14:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1398 msg = pair->value;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1399 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1400 case 216:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1401 firstname = pair->value;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1402 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1403 case 241:
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1404 add_req->fed = strtol(pair->value, NULL, 10);
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1405 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1406 case 254:
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1407 lastname = pair->value;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1408 break;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1409
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1410 }
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1411 l = l->next;
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1412 }
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1413 switch (add_req->fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1414 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1415 add_req->who = g_strconcat("msn/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1416 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1417 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1418 add_req->who = g_strconcat("ocs/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1419 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1420 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1421 add_req->who = g_strconcat("ibm/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1422 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1423 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1424 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1425 add_req->who = g_strdup(temp);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1426 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
1427 }
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1428
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
1429 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
1430 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
1431
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1432 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
1433 {
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
1434 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
1435 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
1436 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
1437 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
1438 }
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
1439
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1440 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
1441 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
1442
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1443 if (firstname && lastname)
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1444 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
1445 else if (firstname)
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1446 alias = g_strdup(firstname);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1447 else if (lastname)
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1448 alias = g_strdup(lastname);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1449
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1450 /* 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
1451 * 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
1452 */
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1453 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
1454 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
1455 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
1456 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
1457 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
1458 add_req);
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1459 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
1460 g_free(dec_msg);
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1461 } else {
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1462 g_free(add_req->id);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1463 g_free(add_req->who);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1464 g_free(add_req);
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1465 }
19411
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1466 } else {
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1467 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
1468 }
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1469 }
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
1470
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
1471 /* I don't think this happens anymore in Version 15 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1472 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
1473 PurpleAccount *account;
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1474 struct yahoo_add_request *add_req;
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1475 char *msg = NULL;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1476 GSList *l = pkt->hash;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1477
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1478 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
1479
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1480 add_req = g_new0(struct yahoo_add_request, 1);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1481 add_req->gc = gc;
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1482
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1483 while (l) {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1484 struct yahoo_pair *pair = l->data;
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1485
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1486 switch (pair->key) {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1487 case 1:
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1488 add_req->id = g_strdup(pair->value);
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1489 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1490 case 3:
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1491 add_req->who = g_strdup(pair->value);
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1492 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1493 case 15: /* time, for when they add us and we're offline */
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1494 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1495 case 14:
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1496 msg = pair->value;
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1497 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1498 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1499 l = l->next;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1500 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1501
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
1502 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
1503 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
1504
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1505 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
1506 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
1507 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
1508 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
1509 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
1510 }
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
1511
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1512 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
1513 dec_msg = yahoo_string_decode(gc, msg, FALSE);
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1514
15119
28d34487ac71 [gaim-migrate @ 17841]
Sean Egan <seanegan@pidgin.im>
parents: 15062
diff changeset
1515 /* 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
1516 * this should probably be moved to the core.
11644
939411169d01 [gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11643
diff changeset
1517 */
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
1518 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
1519 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
1520 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
1521 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
1522 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
1523 g_free(dec_msg);
11109
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1524 } else {
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1525 g_free(add_req->id);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1526 g_free(add_req->who);
d90b1fa34259 [gaim-migrate @ 13161]
Daniel Atallah <datallah@pidgin.im>
parents: 11078
diff changeset
1527 g_free(add_req);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1528 }
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1529 }
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1530
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1531 /* 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
1532 static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt)
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1533 {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1534 char *who = NULL;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1535 char *msg = NULL;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1536 GSList *l = pkt->hash;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1537
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1538 while (l) {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1539 struct yahoo_pair *pair = l->data;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1540
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1541 switch (pair->key) {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1542 case 3:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1543 who = pair->value;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1544 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1545 case 14:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1546 msg = pair->value;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1547 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1548 }
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1549 l = l->next;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1550 }
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1551
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1552 yahoo_buddy_denied_our_add(gc, who, msg);
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1553 }
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1554
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1555 static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt)
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1556 {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1557 switch (pkt->status) {
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1558 case 1:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1559 yahoo_process_status(gc, pkt);
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1560 return;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1561 case 3:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1562 yahoo_buddy_added_us(gc, pkt);
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1563 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1564 case 7:
19540
5966b84d99ed Fix various things related to authorization on yahoo.
Daniel Atallah <datallah@pidgin.im>
parents: 19538
diff changeset
1565 yahoo_buddy_denied_our_add_old(gc, pkt);
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1566 break;
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1567 default:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
1568 break;
2683
06507dfdd96c [gaim-migrate @ 2696]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2682
diff changeset
1569 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1570 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1571
7747
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1572 #define OUT_CHARSET "utf-8"
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1573
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1574 static char *yahoo_decode(const char *text)
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1575 {
9221
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1576 char *converted = NULL;
8125
d172f84dbfe2 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1577 char *n, *new;
d172f84dbfe2 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1578 const char *end, *p;
8616
def20c824c3a [gaim-migrate @ 9367]
Ethan Blanton <elb@pidgin.im>
parents: 8591
diff changeset
1579 int i, k;
8125
d172f84dbfe2 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1580
7771
2630e726f818 [gaim-migrate @ 8416]
Nathan Walp <nwalp@pidgin.im>
parents: 7747
diff changeset
1581 n = new = g_malloc(strlen (text) + 1);
8118
7f5315bb4506 [gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents: 8113
diff changeset
1582 end = text + strlen(text);
7f5315bb4506 [gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents: 8113
diff changeset
1583
8125
d172f84dbfe2 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1584 for (p = text; p < end; p++, n++) {
7747
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1585 if (*p == '\\') {
9064
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1586 if (p[1] >= '0' && p[1] <= '7') {
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1587 p += 1;
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1588 for (i = 0, k = 0; k < 3; k += 1) {
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1589 char c = p[k];
9065
0342389f745c [gaim-migrate @ 9841]
Tim Ringenbach <marv@pidgin.im>
parents: 9064
diff changeset
1590 if (c < '0' || c > '7') break;
9064
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1591 i *= 8;
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1592 i += c - '0';
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1593 }
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1594 *n = i;
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1595 p += k - 1;
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1596 } else { /* bug 959248 */
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1597 /* If we see a \ not followed by an octal number,
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1598 * it means that it is actually a \\ with one \
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1599 * already eaten by some unknown function.
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1600 * This is arguably broken.
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1601 *
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1602 * I think wing is wrong here, there is no function
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1603 * called that I see that could have done it. I guess
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1604 * it is just really sending single \'s. That's yahoo
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1605 * for you.
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1606 */
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1607 *n = *p;
41c3415cc9ec [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1608 }
7747
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1609 }
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1610 else
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1611 *n = *p;
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1612 }
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1613
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1614 *n = '\0';
8125
d172f84dbfe2 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1615
9221
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1616 if (strstr(text, "\033$B"))
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1617 converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL);
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1618 if (!converted)
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1619 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
1620 g_free(new);
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1621
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1622 return converted;
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1623 }
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1624
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1625 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1626 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1627 PurpleAccount *account = purple_connection_get_account(gc);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
1628 YahooData *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
1629 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
1630 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
1631 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
1632 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1633 int count = 0;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1634 GSList *l = pkt->hash;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1635
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1636 if (!purple_account_get_check_mail(account))
5521
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1637 return;
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1638
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1639 while (l) {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1640 struct yahoo_pair *pair = l->data;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1641 if (pair->key == 9)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1642 count = strtol(pair->value, NULL, 10);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1643 else if (pair->key == 43)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1644 who = pair->value;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1645 else if (pair->key == 42)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1646 email = pair->value;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1647 else if (pair->key == 18)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1648 subj = pair->value;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1649 l = l->next;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1650 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1651
4001
ec3725a49136 [gaim-migrate @ 4201]
Luke Schierer <lschiere@pidgin.im>
parents: 3996
diff changeset
1652 if (who && subj && email && *email) {
7747
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1653 char *dec_who = yahoo_decode(who);
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1654 char *dec_subj = yahoo_decode(subj);
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1655 char *from = g_strdup_printf("%s (%s)", dec_who, email);
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1656
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1657 purple_notify_email(gc, dec_subj, from, purple_account_get_username(account),
9221
cae2261ba6f2 [gaim-migrate @ 10017]
Ambrose Li <ambrose.li@gmail.com>
parents: 9220
diff changeset
1658 yahoo_mail_url, NULL, NULL);
5521
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1659
7747
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1660 g_free(dec_who);
ce63da454857 [gaim-migrate @ 8392]
Felipe Contreras <felipe.contreras@gmail.com>
parents: 7696
diff changeset
1661 g_free(dec_subj);
2850
783e46199cb4 [gaim-migrate @ 2863]
abiligiri
parents: 2813
diff changeset
1662 g_free(from);
5521
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1663 } 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
1664 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
1665 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
1666
baa7cbe5775a correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@pidgin.im>
parents: 26892
diff changeset
1667 purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls,
5521
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1668 NULL, NULL);
fca5b7c1340d [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1669 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
1670 }
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
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
1672 /* 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
1673 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
1674 {
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 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
1676 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
1677 };
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
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1679 /* 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
1680 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1681
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
1682 /* 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
1683 * 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
1684 static void to_y64(char *out, const unsigned char *in, gsize inlen)
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1685 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1686 {
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1687 for (; inlen >= 3; inlen -= 3)
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1688 {
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1689 *out++ = base64digits[in[0] >> 2];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1690 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1691 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1692 *out++ = base64digits[in[2] & 0x3f];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1693 in += 3;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1694 }
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1695 if (inlen > 0)
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1696 {
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1697 unsigned char fragment;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1698
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1699 *out++ = base64digits[in[0] >> 2];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1700 fragment = (in[0] << 4) & 0x30;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1701 if (inlen > 1)
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1702 fragment |= in[1] >> 4;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1703 *out++ = base64digits[fragment];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1704 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c];
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1705 *out++ = '-';
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1706 }
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1707 *out = '\0';
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1708 }
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
1709
27051
122397350352 Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents: 27049
diff changeset
1710 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt)
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
1711 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
1712 YahooData *yd = gc->proto_data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1713 PurpleAccount *account = purple_connection_get_account(gc);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1714 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
1715 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
1716 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
1717 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
1718 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
1719 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
1720
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 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n");
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
1722
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1723 md5_cipher = purple_ciphers_find_cipher("md5");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
1724 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
1725 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
1726 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
1727
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
1728 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
1729
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
1730 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
1731 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1732
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1733 if(yd->cookie_b) { /* send B cookie if we have it */
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1734 yahoo_packet_hash(pkt, "ssssssssss",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1735 1, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1736 0, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1737 277, yd->cookie_y,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1738 278, yd->cookie_t,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1739 307, base64_string,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1740 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1741 2, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1742 2, "1",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1743 59, yd->cookie_b,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1744 98, purple_account_get_string(account, "room_list_locale", yd->jp ? "jp" : "us"),
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1745 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1746 } else { /* don't try to send an empty B cookie - the server will be mad */
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1747 yahoo_packet_hash(pkt, "sssssssss",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1748 1, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1749 0, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1750 277, yd->cookie_y,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1751 278, yd->cookie_t,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1752 307, base64_string,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1753 244, yd->jp ? YAHOOJP_CLIENT_VERSION_ID : YAHOO_CLIENT_VERSION_ID,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1754 2, name,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1755 2, "1",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1756 98, purple_account_get_string(account, "room_list_locale", yd->jp ? "jp" : "us"),
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1757 135, yd->jp ? YAHOOJP_CLIENT_VERSION : YAHOO_CLIENT_VERSION);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1758 }
27852
693eb3cdb798 Clean up a case of unnecessarily duplicated code.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27851
diff changeset
1759
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 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
1761 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
1762 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
1763
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 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
1765 }
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
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1767 static gchar *yahoo_auth16_get_cookie_b(gchar *headers)
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1768 {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1769 gchar **splits = g_strsplit(headers, "\r\n", -1);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1770 gchar *tmp = NULL, *tmp2 = NULL, *sem = NULL;
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1771 int elements = g_strv_length(splits), i;
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1772
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1773 if(elements > 1) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1774 for(i = 0; i < elements; i++) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1775 if(g_ascii_strncasecmp(splits[i], "Set-Cookie: B=", 14) == 0) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1776 tmp = &splits[i][14];
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1777 sem = strchr(tmp, ';');
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1778
29981
583d44798d66 Fix a typo and a memleak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29980
diff changeset
1779 if (sem != NULL) {
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1780 tmp2 = g_strndup(tmp, sem - tmp);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1781 purple_debug_info("yahoo", "Got needed part of B cookie: %s\n",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1782 tmp2 ? tmp2 : "(null)");
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1783 break;
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1784 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1785 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1786 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1787 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1788
29981
583d44798d66 Fix a typo and a memleak.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 29980
diff changeset
1789 g_strfreev(splits);
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1790 return tmp2;
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1791 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1792
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1793 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *url_data, 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
1794 {
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 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
1796 PurpleConnection *gc = auth_data->gc;
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1797 YahooData *yd = purple_connection_get_protocol_data(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
1798 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
1799
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
1800 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
1801
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1802 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1803
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
1804 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
1805 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
1806 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
1807 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
1808 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
1809 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
1810 }
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 else if (len > 0 && ret_data && *ret_data) {
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1812 gchar **splits = g_strsplit(ret_data, "\r\n\r\n", -1), **split_data = NULL;
27357
6dad1279efcd g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 27353
diff changeset
1813 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
1814 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
1815 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
1816 char *crypt = NULL;
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
1817
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1818 if(g_strv_length(splits) > 1) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1819 yd->cookie_b = yahoo_auth16_get_cookie_b(splits[0]);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1820 split_data = g_strsplit(splits[1], "\r\n", -1);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1821 totalelements = g_strv_length(split_data);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1822 }
29491
31c1d615772e Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28327
diff changeset
1823
27463
439fc4b40125 Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27461
diff changeset
1824 if (totalelements >= 4) {
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1825 int i;
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1826
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1827 for(i = 0; i < totalelements; i++) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1828 /* I'm not exactly a fan of the magic numbers, but it's obvious,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1829 * so no sense in wasting a bajillion vars or calls to strlen */
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1830
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1831 if(g_ascii_isdigit(split_data[i][0])) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1832 /* if the current line and the next line both start with numbers,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1833 * the current line is the length of the body, so skip. If not,
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1834 * then the current line is the response code from the login process. */
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1835 if(!g_ascii_isdigit(split_data[i + 1][0])) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1836 response_no = strtol(split_data[i], NULL, 10);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1837 purple_debug_info("yahoo", "Got auth16 stage 2 response code: %d\n",
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1838 response_no);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1839 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1840 } else if(strncmp(split_data[i], "crumb=", 6) == 0) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1841 crumb = g_strdup(&split_data[i][6]);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1842
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1843 if(purple_debug_is_unsafe())
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1844 purple_debug_info("yahoo", "Got crumb: %s\n", crumb);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1845
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1846 } else if(strncmp(split_data[i], "Y=", 2) == 0) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1847 yd->cookie_y = g_strdup(&split_data[i][2]);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1848
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1849 if(purple_debug_is_unsafe())
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1850 purple_debug_info("yahoo", "Got Y cookie: %s\n", yd->cookie_y);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1851
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1852 } else if(strncmp(split_data[i], "T=", 2) == 0) {
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1853 yd->cookie_t = g_strdup(&split_data[i][2]);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1854
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1855 if(purple_debug_is_unsafe())
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1856 purple_debug_info("yahoo", "Got T cookie: %s\n", yd->cookie_t);
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1857 }
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1858 }
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
1859 }
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
1860
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
1861 g_strfreev(splits);
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
1862 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
1863
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
1864 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
1865 /* 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
1866 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
1867 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
1868
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
1869 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
1870 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
1871 /* 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
1872 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
1873 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
1874 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
1875 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
1876 /* 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
1877 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
1878 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
1879 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
1880 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
1881 /* 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
1882 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
1883 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
1884 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
1885 }
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
1886 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
1887 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
1888 break;
8349
0319a2f4d61d [gaim-migrate @ 9073]
Sean Egan <seanegan@pidgin.im>
parents: 8243
diff changeset
1889 }
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
1890 if(error_reason) {
27753
3b896476d181 yahoo: Add the error code to the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents: 27747
diff changeset
1891 purple_debug_error("yahoo", "Authentication error: %s. "
3b896476d181 yahoo: Add the error code to the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents: 27747
diff changeset
1892 "Code %d\n", error_reason, 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
1893 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
1894 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
1895 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
1896 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
1897 return;
8349
0319a2f4d61d [gaim-migrate @ 9073]
Sean Egan <seanegan@pidgin.im>
parents: 8243
diff changeset
1898 }
0319a2f4d61d [gaim-migrate @ 9073]
Sean Egan <seanegan@pidgin.im>
parents: 8243
diff changeset
1899 }
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
1900
27051
122397350352 Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents: 27049
diff changeset
1901 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
1902 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
1903 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
1904 g_free(crumb);
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
1905 }
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
1906 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
1907 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
1908 }
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
1909
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1910 static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *url_data, 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
1911 {
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
1912 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
1913 PurpleConnection *gc = auth_data->gc;
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1914 YahooData *yd = purple_connection_get_protocol_data(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
1915
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 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
1917
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
1918 yd->url_datas = g_slist_remove(yd->url_datas, url_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
1919
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
1920 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
1921 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
1922 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
1923 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
1924 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
1925 return;
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
1926 }
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
1927 else if (len > 0 && ret_data && *ret_data) {
29870
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1928 PurpleAccount *account = purple_connection_get_account(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
1929 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
1930 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
1931 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
1932 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
1933
27357
6dad1279efcd g_strv_length() is only available in glib2 2.6 and newer
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 27353
diff changeset
1934 totalelements = g_strv_length(split_data);
29491
31c1d615772e Kill off unneeded GLIB_CHECK_VERSION checks in libpurple. Refs #10024.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28327
diff changeset
1935
29870
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1936 if(totalelements == 1) { /* Received an error code */
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
1937 response_no = strtol(split_data[0], NULL, 10);
29870
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1938 } else if(totalelements == 2 || totalelements == 3 ) { /* received valid data */
27463
439fc4b40125 Fix how we process certain data we get from the server.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27461
diff changeset
1939 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
1940 token = g_strdup(split_data[1] + strlen("ymsgr="));
29870
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1941 } else { /* It looks like a transparent proxy has returned a document we don't want */
29869
0a5078a3e0fe Attempt to handle transparent proxies that return documents instead of errors.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29694
diff changeset
1942 response_no = -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
1943 }
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
1944
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
1945 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
1946
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
1947 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
1948 /* 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
1949 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
1950 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
1951
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
1952 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
1953 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
1954 /* 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
1955 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
1956 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
1957 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
1958 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
1959 /* 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
1960 /* Set password to NULL. Avoids account locking. Brings dialog to enter password if clicked on Re-enable account */
29870
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1961 if (!purple_account_get_remember_password(account))
4db9a65d5c5f Document the code I just touched, and use a convenience variable in a couple
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29869
diff changeset
1962 purple_account_set_password(account, NULL);
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
1963 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
1964 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
1965 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
1966 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
1967 /* security lock from too many failed login attempts */
29958
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1968 error_reason = g_strdup(_("Account locked: Too many failed login "
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1969 "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
1970 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
1971 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
1972 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
1973 /* 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
1974 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
1975 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
1976 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
1977 case 1214:
29958
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1978 /* indicates a lock of some description */
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1979 error_reason = g_strdup(_("Account locked: Unknown reason. Logging "
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1980 "into the Yahoo! website may fix this."));
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1981 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1982 break;
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
1983 case 1236:
29958
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1984 /* indicates a lock due to logging in too frequently */
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1985 error_reason = g_strdup(_("Account locked: You have been logging in too "
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1986 "frequently. Wait a few minutes before trying to connect "
730ca5d46637 Clarify an error condition I was able to duplicate reliably last night.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29955
diff changeset
1987 "again. Logging into the Yahoo! website may help."));
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
1988 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
1989 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
1990 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
1991 /* 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
1992 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
1993 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
1994 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
1995 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
1996 /* Unknown error! */
27772
bee35b5d6599 Don't break string freeze.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 27771
diff changeset
1997 error_reason = g_strdup_printf(_("Unknown error (%d)"), 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
1998 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
1999 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
2000 }
27753
3b896476d181 yahoo: Add the error code to the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents: 27747
diff changeset
2001 purple_debug_error("yahoo", "Authentication error: %s. Code %d\n",
3b896476d181 yahoo: Add the error code to the debug log.
Paul Aurich <darkrain42@pidgin.im>
parents: 27747
diff changeset
2002 error_reason, 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
2003 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
2004 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
2005 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
2006 g_free(auth_data);
28076
796f5a14f70b Fix a bunch of memory leaks reported by Josh Mueller. Refs #9822.
Paul Aurich <darkrain42@pidgin.im>
parents: 28055
diff changeset
2007 g_free(token);
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
2008 }
27051
122397350352 Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents: 27049
diff changeset
2009 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
2010 /* 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
2011 PurpleUtilFetchUrlData *url_data = NULL;
27048
6eba1bfe015b Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27046
diff changeset
2012 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
2013 gboolean yahoojp = yahoo_is_japan(account);
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2014 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);
27048
6eba1bfe015b Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27046
diff changeset
2015
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
2016 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token);
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2017 url_data = purple_util_fetch_url_request_len_with_account(
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2018 proxy_ssl ? account : NULL, url, TRUE, YAHOO_CLIENT_USERAGENT,
29971
a56cfe91bbc1 Rework the Yahoo auth16 sutff a bit such that we now retrieve and use the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29970
diff changeset
2019 TRUE, NULL, TRUE, -1, yahoo_auth16_stage2, auth_data);
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
2020 if (url_data)
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
2021 yd->url_datas = g_slist_prepend(yd->url_datas, url_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
2022 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
2023 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
2024 }
10687
5ac4b470bee8 [gaim-migrate @ 12235]
Etan Reisner <deryni@pidgin.im>
parents: 10684
diff changeset
2025 }
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
2026 }
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
2027
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
2028 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
2029 {
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
2030 YahooData *yd = purple_connection_get_protocol_data(gc);
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2031 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
2032 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
2033 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
2034 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
2035 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
2036 char *encoded_password;
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2037 gboolean yahoojp = yahoo_is_japan(account);
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2038 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);
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
2039
27051
122397350352 Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <darkrain42@pidgin.im>
parents: 27049
diff changeset
2040 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
2041
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
2042 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
2043 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
2044 return;
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2045 }
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
2046
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
2047 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
2048 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
2049 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
2050
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
2051 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
2052 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
2053 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
2054 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
2055 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
2056 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
2057
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
2058 url_data = purple_util_fetch_url_request_len_with_account(
28326
6f1bc0dcabdc Add a boolean account option (defaulting to off) to control whether to use
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28278
diff changeset
2059 proxy_ssl ? account : NULL, url, TRUE,
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
2060 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
2061 yahoo_auth16_stage1_cb, auth_data);
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
2062 if (url_data)
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
2063 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
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
2064
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
2065 g_free(url);
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2066 }
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2067
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2068 static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt)
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2069 {
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2070 char *seed = NULL;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2071 char *sn = NULL;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2072 GSList *l = pkt->hash;
7010
afa5752740a7 [gaim-migrate @ 7573]
Tim Ringenbach <marv@pidgin.im>
parents: 6998
diff changeset
2073 int m = 0;
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
2074 gchar *buf;
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
2075
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2076 while (l) {
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2077 struct yahoo_pair *pair = l->data;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2078 if (pair->key == 94)
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2079 seed = pair->value;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2080 if (pair->key == 1)
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2081 sn = pair->value;
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2082 if (pair->key == 13)
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2083 m = atoi(pair->value);
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2084 l = l->next;
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2085 }
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
2086
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2087 if (seed) {
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2088 switch (m) {
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2089 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
2090 /* used to be for really old auth routine, dont support now */
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2091 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
2092 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
2093 yahoo_auth16_stage1(gc, seed);
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2094 break;
6986
40613e58e3d6 [gaim-migrate @ 7542]
Sean Egan <seanegan@pidgin.im>
parents: 6982
diff changeset
2095 default:
23545
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
2096 {
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
2097 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
2098
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
2099 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
2100 "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
2101 "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
2102 ((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
2103 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
2104 buf);
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
2105 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
2106 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
2107 break;
676b13ddfd2c Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evands@pidgin.im>
parents: 23542
diff changeset
2108 }
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2109 }
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2110 }
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
2111 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2112
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2113 static void ignore_buddy(PurpleBuddy *buddy) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2114 PurpleGroup *group;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2115 PurpleAccount *account;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2116 gchar *name;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2117
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9284
diff changeset
2118 if (!buddy)
6792
381bafc8200c [gaim-migrate @ 7331]
Jesse Farmer
parents: 6791
diff changeset
2119 return;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2120
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2121 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
2122 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
2123 account = purple_buddy_get_account(buddy);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2124
27547
c136491361eb Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27529
diff changeset
2125 purple_debug_info("yahoo", "blist: Removing '%s' from buddy list.\n", name);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2126 purple_account_remove_buddy(account, buddy, group);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2127 purple_blist_remove_buddy(buddy);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2128
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
2129 serv_add_deny(purple_account_get_connection(account), name);
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9284
diff changeset
2130
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2131 g_free(name);
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2132 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2133
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
2134 static void keep_buddy(PurpleBuddy *b)
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
2135 {
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
2136 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
2137 purple_buddy_get_name(b), 1);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2138 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2139
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2140 static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2141 PurpleBuddy *b;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2142 GSList *l;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2143 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
2144 gchar *me = NULL;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2145 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
2146 gboolean ignore = TRUE;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2147 gint status = 0;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2148
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2149 for (l = pkt->hash; l; l = l->next) {
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2150 struct yahoo_pair *pair = l->data;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2151 switch (pair->key) {
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2152 case 0:
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2153 who = pair->value;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2154 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2155 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
2156 me = pair->value;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2157 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2158 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
2159 /* 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
2160 ignore = (strtol(pair->value, NULL, 10) == 1);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2161 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2162 case 66:
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2163 status = strtol(pair->value, NULL, 10);
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2164 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2165 default:
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2166 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2167 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2168 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2169
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
2170 /*
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
2171 * 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
2172 * 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
2173 * 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
2174 * 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
2175 * 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
2176 */
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2177 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
2178 case 12:
22562
2e7123571ecd Fix a missing a comma
Mark Doliner <markdoliner@pidgin.im>
parents: 22561
diff changeset
2179 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
2180 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
2181
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
2182 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
2183 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
2184 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
2185 "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
2186 "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
2187 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
2188 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
2189 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
2190 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
2191 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
2192 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
2193 }
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
2194 case 2:
28539
035a20f78921 These debug messages were missing newlines at the end.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28519
diff changeset
2195 purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.\n",
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
2196 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
2197 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
2198 case 3:
28539
035a20f78921 These debug messages were missing newlines at the end.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28519
diff changeset
2199 purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete\n",
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
2200 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
2201 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
2202 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
2203 break;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2204 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2205 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2206
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2207 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt)
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2208 {
15807
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
2209 #ifdef TRY_WEBMESSENGER_LOGIN
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2210 YahooData *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
2211 #endif /* TRY_WEBMESSENGER_LOGIN */
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2212 GSList *l = pkt->hash;
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2213 int err = 0;
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2214 char *msg;
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2215 char *url = NULL;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2216 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
2217 PurpleAccount *account = gc->account;
24855
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2218 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2219
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2220 while (l) {
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2221 struct yahoo_pair *pair = l->data;
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2222
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2223 if (pair->key == 66)
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2224 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
2225 else if (pair->key == 20)
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2226 url = pair->value;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2227
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2228 l = l->next;
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2229 }
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2230
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2231 switch (err) {
24855
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2232 case 0:
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
2233 msg = g_strdup(_("Unknown error"));
24855
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2234 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2235 break;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2236 case 3:
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
2237 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
2238 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2239 break;
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2240 case 13:
15807
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
2241 #ifdef TRY_WEBMESSENGER_LOGIN
9410
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2242 if (!yd->wm) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2243 PurpleUtilFetchUrlData *url_data;
9410
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2244 yd->wm = TRUE;
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2245 if (yd->fd >= 0)
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2246 close(yd->fd);
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2247 if (gc->inpa)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2248 purple_input_remove(gc->inpa);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2249 url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2250 "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc);
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
2251 if (url_data != NULL)
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
2252 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
9410
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2253 return;
651e6af9e3c0 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
2254 }
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
2255 #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
2256 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
2257 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
2258
27869
c8b91ec16cef Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27856
diff changeset
2259 msg = g_strdup(_("Invalid username or password"));
24855
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2260 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2261 break;
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2262 case 14:
27869
c8b91ec16cef Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27856
diff changeset
2263 msg = g_strdup(_("Your account has been locked due to too many failed login attempts."
27870
921c423a83e5 Whitespace after '.' in a string.
Paul Aurich <darkrain42@pidgin.im>
parents: 27869
diff changeset
2264 " Please try logging into the Yahoo! website."));
24855
db953b75304d Two functional changes here:
Mark Doliner <markdoliner@pidgin.im>
parents: 24623
diff changeset
2265 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2266 break;
28052
36526c9eb31d Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28012
diff changeset
2267 case 52:
36526c9eb31d Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28012
diff changeset
2268 /* See #9660. As much as we know, reconnecting shouldn't hurt */
28053
ae2593fbe238 Unbreak the string freeze.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28052
diff changeset
2269 purple_debug_info("yahoo", "Got error 52, Set to autoreconnect\n");
28057
132f8daf4684 Better string for Yahoo error 52. Someone might want to try improving it still.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 28056
diff changeset
2270 msg = g_strdup_printf(_("Unknown error 52. Reconnecting should fix this."));
28055
c1b5711e3689 Use PURPLE_CONNECTION_ERROR_NETWORK_ERROR as the connection error
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 28053
diff changeset
2271 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
28052
36526c9eb31d Fix #9660. Reconnect, in case of error 52.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28012
diff changeset
2272 break;
27851
4bf0c00d5623 Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27844
diff changeset
2273 case 1013:
27869
c8b91ec16cef Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27856
diff changeset
2274 msg = g_strdup(_("Error 1013: The username you have entered is invalid."
28404
2c4d6eb8eeb5 We generally don't hyphenate "email"
Mark Doliner <markdoliner@pidgin.im>
parents: 28371
diff changeset
2275 " The most common cause of this error is entering your email"
27869
c8b91ec16cef Change some strings in Yahoo! for 2.6.1.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27856
diff changeset
2276 " address instead of your Yahoo! ID."));
27851
4bf0c00d5623 Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27844
diff changeset
2277 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
4bf0c00d5623 Display an error message when we receive error code 1013 from the Yahoo! logon
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27844
diff changeset
2278 break;
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2279 default:
9280
cca558311af2 [gaim-migrate @ 10083]
Tim Ringenbach <marv@pidgin.im>
parents: 9279
diff changeset
2280 msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err);
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2281 }
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2282
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2283 if (url)
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2284 fullmsg = g_strdup_printf("%s\n%s", msg, url);
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2285 else
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2286 fullmsg = g_strdup(msg);
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2287
21510
eb2829adfd40 Use PURPLE_CONNECTION_ERROR_INVALID_USERNAME in oscar and yahoo, which were
Will Thompson <resiak@pidgin.im>
parents: 21503
diff changeset
2288 purple_connection_error_reason(gc, reason, fullmsg);
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2289 g_free(msg);
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
2290 g_free(fullmsg);
6761
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2291 }
87201975746a [gaim-migrate @ 7293]
Tim Ringenbach <marv@pidgin.im>
parents: 6760
diff changeset
2292
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2293 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt)
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2294 {
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2295 int err = 0;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2296 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
2297 char *temp = NULL;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2298 char *group = NULL;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2299 char *decoded_group;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2300 char *buf;
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2301 YahooFriend *f;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2302 GSList *l = pkt->hash;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2303 YahooData *yd = gc->proto_data;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2304 YahooFederation fed = YAHOO_FEDERATION_NONE;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2305
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2306 while (l) {
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2307 struct yahoo_pair *pair = l->data;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2308
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2309 switch (pair->key) {
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2310 case 66:
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2311 err = strtol(pair->value, NULL, 10);
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2312 break;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2313 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
2314 temp = pair->value;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2315 break;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2316 case 65:
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2317 group = pair->value;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2318 break;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2319 case 241:
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2320 fed = strtol(pair->value, NULL, 10);
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2321 break;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2322 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2323
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2324 l = l->next;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2325 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2326
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
2327 if (!temp)
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2328 return;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2329 if (!group)
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2330 group = "";
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
2331
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2332 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2333 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2334 who = g_strconcat("msn/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2335 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2336 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2337 who = g_strconcat("ocs/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2338 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2339 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2340 who = g_strconcat("ibm/", temp, NULL);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2341 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2342 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2343 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2344 who = g_strdup(temp);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2345 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2346 }
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2347
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2348 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
9279
f2884065a001 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2349 f = yahoo_friend_find_or_new(gc, who);
f2884065a001 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2350 yahoo_update_status(gc, who, f);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2351 f->fed = fed;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2352
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
2353 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
2354 /* we are not connected as client, so set friend to not connected */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2355 if(fed)
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
2356 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
2357 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
2358 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
2359 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
2360 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2361 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2362 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
2363 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
2364 g_free(who);
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2365 return;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2366 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2367
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2368 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
2369 buf = g_strdup_printf(_("Unable to add buddy %s to group %s to the server list on account %s."),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2370 who, decoded_group, purple_connection_get_display_name(gc));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2371 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
2372 purple_notify_error(gc, NULL, _("Unable to add buddy to server list"), buf);
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2373 g_free(buf);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2374 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
2375 g_free(who);
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2376 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2377
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2378 /* 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
2379 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
2380 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2381 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
2382 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
2383
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2384 /*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
2385 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
2386 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
2387 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
2388 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
2389 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2390
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2391 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
2392 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2393 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
2394 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
2395 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
2396 PurpleAccount *account;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2397 YahooData *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
2398
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2399 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
2400
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2401 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
2402 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
2403 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
2404 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
2405 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
2406 49, "PEERTOPEER",
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2407 13, 7);
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2408 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
2409
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2410 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
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 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
2414 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2415 PurpleConnection *gc = data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2416 YahooData *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
2417
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2418 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
2419
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2420 return TRUE;
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
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2423 /* 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
2424 * 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
2425 * 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
2426 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
2427 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2428 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
2429 YahooFriend *f;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2430
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2431 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
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 /* 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
2435 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
2436 if (f)
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2437 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
2438
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2439 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
2440 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
2441 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
2442 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
2443 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
2444 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
2445 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
2446 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2447
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2448 /* 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
2449 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
2450 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2451 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
2452 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
2453 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
2454 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
2455 PurpleAccount *account;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2456 int val_13_to_send = 0;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2457 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2458 YahooFriend *f;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2459
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2460 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
2461 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2462
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2463 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
2464
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2465 /* 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
2466 while (l) {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2467 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
2468
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2469 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
2470 case 4:
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2471 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
2472 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
2473 /* 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
2474 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
2475 return;
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 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2478 case 13:
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2479 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
2480 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2481 /* 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
2482 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2483 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
2484 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2485
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2486 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
2487
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2488 /* 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
2489 * 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
2490 * 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
2491 * 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
2492 * 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
2493
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
2494 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
2495 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
2496 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
2497 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
2498 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
2499 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2500 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
2501 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
2502 return;
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
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2505 /* 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
2506 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
2507 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
2508 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
2509 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
2510 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
2511 49, "PEERTOPEER",
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2512 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
2513
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2514 /* 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
2515 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
2516 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
2517
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2518 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
2519 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
2520 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
2521 /* 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
2522 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
2523 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
2524 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
2525 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
2526 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
2527 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2528 else
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2529 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
2530 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2531 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2532 }
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 /* 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
2535 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
2536 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2537 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
2538 int len;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2539 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
2540 int pktlen;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2541 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
2542 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
2543 struct yahoo_p2p_data *p2p_data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2544 YahooData *yd;
26362
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 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
2547 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2548 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
2549
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2550 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
2551 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
2552 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
2553 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
2554 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2555 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
2556 /* 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
2557 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
2558 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
2559 else
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2560 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
2561 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2562 }
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
2563
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2564 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
2565 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2566
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2567 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
2568 /* 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
2569 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
2570
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2571 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
2572 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
2573 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
2574
f5dfe20bd3fd Yikes. buf is on the stack and shouldn't be freed. This fixes
Mark Doliner <markdoliner@pidgin.im>
parents: 27341
diff changeset
2575 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
2576 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
2577 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2578
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2579 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
2580 pos += 2;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2581 pos += 2;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2582
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2583 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
2584 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
2585
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2586 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
2587 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
2588 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
2589 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
2590
27547
c136491361eb Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27529
diff changeset
2591 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
2592 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
2593
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2594 /* 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
2595 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
2596 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
2597 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
2598 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2599 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
2600 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
2601 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2602 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
2603 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
2604 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2605 default:
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2606 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
2607 }
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_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
2610 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2611
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2612 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
2613 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2614 int acceptfd;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2615 struct yahoo_p2p_data *p2p_data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2616 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2617
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2618 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
2619 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2620 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
2621
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2622 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
2623 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
2624 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2625 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
2626 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
2627 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
2628 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2629 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2630
26364
2f8986215c51 remove connection timeout if already connected
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26363
diff changeset
2631 /* 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
2632 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
2633 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
2634 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
2635 }
26364
2f8986215c51 remove connection timeout if already connected
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26363
diff changeset
2636
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2637 /* 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
2638 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
2639 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
2640 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
2641 }
acbf9c5429f9 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26799
diff changeset
2642 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
2643 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
2644 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
2645 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2646
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2647 /* 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
2648 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
2649 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
2650 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2651
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2652 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
2653 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2654 struct yahoo_p2p_data *p2p_data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2655 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2656
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2657 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
2658 return FALSE;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2659
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2660 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
2661
27681
f6ba3163925e Fix two errors when my p2p server connection times out.
Paul Aurich <darkrain42@pidgin.im>
parents: 27679
diff changeset
2662 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
2663 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
2664 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
2665 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
2666 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
2667 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
2668 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
2669
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2670 return FALSE;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2671 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2672
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2673 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
2674 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2675 struct yahoo_p2p_data *p2p_data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2676 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2677
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2678 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
2679 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2680
31285
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2681 yd = p2p_data->gc->proto_data;
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2682 yd->listen_data = NULL;
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2683
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
2684 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
2685 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
2686 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
2687 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2688 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2689
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2690 /* 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
2691 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
2692 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
2693
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2694 /* add timeout */
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2695 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
2696 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2697
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2698 /* 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
2699 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
2700 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2701 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
2702 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
2703 guint32 ip;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2704 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
2705 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
2706 YahooFriend *f;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2707 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
2708 PurpleAccount *account;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2709 YahooData *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
2710 struct yahoo_p2p_data *p2p_data;
30588
84ac02c082e8 yahoo: Avoid misuse of purple_normalize
Paul Aurich <darkrain42@pidgin.im>
parents: 30467
diff changeset
2711 const char *norm_username;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2712
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2713 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
2714 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
2715
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2716 /* 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
2717 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
2718 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2719
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2720 /* 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
2721 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
2722 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2723
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
2724 /* 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
2725 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
2726 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2727
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2728 /* Dont send p2p packet to buddies of other protocols */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
2729 if(f->fed)
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2730 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2731
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2732 /* 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
2733 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
2734 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2735
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2736 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
2737 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
2738 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2739
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2740 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
2741 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
2742 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
2743
30588
84ac02c082e8 yahoo: Avoid misuse of purple_normalize
Paul Aurich <darkrain42@pidgin.im>
parents: 30467
diff changeset
2744 norm_username = purple_normalize(account, purple_account_get_username(account));
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2745 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
2746 yahoo_packet_hash(pkt, "sssissis",
30588
84ac02c082e8 yahoo: Avoid misuse of purple_normalize
Paul Aurich <darkrain42@pidgin.im>
parents: 30467
diff changeset
2747 1, norm_username,
84ac02c082e8 yahoo: Avoid misuse of purple_normalize
Paul Aurich <darkrain42@pidgin.im>
parents: 30467
diff changeset
2748 4, norm_username,
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2749 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
2750 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
2751 2, "",
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2752 5, who,
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2753 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
2754 49, "PEERTOPEER");
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2755 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
2756
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2757 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
2758
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2759 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
2760
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2761 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
2762 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
2763 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
2764 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
2765 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
2766 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
2767
31285
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2768 /* FIXME: If the port is already used, purple_network_listener returns NULL and old listener won't be canceled
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2769 * in yahoo_close function. */
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2770 if (yd->listen_data)
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2771 purple_debug_warning("yahoo","p2p: Failed to create p2p server - server already exists\n");
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2772 else {
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2773 yd->listen_data = purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data);
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2774 if (yd->listen_data == NULL)
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2775 purple_debug_warning("yahoo","p2p: Failed to created p2p server\n");
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
2776 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2777
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2778 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
2779 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2780
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2781 /* 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
2782 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
2783 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2784 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
2785 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
2786 PurpleAccount *account;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
2787 YahooData *yd;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2788
28099
2086b0894111 Something will have gone horribly wrong if data is NULL here, so don't
Mark Doliner <markdoliner@pidgin.im>
parents: 28098
diff changeset
2789 p2p_data = data;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2790 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
2791
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
2792 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
2793 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
2794 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
2795
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2796 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
2797 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2798 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2799
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2800 /* 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
2801 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
2802 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
2803
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2804 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
2805
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2806 /* 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
2807 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
2808 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
2809 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
2810 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
2811 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
2812 49, "PEERTOPEER",
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2813 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
2814
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2815 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
2816 yahoo_packet_free(pkt_to_send);
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2817 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
2818
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2819 static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt)
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2820 {
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2821 GSList *l = pkt->hash;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2822 char *who = NULL;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2823 char *base64 = NULL;
11137
cf40226ddff7 [gaim-migrate @ 13201]
Mark Doliner <markdoliner@pidgin.im>
parents: 11127
diff changeset
2824 guchar *decoded;
11127
5e539d9d26a4 [gaim-migrate @ 13183]
Mark Doliner <markdoliner@pidgin.im>
parents: 11111
diff changeset
2825 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
2826 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
2827 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
2828 PurpleAccount *account;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2829 YahooFriend *f;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2830
29871
e23f77cac016 yahoo: fix decoding of P2P session_id
Ales Badea <vamposdecampos@gmail.com>
parents: 29870
diff changeset
2831 /* if status is not YAHOO_STATUS_BRB or YAHOO_STATUS_P2P, the packet bounced back,
e23f77cac016 yahoo: fix decoding of P2P session_id
Ales Badea <vamposdecampos@gmail.com>
parents: 29870
diff changeset
2832 * so it contains our own ip */
e23f77cac016 yahoo: fix decoding of P2P session_id
Ales Badea <vamposdecampos@gmail.com>
parents: 29870
diff changeset
2833 if(pkt->status != YAHOO_STATUS_BRB && pkt->status != YAHOO_STATUS_P2P)
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2834 return ;
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2835
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2836 while (l) {
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2837 struct yahoo_pair *pair = l->data;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2838
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2839 switch (pair->key) {
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2840 case 5:
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2841 /* our identity */
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2842 break;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2843 case 4:
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2844 who = pair->value;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2845 break;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2846 case 1:
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2847 /* who again, the master identity this time? */
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2848 break;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2849 case 12:
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2850 base64 = pair->value;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2851 /* so, this is an ip address. in base64. decoded it's in ascii.
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2852 after strtol, it's in reversed byte order. Who thought this up?*/
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2853 break;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2854 case 13:
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2855 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
2856 break;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2857 case 11:
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2858 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
2859 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
2860 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
2861 break;
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2862 /*
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2863 TODO: figure these out
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2864 yahoo: Key: 61 Value: 0
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2865 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
2866 yahoo: Key: 13 Value: 0 packet count ??
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2867 yahoo: Key: 49 Value: PEERTOPEER
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2868 yahoo: Key: 140 Value: 1
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2869 */
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2870
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2871 }
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2872
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2873 l = l->next;
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2874 }
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2875
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
2876 if (base64) {
9281
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2877 guint32 ip;
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2878 YahooFriend *f;
30857
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2879 char *host_ip, *tmp;
26736
a9c00905cb8b Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26735
diff changeset
2880 struct yahoo_p2p_data *p2p_data;
9281
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2881
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2882 decoded = purple_base64_decode(base64, &len);
30857
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2883 if (decoded == NULL) {
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2884 purple_debug_info("yahoo","p2p: Unable to decode base64 IP (%s) \n", base64);
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2885 return;
9277
08d5a10f91c6 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
2886 }
30857
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2887 tmp = purple_str_binary_to_ascii(decoded, len);
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2888 purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp);
1a7e2da2ab01 Fix for CVE-2010-3711. Properly validate the return value from
Daniel Atallah <datallah@pidgin.im>
parents: 30706
diff changeset
2889 g_free(tmp);
9281
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2890
26736
a9c00905cb8b Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26735
diff changeset
2891 ip = strtol((gchar *)decoded, NULL, 10);
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2892 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
2893 host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
9281
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2894 (ip >> 24) & 0xff);
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2895 f = yahoo_friend_find(gc, who);
f8963ac088f6 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
2896 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
2897 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
2898 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
2899
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2900 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
2901
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
2902 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
2903 if(!f)
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2904 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2905 else
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2906 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
2907 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2908
26736
a9c00905cb8b Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26735
diff changeset
2909 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
2910 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
2911 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
2912 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
2913 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
2914 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
2915 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
2916 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
2917
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
2918 /* 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
2919 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
2920 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
2921 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
2922 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
2923 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
2924 }
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2925 }
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2926 }
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2927
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2928 static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt)
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2929 {
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
2930 PurpleAccount *account;
12798
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2931 char *who = NULL, *msg = NULL, *id = NULL;
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2932 GSList *l = pkt->hash;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2933
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
2934 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
2935
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2936 while (l) {
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2937 struct yahoo_pair *pair = l->data;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2938
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2939 switch (pair->key) {
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2940 case 4:
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2941 who = pair->value;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2942 break;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2943 case 5:
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2944 /* us */
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2945 break;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2946 case 230:
12798
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2947 /* the audible, in foo.locale.bar.baz format
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2948 eg: base.tw.smiley.smiley43 */
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2949 id = pair->value;
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2950 break;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2951 case 231:
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2952 /* the text of the audible */
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2953 msg = pair->value;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2954 break;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2955 case 232:
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2956 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2957 break;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2958 }
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2959
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2960 l = l->next;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2961 }
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2962
12798
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2963 if (!msg)
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2964 msg = id;
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2965 if (!who || !msg)
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2966 return;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2967 if (!g_utf8_validate(msg, -1, NULL)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2968 purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2969 return;
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2970 }
22366
5f5f96206385 Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <markdoliner@pidgin.im>
parents: 22364
diff changeset
2971 if (!purple_privacy_check(account, who)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2972 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
2973 purple_account_get_username(account), who);
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
2974 return;
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
2975 }
12798
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2976 if (id) {
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2977 /* "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
2978 char **audible_locale = g_strsplit(id, ".", 0);
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2979 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
2980 g_strfreev(audible_locale);
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2981
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2982 serv_got_im(gc, who, buf, 0, time(NULL));
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2983 g_free(buf);
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2984 } else
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
2985 serv_got_im(gc, who, msg, 0, time(NULL));
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2986 }
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2987
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
2988 static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2989 {
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
2990 switch (pkt->service) {
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2991 case YAHOO_SERVICE_LOGON:
2771
8c214f13da39 [gaim-migrate @ 2784]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2741
diff changeset
2992 case YAHOO_SERVICE_LOGOFF:
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
2993 case YAHOO_SERVICE_ISAWAY:
2737
f7edb9c3f348 [gaim-migrate @ 2750]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2724
diff changeset
2994 case YAHOO_SERVICE_ISBACK:
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
2995 case YAHOO_SERVICE_GAMELOGON:
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
2996 case YAHOO_SERVICE_GAMELOGOFF:
6686
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
2997 case YAHOO_SERVICE_CHATLOGON:
df609a8001f6 [gaim-migrate @ 7212]
Tim Ringenbach <marv@pidgin.im>
parents: 6657
diff changeset
2998 case YAHOO_SERVICE_CHATLOGOFF:
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
2999 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
3000 case YAHOO_SERVICE_STATUS_15:
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3001 yahoo_process_status(gc, pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3002 break;
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3003 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
3004 yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER);
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3005 break;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3006 case YAHOO_SERVICE_MESSAGE:
2786
c281356d8eda [gaim-migrate @ 2799]
brian macke
parents: 2772
diff changeset
3007 case YAHOO_SERVICE_GAMEMSG:
5939
cedbbd2d983a [gaim-migrate @ 6379]
Tim Ringenbach <marv@pidgin.im>
parents: 5921
diff changeset
3008 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
3009 yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3010 break;
7865
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
3011 case YAHOO_SERVICE_SYSMESSAGE:
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
3012 yahoo_process_sysmessage(gc, pkt);
bcca41cf1ce2 [gaim-migrate @ 8519]
Tim Ringenbach <marv@pidgin.im>
parents: 7829
diff changeset
3013 break;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3014 case YAHOO_SERVICE_NEWMAIL:
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3015 yahoo_process_mail(gc, pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3016 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3017 case YAHOO_SERVICE_NEWCONTACT:
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3018 yahoo_process_contact(gc, pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3019 break;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3020 case YAHOO_SERVICE_AUTHRESP:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3021 yahoo_process_authresp(gc, pkt);
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3022 break;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3023 case YAHOO_SERVICE_LIST:
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3024 yahoo_process_list(gc, pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3025 break;
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
3026 case YAHOO_SERVICE_LIST_15:
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
3027 yahoo_process_list_15(gc, pkt);
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
3028 break;
3147
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
3029 case YAHOO_SERVICE_AUTH:
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
3030 yahoo_process_auth(gc, pkt);
0dd86820c28c [gaim-migrate @ 3163]
Sean Egan <seanegan@pidgin.im>
parents: 3074
diff changeset
3031 break;
19411
450006e4bfc2 Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19339
diff changeset
3032 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
3033 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
3034 break;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
3035 case YAHOO_SERVICE_ADDBUDDY:
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
3036 yahoo_process_addbuddy(gc, pkt);
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
3037 break;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
3038 case YAHOO_SERVICE_IGNORECONTACT:
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
3039 yahoo_process_ignore(gc, pkt);
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
3040 break;
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3041 case YAHOO_SERVICE_CONFINVITE:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3042 case YAHOO_SERVICE_CONFADDINVITE:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3043 yahoo_process_conference_invite(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3044 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3045 case YAHOO_SERVICE_CONFDECLINE:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3046 yahoo_process_conference_decline(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3047 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3048 case YAHOO_SERVICE_CONFLOGON:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3049 yahoo_process_conference_logon(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3050 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3051 case YAHOO_SERVICE_CONFLOGOFF:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3052 yahoo_process_conference_logoff(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3053 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3054 case YAHOO_SERVICE_CONFMSG:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3055 yahoo_process_conference_message(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3056 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3057 case YAHOO_SERVICE_CHATONLINE:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3058 yahoo_process_chat_online(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3059 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3060 case YAHOO_SERVICE_CHATLOGOUT:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3061 yahoo_process_chat_logout(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3062 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3063 case YAHOO_SERVICE_CHATGOTO:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3064 yahoo_process_chat_goto(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3065 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3066 case YAHOO_SERVICE_CHATJOIN:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3067 yahoo_process_chat_join(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3068 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3069 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3070 case YAHOO_SERVICE_CHATEXIT:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3071 yahoo_process_chat_exit(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3072 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3073 case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3074 case YAHOO_SERVICE_CHATADDINVITE:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3075 yahoo_process_chat_addinvite(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3076 break;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3077 case YAHOO_SERVICE_COMMENT:
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3078 yahoo_process_chat_message(gc, pkt);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3079 break;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
3080 case YAHOO_SERVICE_PRESENCE_PERM:
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
3081 case YAHOO_SERVICE_PRESENCE_SESSION:
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
3082 yahoo_process_presence(gc, pkt);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
3083 break;
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
3084 case YAHOO_SERVICE_P2PFILEXFER:
11644
939411169d01 [gaim-migrate @ 13922]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11643
diff changeset
3085 /* 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
3086 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
3087 yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
3088 case YAHOO_SERVICE_FILETRANSFER:
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
3089 yahoo_process_filetransfer(gc, pkt);
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
3090 break;
11180
4098d74c03c2 [gaim-migrate @ 13291]
Daniel Atallah <datallah@pidgin.im>
parents: 11153
diff changeset
3091 case YAHOO_SERVICE_PEERTOPEER:
9062
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
3092 yahoo_process_p2p(gc, pkt);
2836e0e61402 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
3093 break;
9284
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
3094 case YAHOO_SERVICE_PICTURE:
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
3095 yahoo_process_picture(gc, pkt);
8cfc171d85bb [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
3096 break;
9292
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
3097 case YAHOO_SERVICE_PICTURE_CHECKSUM:
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
3098 yahoo_process_picture_checksum(gc, pkt);
bf8f35dc4f52 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
3099 break;
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3100 case YAHOO_SERVICE_PICTURE_UPLOAD:
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3101 yahoo_process_picture_upload(gc, pkt);
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3102 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
3103 case YAHOO_SERVICE_PICTURE_UPDATE:
14030
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13941
diff changeset
3104 case YAHOO_SERVICE_AVATAR_UPDATE:
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13941
diff changeset
3105 yahoo_process_avatar_update(gc, pkt);
23144f1dc950 [gaim-migrate @ 16525]
Mark Doliner <markdoliner@pidgin.im>
parents: 13941
diff changeset
3106 break;
9604
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
3107 case YAHOO_SERVICE_AUDIBLE:
eea16f73a13b [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
3108 yahoo_process_audible(gc, pkt);
12798
f8d553043aee [gaim-migrate @ 15145]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12797
diff changeset
3109 break;
27791
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
3110 case YAHOO_SERVICE_CONTACT_DETAILS:
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
3111 yahoo_process_contact_details(gc, pkt);
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
3112 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3113 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
3114 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
3115 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3116 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
3117 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
3118 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3119 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
3120 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
3121 break;
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3122 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
3123 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
3124 break;
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3125
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3126 default:
27547
c136491361eb Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27529
diff changeset
3127 purple_debug_error("yahoo", "Unhandled service 0x%02x\n", pkt->service);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3128 break;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3129 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3130 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3131
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3132 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3133 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3134 PurpleConnection *gc = data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3135 YahooData *yd = gc->proto_data;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3136 char buf[1024];
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3137 int len;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3138
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3139 len = read(yd->fd, buf, sizeof(buf));
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3140
14488
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3141 if (len < 0) {
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3142 gchar *tmp;
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3143
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3144 if (errno == EAGAIN)
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3145 /* No worries */
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3146 return;
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3147
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3148 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
3149 g_strerror(errno));
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3150 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
3151 g_free(tmp);
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3152 return;
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3153 } else if (len == 0) {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3154 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
3155 _("Server closed the connection"));
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3156 return;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3157 }
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
3158 gc->last_received = time(NULL);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3159 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3160 memcpy(yd->rxqueue + yd->rxlen, buf, len);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3161 yd->rxlen += len;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3162
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3163 while (1) {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3164 struct yahoo_packet *pkt;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3165 int pos = 0;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3166 int pktlen;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3167
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3168 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3169 return;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3170
11318
13fa1d5134f3 [gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11303
diff changeset
3171 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) {
10610
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3172 /* HEY! This isn't even a YMSG packet. What
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3173 * are you trying to pull? */
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3174 guchar *start;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3175
17540
460543cd1004 Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents: 17151
diff changeset
3176 purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n");
10611
fbab02a2699c [gaim-migrate @ 12065]
Tim Ringenbach <marv@pidgin.im>
parents: 10610
diff changeset
3177
10635
77bdc0c3a07f [gaim-migrate @ 12117]
Tim Ringenbach <marv@pidgin.im>
parents: 10611
diff changeset
3178 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1);
10610
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3179 if (start) {
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3180 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue));
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3181 yd->rxlen -= start - yd->rxqueue;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3182 continue;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3183 } else {
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3184 g_free(yd->rxqueue);
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3185 yd->rxqueue = NULL;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3186 yd->rxlen = 0;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3187 return;
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3188 }
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3189 }
e2e333edd68b [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
3190
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3191 pos += 4; /* YMSG */
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3192 pos += 2;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3193 pos += 2;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3194
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3195 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
3196 purple_debug_misc("yahoo", "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3197
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3198 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3199 return;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3200
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3201 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3202
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3203 pkt = yahoo_packet_new(0, 0, 0);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3204
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3205 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
3021
91e6cbdb62b1 [gaim-migrate @ 3034]
Sean Egan <seanegan@pidgin.im>
parents: 3020
diff changeset
3206 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
3207 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
3208 pkt->service, pkt->status);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3209 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3210
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3211 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3212
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3213 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3214 if (yd->rxlen) {
11318
13fa1d5134f3 [gaim-migrate @ 13521]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 11303
diff changeset
3215 guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3216 g_free(yd->rxqueue);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3217 yd->rxqueue = tmp;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3218 } else {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3219 g_free(yd->rxqueue);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3220 yd->rxqueue = NULL;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3221 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3222
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3223 yahoo_packet_process(gc, pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3224
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3225 yahoo_packet_free(pkt);
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3226 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3227 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3228
14182
517f4531b8a0 [gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents: 14170
diff changeset
3229 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3230 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3231 PurpleConnection *gc = data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3232 YahooData *yd;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3233 struct yahoo_packet *pkt;
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11043
diff changeset
3234
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3235 if (source < 0) {
17540
460543cd1004 Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents: 17151
diff changeset
3236 gchar *tmp;
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3237 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message);
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3238 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
3239 g_free(tmp);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3240 return;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3241 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3242
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3243 yd = gc->proto_data;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3244 yd->fd = source;
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11043
diff changeset
3245
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
3246 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, yd->session_id);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3247
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3248 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))));
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3249 yahoo_packet_send_and_free(pkt, yd);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3250
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3251 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3252 }
9370
0e1f9854bb0c [gaim-migrate @ 10178]
Tim Ringenbach <marv@pidgin.im>
parents: 9369
diff changeset
3253
15807
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3254 #ifdef TRY_WEBMESSENGER_LOGIN
14182
517f4531b8a0 [gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents: 14170
diff changeset
3255 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3256 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3257 PurpleConnection *gc = data;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3258 YahooData *yd;
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3259 struct yahoo_packet *pkt;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3260
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3261 if (source < 0) {
17540
460543cd1004 Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents: 17151
diff changeset
3262 gchar *tmp;
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3263 tmp = g_strdup_printf(_("Unable to connect: %s"), error_message);
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3264 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
3265 g_free(tmp);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3266 return;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3267 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3268
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3269 yd = gc->proto_data;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3270 yd->fd = source;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3271
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
3272 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, yd->session_id);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3273
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3274 yahoo_packet_hash(pkt, "sss", 0,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3275 purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3276 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3277 6, yd->auth);
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3278 yahoo_packet_send_and_free(pkt, yd);
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3279
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3280 g_free(yd->auth);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3281 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3282 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3283
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3284 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3285 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3286 PurpleConnection *gc = data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3287 PurpleAccount *account = purple_connection_get_account(gc);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3288 YahooData *yd = gc->proto_data;
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3289 char bufread[2048], *i = bufread, *buf = bufread;
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3290 int len;
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3291 GString *s;
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3292
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3293 len = read(source, bufread, sizeof(bufread) - 1);
14488
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3294
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3295 if (len < 0) {
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3296 gchar *tmp;
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3297
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3298 if (errno == EAGAIN)
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3299 /* No worries */
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3300 return;
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3301
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3302 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
3303 g_strerror(errno));
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3304 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
3305 g_free(tmp);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3306 return;
14488
17cf9193cc88 [gaim-migrate @ 17136]
Mark Doliner <markdoliner@pidgin.im>
parents: 14453
diff changeset
3307 } else if (len == 0) {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3308 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
3309 _("Server closed the connection"));
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3310 return;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3311 }
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3312
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3313 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
3314 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3315 memcpy(yd->rxqueue + yd->rxlen, buf, len);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3316 yd->rxlen += len;
14321
21c565de27ea [gaim-migrate @ 16941]
Tim Ringenbach <marv@pidgin.im>
parents: 14320
diff changeset
3317 i = buf = (char *)yd->rxqueue;
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3318 len = yd->rxlen;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3319 }
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3320 buf[len] = '\0';
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3321
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3322 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
3323 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3324 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
3325 _("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
3326 purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3327 return;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3328 }
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3329
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3330 s = g_string_sized_new(len);
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3331
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3332 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
3333
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3334 i += strlen("Set-Cookie: ");
8243
e40bd494b78e [gaim-migrate @ 8966]
Daniel Atallah <datallah@pidgin.im>
parents: 8235
diff changeset
3335 for (;*i != ';' && *i != '\0'; i++)
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3336 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
3337
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3338 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
3339 /* 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
3340 * 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
3341 */
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3342 }
8161
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3343
d92ec6ecfdeb [gaim-migrate @ 8873]
Tim Ringenbach <marv@pidgin.im>
parents: 8125
diff changeset
3344 yd->auth = g_string_free(s, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3345 purple_input_remove(gc->inpa);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3346 close(source);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3347 g_free(yd->rxqueue);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3348 yd->rxqueue = NULL;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3349 yd->rxlen = 0;
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3350 /* Now we have our cookies to login with. I'll go get the milk. */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3351 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
3352 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
5282ce7ac330 Add disconnection reasons to yahoo
Will Thompson <resiak@pidgin.im>
parents: 19918
diff changeset
3353 yahoo_got_web_connected, gc) == NULL) {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3354 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
3355 _("Unable to connect"));
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3356 return;
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
3357 }
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3358 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3359
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3360 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3361 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3362 PurpleConnection *gc;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3363 YahooData *yd;
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3364 int written, remaining;
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3365
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3366 gc = data;
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3367 yd = gc->proto_data;
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3368
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3369 remaining = strlen(yd->auth) - yd->auth_written;
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3370 written = write(source, yd->auth + yd->auth_written, remaining);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3371
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3372 if (written < 0 && errno == EAGAIN)
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3373 written = 0;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3374 else if (written <= 0) {
17540
460543cd1004 Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents: 17151
diff changeset
3375 gchar *tmp;
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3376 g_free(yd->auth);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3377 yd->auth = NULL;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3378 if (gc->inpa)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3379 purple_input_remove(gc->inpa);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3380 gc->inpa = 0;
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3381 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
3382 "login.yahoo.com:80", g_strerror(errno));
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3383 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
3384 g_free(tmp);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3385 return;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3386 }
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3387
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3388 if (written < remaining) {
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3389 yd->auth_written += written;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3390 return;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3391 }
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3392
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3393 g_free(yd->auth);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3394 yd->auth = NULL;
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3395 yd->auth_written = 0;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3396 purple_input_remove(gc->inpa);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3397 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3398 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3399
14182
517f4531b8a0 [gaim-migrate @ 16754]
Mark Doliner <markdoliner@pidgin.im>
parents: 14170
diff changeset
3400 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
3401 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3402 PurpleConnection *gc = data;
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3403
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3404 if (source < 0) {
17540
460543cd1004 Better error messages for Yahoo! login failures
Mark Doliner <markdoliner@pidgin.im>
parents: 17151
diff changeset
3405 gchar *tmp;
27635
0cd19038c417 More uniformity among disconnect error messages
Mark Doliner <markdoliner@pidgin.im>
parents: 27547
diff changeset
3406 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
3407 "login.yahoo.com:80", error_message);
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3408 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
3409 g_free(tmp);
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3410 return;
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3411 }
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3412
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3413 if (gc->inpa == 0)
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3414 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3415 gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE,
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3416 yahoo_got_cookies_send_cb, gc);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3417 yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE);
14146
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3418 }
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3419 }
4413802cb7a9 [gaim-migrate @ 16705]
Mark Doliner <markdoliner@pidgin.im>
parents: 14133
diff changeset
3420
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3421 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url)
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3422 {
24858
13177815fd88 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <markdoliner@pidgin.im>
parents: 24855
diff changeset
3423 if (!strcmp(key, "passwd") || !strcmp(key, "login"))
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3424 return;
13713
1ae8790174a4 [gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents: 13707
diff changeset
3425 g_string_append_c(url, '&');
1ae8790174a4 [gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents: 13707
diff changeset
3426 g_string_append(url, key);
1ae8790174a4 [gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents: 13707
diff changeset
3427 g_string_append_c(url, '=');
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3428 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
13713
1ae8790174a4 [gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents: 13707
diff changeset
3429 g_string_append_c(url, '1');
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3430 else if (!strcmp(key, ".challenge"))
13713
1ae8790174a4 [gaim-migrate @ 16115]
Richard Laager <rlaager@pidgin.im>
parents: 13707
diff changeset
3431 g_string_append(url, val);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3432 else
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3433 g_string_append(url, purple_url_encode(val));
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3434 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3435
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3436 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len)
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3437 {
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3438 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
3439 const char *c = buf;
12b7979bce6e [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
3440 char *d;
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3441 char name[64], value[64];
11188
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3442 int count;
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3443 int input_len = strlen("<input ");
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3444 int name_len = strlen("name=\"");
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3445 int value_len = strlen("value=\"");
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3446 while ((len > ((c - buf) + input_len))
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3447 && (c = strstr(c, "<input "))) {
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3448 if (!(c = g_strstr_len(c, len - (c - buf), "name=\"")))
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3449 continue;
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3450 c += name_len;
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3451 count = sizeof(name)-1;
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3452 for (d = name; (len > ((c - buf) + 1)) && *c!='"'
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3453 && count; c++, d++, count--)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3454 *d = *c;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3455 *d = '\0';
8118
7f5315bb4506 [gaim-migrate @ 8822]
Douglas Thrift <douglas@douglasthrift.net>
parents: 8113
diff changeset
3456 count = sizeof(value)-1;
11188
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3457 if (!(d = g_strstr_len(c, len - (c - buf), "value=\"")))
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3458 continue;
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3459 d += value_len;
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3460 if (strchr(c, '>') < d)
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3461 break;
11188
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3462 for (c = d, d = value; (len > ((c - buf) + 1))
71daefd15649 [gaim-migrate @ 13305]
Daniel Atallah <datallah@pidgin.im>
parents: 11183
diff changeset
3463 && *c!='"' && count; c++, d++, count--)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3464 *d = *c;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3465 *d = '\0';
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3466 g_hash_table_insert(hash, g_strdup(name), g_strdup(value));
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3467 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3468 return hash;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3469 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3470
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3471 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3472 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3473 const gchar *url_text, size_t len, const gchar *error_message)
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3474 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3475 PurpleConnection *gc = (PurpleConnection *)user_data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3476 PurpleAccount *account = purple_connection_get_account(gc);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3477 YahooData *yd = gc->proto_data;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3478 const char *sn = purple_account_get_username(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3479 const char *pass = purple_connection_get_password(gc);
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3480 GHashTable *hash = yahoo_login_page_hash(url_text, len);
10575
f360d2dc8a1c [gaim-migrate @ 11968]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10553
diff changeset
3481 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login=");
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3482 char md5[33], *hashp = md5, *chal;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3483 int i;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3484 PurpleCipher *cipher;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3485 PurpleCipherContext *context;
11183
be87fe695c93 [gaim-migrate @ 13295]
Mark Doliner <markdoliner@pidgin.im>
parents: 11180
diff changeset
3486 guchar digest[16];
7191
6c67ab87df26 [gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents: 7161
diff changeset
3487
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3488 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3489
15807
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3490 if (error_message != NULL)
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3491 {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3492 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
3493 error_message);
15807
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3494 return;
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3495 }
a075bef0d8dd Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <markdoliner@pidgin.im>
parents: 15685
diff changeset
3496
7191
6c67ab87df26 [gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents: 7161
diff changeset
3497 url = g_string_append(url, sn);
6c67ab87df26 [gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents: 7161
diff changeset
3498 url = g_string_append(url, "&passwd=");
6c67ab87df26 [gaim-migrate @ 7760]
Herman Bloggs <herman@bluedigits.com>
parents: 7161
diff changeset
3499
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3500 cipher = purple_ciphers_find_cipher("md5");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3501 context = purple_cipher_context_new(cipher, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3502
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3503 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3504 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3505 for (i = 0; i < 16; ++i) {
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3506 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3507 hashp += 2;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3508 }
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3509
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3510 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3511 purple_cipher_context_reset(context, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3512 purple_cipher_context_append(context, (const guchar *)chal, strlen(chal));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3513 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3514 hashp = md5;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3515 for (i = 0; i < 16; ++i) {
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3516 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3517 hashp += 2;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3518 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3519 /*
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3520 * 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
3521 * I updated it..
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3522
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3523 purple_cipher_context_reset(context, NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3524 purple_cipher_context_append(context, md5, strlen(md5));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3525 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3526 hashp = md5;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3527 for (i = 0; i < 16; ++i) {
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3528 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3529 hashp += 2;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3530 }
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3531 */
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3532 g_free(chal);
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
3533
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3534 url = g_string_append(url, md5);
7138
12b7979bce6e [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
3535 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
3536
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3537 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n"
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3538 "Host: login.yahoo.com\r\n\r\n");
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3539 g_hash_table_destroy(hash);
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3540 yd->auth = g_string_free(url, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3541 if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) {
21279
40685e1f50ca Rename:
Will Thompson <resiak@pidgin.im>
parents: 21152
diff changeset
3542 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
3543 _("Unable to connect"));
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3544 return;
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3545 }
10684
0325b164a7eb [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
3546
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3547 purple_cipher_context_destroy(context);
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3548 }
27335
06a805d4e690 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <markdoliner@pidgin.im>
parents: 27331
diff changeset
3549 #endif /* TRY_WEBMESSENGER_LOGIN */
7134
e999c4697e38 [gaim-migrate @ 7701]
Sean Egan <seanegan@pidgin.im>
parents: 7129
diff changeset
3550
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3551 static void yahoo_picture_check(PurpleAccount *account)
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3552 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3553 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
3554 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
3555
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
3556 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
3557 purple_imgstore_unref(img);
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3558 }
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3559
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3560 static int get_yahoo_status_from_purple_status(PurpleStatus *status)
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3561 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3562 PurplePresence *presence;
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3563 const char *status_id;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3564 const char *msg;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3565
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3566 presence = purple_status_get_presence(status);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3567 status_id = purple_status_get_id(status);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3568 msg = purple_status_get_attr_string(status, "message");
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3569
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3570 if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3571 if ((msg != NULL) && (*msg != '\0'))
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3572 return YAHOO_STATUS_CUSTOM;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3573 else
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3574 return YAHOO_STATUS_AVAILABLE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3575 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3576 return YAHOO_STATUS_BRB;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3577 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3578 return YAHOO_STATUS_BUSY;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3579 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3580 return YAHOO_STATUS_NOTATHOME;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3581 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3582 return YAHOO_STATUS_NOTATDESK;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3583 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3584 return YAHOO_STATUS_NOTINOFFICE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3585 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3586 return YAHOO_STATUS_ONPHONE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3587 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3588 return YAHOO_STATUS_ONVACATION;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3589 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3590 return YAHOO_STATUS_OUTTOLUNCH;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3591 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3592 return YAHOO_STATUS_STEPPEDOUT;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3593 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3594 return YAHOO_STATUS_INVISIBLE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3595 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) {
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3596 return YAHOO_STATUS_CUSTOM;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3597 } else if (purple_presence_is_idle(presence)) {
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3598 return YAHOO_STATUS_IDLE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3599 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3600 purple_debug_error("yahoo", "Unexpected PurpleStatus!\n");
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3601 return YAHOO_STATUS_AVAILABLE;
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3602 }
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
3603 }
7883
02cf91894bcf [gaim-migrate @ 8537]
Tim Ringenbach <marv@pidgin.im>
parents: 7878
diff changeset
3604
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3605 static void yahoo_got_pager_server(PurpleUtilFetchUrlData *url_data,
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3606 gpointer user_data, const gchar *url_text, gsize len, const gchar *error_message)
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3607 {
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3608 YahooData *yd = user_data;
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3609 PurpleConnection *gc = yd->gc;
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3610 PurpleAccount *a = purple_connection_get_account(gc);
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3611 gchar **strings = NULL, *cs_server = NULL;
30438
255be6f1a1da Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30434
diff changeset
3612 int port = purple_account_get_int(a, "port", YAHOO_PAGER_PORT);
255be6f1a1da Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30434
diff changeset
3613 int stringslen = 0;
29955
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3614
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3615 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3616
29955
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3617 if(error_message != NULL || len == 0) {
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3618 purple_debug_error("yahoo", "Unable to retrieve server info. %"
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3619 G_GSIZE_FORMAT " bytes retrieved with error message: %s\n", len,
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3620 error_message ? error_message : "(null)");
30434
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3621
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3622 if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3623 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3624 _("Unable to connect: The server returned an empty response."));
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3625 } else {
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3626 if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3627 yahoo_got_connected, gc) == NULL) {
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3628 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3629 _("Unable to connect"));
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3630 }
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3631 }
29955
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3632 } else {
29961
f23e3dc2a1e3 Small tweaks:
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29958
diff changeset
3633 strings = g_strsplit(url_text, "\r\n", -1);
29955
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3634
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3635 if((stringslen = g_strv_length(strings)) > 1) {
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3636 int i;
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3637
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3638 for(i = 0; i < stringslen; i++) {
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3639 if(g_ascii_strncasecmp(strings[i], "COLO_CAPACITY=", 14) == 0) {
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3640 purple_debug_info("yahoo", "Got COLO Capacity: %s\n", &(strings[i][14]));
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3641 } else if(g_ascii_strncasecmp(strings[i], "CS_IP_ADDRESS=", 14) == 0) {
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3642 cs_server = g_strdup(&strings[i][14]);
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3643 purple_debug_info("yahoo", "Got CS IP address: %s\n", cs_server);
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3644 }
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3645 }
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3646 }
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3647
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3648 if(cs_server) { /* got an address; get on with connecting */
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3649 if(purple_proxy_connect(gc, a, cs_server, port, yahoo_got_connected, gc) == NULL)
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3650 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3651 _("Unable to connect"));
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3652 } else {
29955
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3653 purple_debug_error("yahoo", "No CS address retrieved! Server "
2d474c79dcc1 Some improvements to the new CS-via-HTTP stuff, sparked by Stu's suggestion to
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29949
diff changeset
3654 "response:\n%s\n", url_text ? url_text : "(null)");
30434
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3655
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3656 if(yahoo_is_japan(a)) { /* We don't know fallback hosts for Yahoo Japan :( */
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3657 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3658 _("Unable to connect: The server's response did not contain "
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3659 "the necessary information"));
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3660 } else
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3661 if(purple_proxy_connect(gc, a, YAHOO_PAGER_HOST_FALLBACK, port,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3662 yahoo_got_connected, gc) == NULL) {
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3663 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3664 _("Unable to connect"));
f20c37c4ff38 Very hackily implement a fallback mechanism in Yahoo, but not for Yahoo Japan
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30429
diff changeset
3665 }
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3666 }
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3667 }
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3668
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3669 g_strfreev(strings);
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3670 g_free(cs_server);
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3671 }
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3672
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
3673 void yahoo_login(PurpleAccount *account) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3674 PurpleConnection *gc = purple_account_get_connection(account);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3675 YahooData *yd = gc->proto_data = g_new0(YahooData, 1);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3676 PurpleStatus *status = purple_account_get_active_status(account);
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3677 gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
30429
33e8277ae908 Change the function of the "proxy_ssl" account option to cover regular HTTP
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30266
diff changeset
3678 gboolean proxy_ssl = purple_account_get_bool(account, "proxy_ssl", FALSE);
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3679 PurpleUtilFetchUrlData *url_data;
27800
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3680
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3681 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3682
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3683 purple_connection_update_progress(gc, _("Connecting"), 1, 2);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3684
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3685 purple_connection_set_display_name(gc, purple_account_get_username(account));
8235
00045afab151 [gaim-migrate @ 8958]
Gary Kramlich <grim@pidgin.im>
parents: 8216
diff changeset
3686
27760
f2287543f859 Set the back-reference to the connection from the proto-data.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27753
diff changeset
3687 yd->gc = gc;
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3688 yd->jp = yahoo_is_japan(account);
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
3689 yd->yahoo_local_p2p_server_fd = -1;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3690 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
3691 yd->txhandler = 0;
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3692 /* TODO: Is there a good grow size for the buffer? */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3693 yd->txbuf = purple_circ_buffer_new(0);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3694 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
3695 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
3696 yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
27800
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3697 yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free,
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3698 yahoo_p2p_disconnect_destroy_data);
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3699 yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
27800
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3700 yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS,
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3701 yahoo_p2p_keepalive, gc);
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3702 yd->confs = NULL;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3703 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
3704 yd->last_keepalive = yd->last_ping = time(NULL);
11076
f6c4835e68ee [gaim-migrate @ 13086]
Mark Doliner <markdoliner@pidgin.im>
parents: 11043
diff changeset
3705
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3706 yd->current_status = get_yahoo_status_from_purple_status(status);
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3707
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3708 yahoo_picture_check(account);
7883
02cf91894bcf [gaim-migrate @ 8537]
Tim Ringenbach <marv@pidgin.im>
parents: 7878
diff changeset
3709
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3710 /* Get the pager server. Actually start connecting in the callback since we
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3711 * must have the contents of the HTTP response to proceed. */
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3712 url_data = purple_util_fetch_url_request_len_with_account(
30429
33e8277ae908 Change the function of the "proxy_ssl" account option to cover regular HTTP
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30266
diff changeset
3713 proxy_ssl ? purple_connection_get_account(gc) : NULL,
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3714 yd->jp ? YAHOOJP_PAGER_HOST_REQ_URL : YAHOO_PAGER_HOST_REQ_URL,
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3715 use_whole_url ? TRUE : FALSE,
30438
255be6f1a1da Fix a mistake I made with the fallback code. Refs #11986.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 30434
diff changeset
3716 YAHOO_CLIENT_USERAGENT, FALSE, NULL, FALSE, -1,
29949
902d9eab8f6d Ladies and gentlemen, I give you HTTP-based retrieval of the Yahoo CS server
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29871
diff changeset
3717 yahoo_got_pager_server, yd);
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3718 if (url_data)
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
3719 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
27800
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3720
bd47acc20557 Simplify a block here and kill one of those uber-lines that annoy grim.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27792
diff changeset
3721 return;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3722 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3723
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
3724 void yahoo_close(PurpleConnection *gc) {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3725 YahooData *yd = (YahooData *)gc->proto_data;
9782
4f0e4049d3f4 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
3726 GSList *l;
4f0e4049d3f4 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
3727
11608
07a4d5ffdb08 [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
3728 if (gc->inpa)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3729 purple_input_remove(gc->inpa);
11608
07a4d5ffdb08 [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
3730
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3731 while (yd->url_datas) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3732 purple_util_fetch_url_cancel(yd->url_datas->data);
14416
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3733 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
3734 }
c95ffd983a39 [gaim-migrate @ 17060]
Mark Doliner <markdoliner@pidgin.im>
parents: 14378
diff changeset
3735
9782
4f0e4049d3f4 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
3736 for (l = yd->confs; l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3737 PurpleConversation *conv = l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3738
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3739 yahoo_conf_leave(yd, purple_conversation_get_name(conv),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3740 purple_connection_get_display_name(gc),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3741 purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)));
9782
4f0e4049d3f4 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
3742 }
4f0e4049d3f4 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
3743 g_slist_free(yd->confs);
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3744
22202
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3745 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
3746 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
3747 l->data=NULL;
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3748 }
e42ab2e3eba1 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan Sankaranarayanan <madthanu@gmail.com>
parents: 22201
diff changeset
3749 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
3750
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
3751 yd->chat_online = FALSE;
12841
939ceff2a3ba [gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents: 12798
diff changeset
3752 if (yd->in_chat)
939ceff2a3ba [gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents: 12798
diff changeset
3753 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */
939ceff2a3ba [gaim-migrate @ 15189]
Richard Laager <rlaager@pidgin.im>
parents: 12798
diff changeset
3754
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3755 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
3756 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
3757 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
3758 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
3759 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3760
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3761 /* 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
3762 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
3763 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
3764 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
3765 }
acbf9c5429f9 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 26799
diff changeset
3766 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
3767 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
3768 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
3769 }
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3770
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
3771 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
3772 g_hash_table_destroy(yd->peers);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3773 g_hash_table_destroy(yd->friends);
13851
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
3774 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
3775 g_hash_table_destroy(yd->xfer_peer_idstring_map);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3776 g_free(yd->chat_name);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3777
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3778 g_free(yd->cookie_y);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3779 g_free(yd->cookie_t);
29980
c66778885cec Leaking the B cookie is bad.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 29971
diff changeset
3780 g_free(yd->cookie_b);
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3781
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3782 if (yd->txhandler)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3783 purple_input_remove(yd->txhandler);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3784
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3785 purple_circ_buffer_destroy(yd->txbuf);
7651
43663aa7ef68 [gaim-migrate @ 8295]
Tim Ringenbach <marv@pidgin.im>
parents: 7631
diff changeset
3786
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3787 if (yd->fd >= 0)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3788 close(yd->fd);
3720
dbba62e0d603 [gaim-migrate @ 3853]
Herman Bloggs <herman@bluedigits.com>
parents: 3642
diff changeset
3789
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3790 g_free(yd->rxqueue);
2687
664e22f507cf [gaim-migrate @ 2700]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2686
diff changeset
3791 yd->rxlen = 0;
13201
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3792 g_free(yd->picture_url);
8c224ef70efa [gaim-migrate @ 15563]
Daniel Atallah <datallah@pidgin.im>
parents: 13107
diff changeset
3793
14693
9e3d4f9609e1 [gaim-migrate @ 17377]
Evan Schoenberg <evands@pidgin.im>
parents: 14604
diff changeset
3794 if (yd->buddy_icon_connect_data)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3795 purple_proxy_connect_cancel(yd->buddy_icon_connect_data);
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3796 if (yd->picture_upload_todo)
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3797 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo);
9376
72964e97c46e [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3798 if (yd->ycht)
72964e97c46e [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3799 ycht_connection_close(yd->ycht);
31285
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
3800 if (yd->listen_data != NULL)
6f8f1683c6d8 Yahoo: Fix a crash that happens when the PurpleAccount disconnects after
Jan Kaluza <hanzz.k@gmail.com>
parents: 30857
diff changeset
3801 purple_network_listen_cancel(yd->listen_data);
11608
07a4d5ffdb08 [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
3802
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
3803 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
3804 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
3805 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
3806 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
3807 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
3808
27791
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
3809 yahoo_personal_details_reset(&yd->ypd, TRUE);
27716
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
3810
22552
21bcf7de74f1 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evands@pidgin.im>
parents: 22462
diff changeset
3811 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
3812
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3813 g_free(yd);
13344
fde4e6dc84f8 [gaim-migrate @ 15713]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13297
diff changeset
3814 gc->proto_data = NULL;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3815 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3816
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
3817 const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3818 {
4687
91ad36873636 [gaim-migrate @ 4998]
Sean Egan <seanegan@pidgin.im>
parents: 4634
diff changeset
3819 return "yahoo";
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3820 }
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4834
diff changeset
3821
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
3822 const char *yahoo_list_emblem(PurpleBuddy *b)
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4834
diff changeset
3823 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3824 PurpleAccount *account;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3825 PurpleConnection *gc;
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
3826 YahooFriend *f;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3827 PurplePresence *presence;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3828
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3829 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
3830 !(gc = purple_account_get_connection(account)) ||
30626
bec413ce77c7 Fix some "Dead nested assignment"s and then kill off some useless
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30588
diff changeset
3831 !gc->proto_data)
15558
6fb7a0ad8a0b clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15524
diff changeset
3832 return NULL;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3833
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3834 f = yahoo_friend_find(gc, purple_buddy_get_name(b));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3835 if (!f) {
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15444
diff changeset
3836 return "not-authorized";
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3837 }
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3838
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3839 presence = purple_buddy_get_presence(b);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3840
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3841 if (purple_presence_is_online(presence)) {
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3842 if (yahoo_friend_get_game(f))
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15444
diff changeset
3843 return "game";
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
3844
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
3845 if (f->fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
3846 return "external";
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4834
diff changeset
3847 }
15524
8f365f9bf660 Emblems in the blist
Sean Egan <seanegan@pidgin.im>
parents: 15444
diff changeset
3848 return NULL;
4916
11b8fd3f8ffc [gaim-migrate @ 5250]
Sean Egan <seanegan@pidgin.im>
parents: 4834
diff changeset
3849 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3850
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13041
diff changeset
3851 static const char *yahoo_get_status_string(enum yahoo_status a)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3852 {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3853 switch (a) {
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3854 case YAHOO_STATUS_BRB:
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3855 return _("Be Right Back");
12203
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
3856 case YAHOO_STATUS_BUSY:
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
3857 return _("Busy");
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3858 case YAHOO_STATUS_NOTATHOME:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3859 return _("Not at Home");
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3860 case YAHOO_STATUS_NOTATDESK:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3861 return _("Not at Desk");
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3862 case YAHOO_STATUS_NOTINOFFICE:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3863 return _("Not in Office");
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3864 case YAHOO_STATUS_ONPHONE:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3865 return _("On the Phone");
12206
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3866 case YAHOO_STATUS_ONVACATION:
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3867 return _("On Vacation");
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3868 case YAHOO_STATUS_OUTTOLUNCH:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3869 return _("Out to Lunch");
12203
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
3870 case YAHOO_STATUS_STEPPEDOUT:
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
3871 return _("Stepped Out");
2873
9e56887eeb06 [gaim-migrate @ 2886]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2856
diff changeset
3872 case YAHOO_STATUS_INVISIBLE:
4596
64e72bf4ece4 [gaim-migrate @ 4881]
Björn Voigt <bjoern@cs.tu-berlin.de>
parents: 4491
diff changeset
3873 return _("Invisible");
4730
f6ae5bf30171 [gaim-migrate @ 5043]
Sean Egan <seanegan@pidgin.im>
parents: 4729
diff changeset
3874 case YAHOO_STATUS_IDLE:
f6ae5bf30171 [gaim-migrate @ 5043]
Sean Egan <seanegan@pidgin.im>
parents: 4729
diff changeset
3875 return _("Idle");
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3876 case YAHOO_STATUS_OFFLINE:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3877 return _("Offline");
2879
e417cf7111c4 [gaim-migrate @ 2892]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents: 2878
diff changeset
3878 default:
12467
94948d1eb8cf [gaim-migrate @ 14777]
Richard Laager <rlaager@pidgin.im>
parents: 12417
diff changeset
3879 return _("Available");
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3880 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3881 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
3882
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3883 static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3885 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3886 PurpleConnection *gc;
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
3887
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3888 GHashTable *components;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
3889 YahooData *yd;
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3890 int id;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3891
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3892 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3893
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3894 buddy = (PurpleBuddy *) node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3895 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3896 yd = gc->proto_data;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3897 id = yd->conf_id;
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3898
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3899 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3900 g_hash_table_replace(components, g_strdup("room"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3901 g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id));
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3902 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference..."));
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3903 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference"));
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3904 yahoo_c_join(gc, components);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3905 g_hash_table_destroy(components);
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3906
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3907 yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy));
6729
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3908 }
c21179a914e5 [gaim-migrate @ 7256]
Tim Ringenbach <marv@pidgin.im>
parents: 6695
diff changeset
3909
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3910 static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3911 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3912 PurpleConnection *gc;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
3913 int presence_val = GPOINTER_TO_INT(data);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
3914
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3915 buddy = (PurpleBuddy *) node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3916 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
3917
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3918 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
3919 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
3920
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3921 static void yahoo_game(PurpleBlistNode *node, gpointer data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3922
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3923 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3924 PurpleConnection *gc;
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
3925
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3926 const char *game;
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3927 char *game2;
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3928 char *t;
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3929 char url[256];
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
3930 YahooFriend *f;
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3931
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3932 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3933
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3934 buddy = (PurpleBuddy *) node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3935 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
3936
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3937 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3938 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3939 return;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3940
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3941 game = yahoo_friend_get_game(f);
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3942 if (!game)
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3943 return;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3944
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3945 t = game2 = g_strdup(strstr(game, "ante?room="));
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3946 while (*t && *t != '\t')
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3947 t++;
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3948 *t = 0;
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3949 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3950 purple_notify_uri(gc, url);
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3951 g_free(game2);
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
3952 }
4722
f834a9a217c4 [gaim-migrate @ 5034]
Sean Egan <seanegan@pidgin.im>
parents: 4690
diff changeset
3953
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
3954 char *yahoo_status_text(PurpleBuddy *b)
4722
f834a9a217c4 [gaim-migrate @ 5034]
Sean Egan <seanegan@pidgin.im>
parents: 4690
diff changeset
3955 {
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
3956 YahooFriend *f = NULL;
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3957 const char *msg;
11920
be80617ec59b [gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11914
diff changeset
3958 char *msg2;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3959 PurpleAccount *account;
27682
05810ff93040 yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents: 27681
diff changeset
3960 PurpleConnection *gc;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3961
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3962 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
3963 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
3964 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
3965 return NULL;
05810ff93040 yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents: 27681
diff changeset
3966
05810ff93040 yahoo: Don't do anything in yahoo_status_text when disconnecting.
Paul Aurich <darkrain42@pidgin.im>
parents: 27681
diff changeset
3967 f = yahoo_friend_find(gc, purple_buddy_get_name(b));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3968 if (!f)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3969 return g_strdup(_("Not on server list"));
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3970
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3971 switch (f->status) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3972 case YAHOO_STATUS_AVAILABLE:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3973 return NULL;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3974 case YAHOO_STATUS_IDLE:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3975 if (f->idle == -1)
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3976 return g_strdup(yahoo_get_status_string(f->status));
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3977 return NULL;
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3978 case YAHOO_STATUS_CUSTOM:
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
3979 if (!(msg = yahoo_friend_get_status_message(f)))
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3980 return NULL;
11920
be80617ec59b [gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11914
diff changeset
3981 msg2 = g_markup_escape_text(msg, strlen(msg));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3982 purple_util_chrreplace(msg2, '\n', ' ');
11920
be80617ec59b [gaim-migrate @ 14211]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 11914
diff changeset
3983 return msg2;
9224
dbf5bfffe49b [gaim-migrate @ 10020]
Tim Ringenbach <marv@pidgin.im>
parents: 9221
diff changeset
3984
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3985 default:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
3986 return g_strdup(yahoo_get_status_string(f->status));
11077
c189de76c00e [gaim-migrate @ 13087]
Mark Doliner <markdoliner@pidgin.im>
parents: 11076
diff changeset
3987 }
4722
f834a9a217c4 [gaim-migrate @ 5034]
Sean Egan <seanegan@pidgin.im>
parents: 4690
diff changeset
3988 }
f834a9a217c4 [gaim-migrate @ 5034]
Sean Egan <seanegan@pidgin.im>
parents: 4690
diff changeset
3989
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
3990 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
4724
2c7fae3847c8 [gaim-migrate @ 5037]
Sean Egan <seanegan@pidgin.im>
parents: 4722
diff changeset
3991 {
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
3992 YahooFriend *f;
13107
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13041
diff changeset
3993 char *escaped;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13041
diff changeset
3994 char *status = NULL;
704041197f4d [gaim-migrate @ 15468]
Richard Laager <rlaager@pidgin.im>
parents: 13041
diff changeset
3995 const char *presence = NULL;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3996 PurpleAccount *account;
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3997
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3998 account = purple_buddy_get_account(b);
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
3999 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4000 if (!f)
8591
ae42ad1cd127 [gaim-migrate @ 9342]
Mark Doliner <markdoliner@pidgin.im>
parents: 8589
diff changeset
4001 status = g_strdup_printf("\n%s", _("Not on server list"));
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4002 else {
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4003 switch (f->status) {
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4004 case YAHOO_STATUS_CUSTOM:
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
4005 if (!yahoo_friend_get_status_message(f))
12970
c2f3b4dcf711 [gaim-migrate @ 15323]
Richard Laager <rlaager@pidgin.im>
parents: 12945
diff changeset
4006 return;
9283
0d29b94a923f [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
4007 status = g_strdup(yahoo_friend_get_status_message(f));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4008 break;
10992
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4009 case YAHOO_STATUS_OFFLINE:
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4010 break;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4011 default:
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4012 status = g_strdup(yahoo_get_status_string(f->status));
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4013 break;
4745
24867c379d37 [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4732
diff changeset
4014 }
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4015
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4016 switch (f->presence) {
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4017 case YAHOO_PRESENCE_ONLINE:
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4018 presence = _("Appear Online");
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4019 break;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4020 case YAHOO_PRESENCE_PERM_OFFLINE:
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4021 presence = _("Appear Permanently Offline");
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4022 break;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4023 case YAHOO_PRESENCE_DEFAULT:
12945
69f429d29451 [gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
4024 break;
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4025 default:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4026 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
4027 break;
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4028 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4029 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4030
10992
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4031 if (status != NULL) {
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4032 escaped = g_markup_escape_text(status, strlen(status));
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4033 purple_notify_user_info_add_pair(user_info, _("Status"), escaped);
10992
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4034 g_free(status);
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4035 g_free(escaped);
ccf59743dae4 [gaim-migrate @ 12830]
Daniel Atallah <datallah@pidgin.im>
parents: 10989
diff changeset
4036 }
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4037
12945
69f429d29451 [gaim-migrate @ 15298]
Richard Laager <rlaager@pidgin.im>
parents: 12943
diff changeset
4038 if (presence != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4039 purple_notify_user_info_add_pair(user_info, _("Presence"), presence);
27791
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4040
28002
7b7a00eb0341 Don't crash when opening a tooltip for yahoo contacts who aren't on
Michael Ruprecht <maiku@pidgin.im>
parents: 27959
diff changeset
4041 if (f && full) {
27791
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4042 YahooPersonalDetails *ypd = &f->ypd;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4043 int i;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4044 struct {
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4045 char *id;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4046 char *text;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4047 char *value;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4048 } yfields[] = {
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4049 {"hp", N_("Home Phone Number"), ypd->phone.home},
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4050 {"wp", N_("Work Phone Number"), ypd->phone.work},
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4051 {"mo", N_("Mobile Phone Number"), ypd->phone.mobile},
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4052 {NULL, NULL, NULL}
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4053 };
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4054 for (i = 0; yfields[i].id; i++) {
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4055 if (!yfields[i].value || !*yfields[i].value)
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4056 continue;
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4057 purple_notify_user_info_add_pair(user_info, _(yfields[i].text), yfields[i].value);
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4058 }
4601e7074a83 Add support for receiving contact details from buddies.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27779
diff changeset
4059 }
4729
7521e221beb7 [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
4060 }
7521e221beb7 [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
4061
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4062 static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data)
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4063 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4064 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4065 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4066
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4067 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4068
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4069 buddy = (PurpleBuddy *) node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4070 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4071
9285
9cedf5d26577 [gaim-migrate @ 10088]
Mark Doliner <markdoliner@pidgin.im>
parents: 9284
diff changeset
4072 yahoo_add_buddy(gc, buddy, NULL);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4073 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4074
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4075
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4076 static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data)
6796
2f3f12a30ab9 [gaim-migrate @ 7336]
Tim Ringenbach <marv@pidgin.im>
parents: 6795
diff changeset
4077 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4078 PurpleBuddy *buddy;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4079 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4080
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4081 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4082
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4083 buddy = (PurpleBuddy *) node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4084 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
4085
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4086 yahoo_chat_goto(gc, purple_buddy_get_name(buddy));
6796
2f3f12a30ab9 [gaim-migrate @ 7336]
Tim Ringenbach <marv@pidgin.im>
parents: 6795
diff changeset
4087 }
2f3f12a30ab9 [gaim-migrate @ 7336]
Tim Ringenbach <marv@pidgin.im>
parents: 6795
diff changeset
4088
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4089 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) {
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4090 GList *m = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4091 PurpleMenuAction *act;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4092 YahooData *yd = (YahooData *) gc->proto_data;
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4093
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4094 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4095 if (f->presence != YAHOO_PRESENCE_ONLINE) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4096 act = purple_menu_action_new(_("Appear Online"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4097 PURPLE_CALLBACK(yahoo_presence_settings),
13021
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4098 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4099 NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4100 m = g_list_append(m, act);
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4101 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4102 act = purple_menu_action_new(_("Appear Offline"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4103 PURPLE_CALLBACK(yahoo_presence_settings),
13021
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4104 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4105 NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4106 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4107 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4108 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4109
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4110 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4111 act = purple_menu_action_new(_("Don't Appear Permanently Offline"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4112 PURPLE_CALLBACK(yahoo_presence_settings),
13021
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4113 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4114 NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4115 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4116 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4117 act = purple_menu_action_new(_("Appear Permanently Offline"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4118 PURPLE_CALLBACK(yahoo_presence_settings),
13021
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4119 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
64917077e624 [gaim-migrate @ 15374]
Etan Reisner <deryni@pidgin.im>
parents: 12999
diff changeset
4120 NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4121 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4122 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4123
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4124 return m;
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4125 }
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4126
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4127 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
4128 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4129 PurpleBuddy *b = (PurpleBuddy *)node;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4130 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
4131 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
4132
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4133 yahoo_doodle_initiate(gc, purple_buddy_get_name(b));
11800
622741e6201c [gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11718
diff changeset
4134 }
622741e6201c [gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11718
diff changeset
4135
27792
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4136 static void
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4137 yahoo_userinfo_blist_node(PurpleBlistNode *node, gpointer data)
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4138 {
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4139 PurpleBuddy *b = (PurpleBuddy *)node;
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4140 PurpleAccount *account = purple_buddy_get_account(b);
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4141 PurpleConnection *gc = purple_account_get_connection(account);
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4142
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4143 yahoo_set_userinfo_for_buddy(gc, b);
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4144 }
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4145
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4146 static GList *yahoo_buddy_menu(PurpleBuddy *buddy)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4147 {
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4148 GList *m = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4149 PurpleMenuAction *act;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4150
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4151 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4152 YahooData *yd = gc->proto_data;
3019
ef3dd4b0002a [gaim-migrate @ 3032]
Brian Macke
parents: 3001
diff changeset
4153 static char buf2[1024];
9278
901f91712e4c [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
4154 YahooFriend *f;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4155
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4156 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4157
9370
0e1f9854bb0c [gaim-migrate @ 10178]
Tim Ringenbach <marv@pidgin.im>
parents: 9369
diff changeset
4158 if (!f && !yd->wm) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4159 act = purple_menu_action_new(_("Add Buddy"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4160 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb),
12919
519199cca273 [gaim-migrate @ 15272]
Etan Reisner <deryni@pidgin.im>
parents: 12878
diff changeset
4161 NULL, NULL);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4162 m = g_list_append(m, act);
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4163
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
4164 return m;
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4165
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4166 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4167
28788
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4168 if (f && f->status != YAHOO_STATUS_OFFLINE && f->fed == YAHOO_FEDERATION_NONE) {
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4169 if (!yd->wm) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4170 act = purple_menu_action_new(_("Join in Chat"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4171 PURPLE_CALLBACK(yahoo_chat_goto_menu),
12919
519199cca273 [gaim-migrate @ 15272]
Etan Reisner <deryni@pidgin.im>
parents: 12878
diff changeset
4172 NULL, NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4173 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4174 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4175
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4176 act = purple_menu_action_new(_("Initiate Conference"),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4177 PURPLE_CALLBACK(yahoo_initiate_conference),
12919
519199cca273 [gaim-migrate @ 15272]
Etan Reisner <deryni@pidgin.im>
parents: 12878
diff changeset
4178 NULL, NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4179 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4180
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4181 if (yahoo_friend_get_game(f)) {
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4182 const char *game = yahoo_friend_get_game(f);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4183 char *room;
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4184 char *t;
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4185
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4186 if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4187 while (*room && *room != '\t') /* skip to the tab */
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4188 room++;
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4189 t = room++; /* room as now at the name */
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4190 while (*t != '\n')
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4191 t++; /* replace the \n with a space */
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4192 *t = ' ';
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4193 g_snprintf(buf2, sizeof buf2, "%s", room);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4194
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4195 act = purple_menu_action_new(buf2,
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4196 PURPLE_CALLBACK(yahoo_game),
12919
519199cca273 [gaim-migrate @ 15272]
Etan Reisner <deryni@pidgin.im>
parents: 12878
diff changeset
4197 NULL, NULL);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4198 m = g_list_append(m, act);
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4199 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4200 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4201 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4202
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4203 if (f) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4204 act = purple_menu_action_new(_("Presence Settings"), NULL, NULL,
12919
519199cca273 [gaim-migrate @ 15272]
Etan Reisner <deryni@pidgin.im>
parents: 12878
diff changeset
4205 build_presence_submenu(f, gc));
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4206 m = g_list_append(m, act);
27792
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4207
28788
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4208 if (f->fed == YAHOO_FEDERATION_NONE) {
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4209 act = purple_menu_action_new(_("Start Doodling"),
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4210 PURPLE_CALLBACK(yahoo_doodle_blist_node),
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4211 NULL, NULL);
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4212 m = g_list_append(m, act);
17d9c1210077 Disable unsupported actions for federated users on Yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28786
diff changeset
4213 }
27792
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4214
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4215 act = purple_menu_action_new(_("Set User Info..."),
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4216 PURPLE_CALLBACK(yahoo_userinfo_blist_node),
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4217 NULL, NULL);
24c414559007 Allow changing contact details for folks in the buddylist.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27791
diff changeset
4218 m = g_list_append(m, act);
11800
622741e6201c [gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11718
diff changeset
4219 }
622741e6201c [gaim-migrate @ 14091]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11718
diff changeset
4220
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4221 return m;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4222 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4223
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4224 GList *yahoo_blist_node_menu(PurpleBlistNode *node)
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4225 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4226 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4227 return yahoo_buddy_menu((PurpleBuddy *) node);
9030
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4228 } else {
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4229 return NULL;
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4230 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4231 }
7b574a641391 [gaim-migrate @ 9806]
Mark Doliner <markdoliner@pidgin.im>
parents: 9015
diff changeset
4232
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4233 static void yahoo_act_id(PurpleConnection *gc, PurpleRequestFields *fields)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4234 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4235 YahooData *yd = gc->proto_data;
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4236 const char *name = yd->profiles[purple_request_fields_get_choice(fields, "id")];
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4237
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4238 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4239 yahoo_packet_hash_str(pkt, 3, name);
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
4240 yahoo_packet_send_and_free(pkt, yd);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4241
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4242 purple_connection_set_display_name(gc, name);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4243 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4244
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
4245 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
4246 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
4247 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
4248 {
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4249 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
4250 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
4251 gchar *url;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4252 YahooData *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
4253
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4254 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
4255
22980
b5c23c9bbd24 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents: 22942
diff changeset
4256 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
4257
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4258 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
4259 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
4260 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
4261 /* 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
4262 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
4263 "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
4264 ".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
4265 "&.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
4266 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
4267 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
4268 }
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4269
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4270 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
4271 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
4272 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
4273 }
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4274
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4275 /* 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
4276 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
4277
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4278 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
4279 }
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4280
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4281
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4282 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
4283 {
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4284 /* 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
4285 /* 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
4286
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4287 PurpleConnection *gc = action->context;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4288 YahooData *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
4289
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4290 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
4291 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
4292 /* 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
4293 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
4294 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
4295 "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
4296 "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
4297 "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
4298 "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
4299 "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
4300 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
4301 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
4302
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
4303 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
4304 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
4305 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
4306 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
4307
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4308 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
4309
22980
b5c23c9bbd24 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <datallah@pidgin.im>
parents: 22942
diff changeset
4310 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
4311 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
4312 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
4313 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
4314 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
4315 "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
4316 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
4317 }
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4318 }
e54f19f8521b Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <datallah@pidgin.im>
parents: 18946
diff changeset
4319
27716
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4320 static void
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4321 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
4322 {
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4323 yahoo_set_userinfo(action->context);
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4324 }
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
4325
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4326 static void yahoo_show_act_id(PurplePluginAction *action)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4327 {
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4328 PurpleRequestFields *fields;
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4329 PurpleRequestFieldGroup *group;
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4330 PurpleRequestField *field;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4331 PurpleConnection *gc = (PurpleConnection *) action->context;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4332 YahooData *yd = purple_connection_get_protocol_data(gc);
27416
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4333 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
4334 int iter;
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4335
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4336 fields = purple_request_fields_new();
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4337 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
4338 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
4339 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
4340 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
4341
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4342 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
4343 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
4344 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
4345 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
4346 }
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4347
e99beec5e5c7 Remember the profile ids associated with an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27415
diff changeset
4348 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
4349 fields,
5493
f30de3b116ea [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
4350 _("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
4351 _("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
4352 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
4353 gc);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4354 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4355
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4356 static void yahoo_show_chat_goto(PurplePluginAction *action)
7878
1d2f95edc400 [gaim-migrate @ 8532]
Tim Ringenbach <marv@pidgin.im>
parents: 7865
diff changeset
4357 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4358 PurpleConnection *gc = (PurpleConnection *) action->context;
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
4359 purple_request_input(gc, NULL, _("Join whom in chat?"), NULL,
8697
c5e51aef2026 [gaim-migrate @ 9450]
Jon Oberheide
parents: 8620
diff changeset
4360 "", FALSE, FALSE, NULL,
7878
1d2f95edc400 [gaim-migrate @ 8532]
Tim Ringenbach <marv@pidgin.im>
parents: 7865
diff changeset
4361 _("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
4362 _("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
4363 purple_connection_get_account(gc), NULL, NULL,
21175
c6d76b49c206 disapproval of revision '8ba833993a115415727bb1b70362e0bd1603c169'
Richard Laager <rlaager@pidgin.im>
parents: 21174
diff changeset
4364 gc);
7878
1d2f95edc400 [gaim-migrate @ 8532]
Tim Ringenbach <marv@pidgin.im>
parents: 7865
diff changeset
4365 }
1d2f95edc400 [gaim-migrate @ 8532]
Tim Ringenbach <marv@pidgin.im>
parents: 7865
diff changeset
4366
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4367 GList *yahoo_actions(PurplePlugin *plugin, gpointer context) {
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4368 GList *m = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4369 PurplePluginAction *act;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4370
27716
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4371 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
4372 yahoo_set_userinfo_fn);
a3ed37ab91b8 Allow setting some personal information for an account.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27700
diff changeset
4373 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
4374
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4375 act = purple_plugin_action_new(_("Activate ID..."),
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
4376 yahoo_show_act_id);
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
4377 m = g_list_append(m, act);
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
4378
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4379 act = purple_plugin_action_new(_("Join User in Chat..."),
9015
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
4380 yahoo_show_chat_goto);
3c27e9074fa2 [gaim-migrate @ 9791]
Christopher O'Brien <siege@pidgin.im>
parents: 8993
diff changeset
4381 m = g_list_append(m, act);
7878
1d2f95edc400 [gaim-migrate @ 8532]
Tim Ringenbach <marv@pidgin.im>
parents: 7865
diff changeset
4382
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
4383 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
4384 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
4385 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
4386 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
4387
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4388 return m;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4389 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4390
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4391 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
4392 PurpleConnection *gc;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4393 char *who;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4394 char *what;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4395 };
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4396
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4397 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
4398 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
4399 {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4400 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
4401 PurpleConnection *gc = sms_cb_data->gc;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4402 YahooData *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
4403 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
4404 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
4405 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
4406 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
4407
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
4408 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
4409
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
4410 if (error_message != NULL) {
28556
6b68ccdfd87f Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28539
diff changeset
4411 purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4412
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4413 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
4414 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
4415 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
4416 return ;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4417 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4418 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
4419 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
4420 xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no");
28557
59a6aca41229 Don't free what you don't own.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28556
diff changeset
4421 const char *mobile_no = 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
4422
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4423 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
4424 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
4425 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
4426
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4427 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
4428 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
4429
29323
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4430 purple_debug_info("yahoo", "SMS validate data: %s\n", webdata);
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4431
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4432 if (status && g_str_equal(status, "Valid") == 0) {
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4433 g_hash_table_insert(yd->sms_carrier,
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4434 g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4435 yahoo_send_im(sms_cb_data->gc, sms_cb_data->who,
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4436 sms_cb_data->what, PURPLE_MESSAGE_SEND);
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4437 } else {
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4438 g_hash_table_insert(yd->sms_carrier,
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4439 g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4440 purple_conversation_write(conv, NULL,
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4441 _("Can't send SMS. Unknown mobile carrier."),
4edf02a13d72 * Don't crash if status is NULL
Mark Doliner <markdoliner@pidgin.im>
parents: 28788
diff changeset
4442 PURPLE_MESSAGE_SYSTEM, time(NULL));
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4443 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4444
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4445 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
4446 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
4447 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
4448 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
4449 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
4450 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
4451 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
4452 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4453 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4454
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4455 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
4456 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4457 YahooData *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
4458 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
4459 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
4460 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
4461 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
4462 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
4463 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
4464 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
4465
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4466 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
4467 return;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4468
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4469 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
4470 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
4471 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
4472 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
4473
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4474 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
4475 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
4476
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4477 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
4478
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4479 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
4480 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
4481
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4482 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
4483 "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
4484 "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
4485 "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
4486 "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
4487 "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
4488 "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
4489 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
4490
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4491 /* 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
4492 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
4493 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
4494
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
4495 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
4496 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
4497 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
4498 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
4499
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4500 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
4501 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
4502
30266
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
4503 if (url_data)
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
4504 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
5eb39cfb872a yahoo: Fix a few race-condition crashes at login
Paul Aurich <darkrain42@pidgin.im>
parents: 29985
diff changeset
4505 else {
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4506 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
4507 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account);
28556
6b68ccdfd87f Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28539
diff changeset
4508 purple_conversation_write(conv, NULL, _("Can't send SMS. Unable to obtain mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4509 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
4510 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
4511 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
4512 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4513 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4514
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4515 int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4516 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4517 YahooData *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
4518 struct yahoo_packet *pkt = NULL;
6629
9d6bbc91ba24 [gaim-migrate @ 7153]
Tim Ringenbach <marv@pidgin.im>
parents: 6623
diff changeset
4519 char *msg = yahoo_html_to_codes(what);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4520 char *msg2;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4521 gboolean utf8 = TRUE;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4522 PurpleWhiteboard *wb;
9828
4b0ba5330408 [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
4523 int ret = 1;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4524 const char *fed_who;
24623
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4525 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
4526 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
4527 struct yahoo_p2p_data *p2p_data;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4528 YahooFederation fed = YAHOO_FEDERATION_NONE;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4529 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
4530
24623
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4531 if(msg2) {
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4532 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
4533 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
4534
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4535 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
4536 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
4537 " 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
4538 " 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
4539 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
4540 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
4541 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
4542 return -E2BIG;
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4543 }
cc86f44f12d0 This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24334
diff changeset
4544 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4545
28786
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
4546 fed = yahoo_get_federation_from_name(who);
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
4547
28589
f06bba81ed0f I think this is the more correct way of determining invisibility.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28557
diff changeset
4548 if (who[0] == '+') {
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4549 /* 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
4550 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
4551 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
4552 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
4553 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
4554
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4555 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
4556 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
4557 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
4558 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
4559 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
4560 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
4561 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
4562
28556
6b68ccdfd87f Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28539
diff changeset
4563 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
4564
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4565 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
4566
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4567 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
4568 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
4569 return ret;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4570 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4571 else if( strcmp(carrier,"Unknown") == 0 ) {
28556
6b68ccdfd87f Mark some strings for translation.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28539
diff changeset
4572 purple_conversation_write(conv, NULL, _("Can't send SMS. Unknown mobile carrier."), PURPLE_MESSAGE_SYSTEM, time(NULL));
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4573
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4574 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
4575 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
4576 return -1;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4577 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4578
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4579 alias = purple_account_get_alias(account);
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4580 pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, yd->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
4581 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
4582 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
4583 69, alias,
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4584 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
4585 68, carrier,
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4586 14, msg2);
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4587 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
4588
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4589 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
4590 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
4591
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4592 return ret;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4593 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4594
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4595 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, yd->session_id);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4596 fed_who = who;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4597 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4598 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4599 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4600 case YAHOO_FEDERATION_IBM:
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
4601 case YAHOO_FEDERATION_PBX:
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4602 fed_who += 4;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4603 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4604 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4605 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4606 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
4607 }
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4608 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, fed_who);
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4609 if (fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4610 yahoo_packet_hash_int(pkt, 241, fed);
14320
a1edd2ea10c3 [gaim-migrate @ 16940]
Tim Ringenbach <marv@pidgin.im>
parents: 14254
diff changeset
4611
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4612 if (utf8)
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4613 yahoo_packet_hash_str(pkt, 97, "1");
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4614 yahoo_packet_hash_str(pkt, 14, msg2);
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4615
13851
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4616 /*
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4617 * IMVironment.
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4618 *
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4619 * 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
4620 * 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
4621 *
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4622 * Otherwise attempt to use the same IMVironment as the remote user,
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4623 * just so that we don't inadvertantly reset their IMVironment back
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4624 * to nothing.
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4625 *
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4626 * If they have not set an IMVironment, then use the default.
13851
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4627 */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4628 wb = purple_whiteboard_get_session(gc->account, who);
11475
1e222e6e52a0 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
4629 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
4630 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY);
11475
1e222e6e52a0 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
4631 else
13851
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4632 {
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4633 const char *imv;
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4634 imv = g_hash_table_lookup(yd->imvironments, who);
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4635 if (imv != NULL)
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4636 yahoo_packet_hash_str(pkt, 63, imv);
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4637 else
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4638 yahoo_packet_hash_str(pkt, 63, ";0");
27bc39ea07f8 [gaim-migrate @ 16306]
Mark Doliner <markdoliner@pidgin.im>
parents: 13844
diff changeset
4639 }
11608
07a4d5ffdb08 [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
4640
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4641 yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4642 yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
4643 if (!yd->picture_url)
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4644 yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */
9306
3df21f4d438b [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
4645 else
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4646 yahoo_packet_hash_str(pkt, 206, "2");
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4647
9828
4b0ba5330408 [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
4648 /* 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
4649 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
4650 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4651 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) {
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4652 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
4653 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
4654 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4655 else {
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4656 yahoo_packet_send(pkt, yd);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4657 if(!fed)
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
4658 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
4659 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4660 }
9828
4b0ba5330408 [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
4661 else
4b0ba5330408 [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
4662 ret = -E2BIG;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4663
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4664 yahoo_packet_free(pkt);
6629
9d6bbc91ba24 [gaim-migrate @ 7153]
Tim Ringenbach <marv@pidgin.im>
parents: 6623
diff changeset
4665
9d6bbc91ba24 [gaim-migrate @ 7153]
Tim Ringenbach <marv@pidgin.im>
parents: 6623
diff changeset
4666 g_free(msg);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4667 g_free(msg2);
6629
9d6bbc91ba24 [gaim-migrate @ 7153]
Tim Ringenbach <marv@pidgin.im>
parents: 6623
diff changeset
4668
9828
4b0ba5330408 [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
4669 return ret;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4670 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4671
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4672 unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
4673 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4674 YahooData *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
4675 struct yahoo_p2p_data *p2p_data;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4676 YahooFederation fed = YAHOO_FEDERATION_NONE;
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
4677 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
4678
28786
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
4679 fed = yahoo_get_federation_from_name(who);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4680
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4681 /* 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
4682 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
4683 return 0;
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4684
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4685 pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, yd->session_id);
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
4686
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4687 /* check to see if p2p link exists, send through it */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4688 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !fed) {
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4689 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4690 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
4691 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
4692 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
4693 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
4694 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4695 else { /* send through yahoo server */
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4696
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4697 const char *fed_who = who;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4698 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4699 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4700 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4701 case YAHOO_FEDERATION_IBM:
29324
125eb74677d6 Support Yahoo !PingBox. Includes a couple warning fixes. Fixes #7347.
Kartik Mohta <kartikmohta@gmail.com>
parents: 29323
diff changeset
4702 case YAHOO_FEDERATION_PBX:
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4703 fed_who += 4;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4704 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4705 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4706 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4707 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4708 }
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
4709
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4710 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4711 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4712 5, fed_who, 1002, "1");
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4713 if (fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4714 yahoo_packet_hash_int(pkt, 241, fed);
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4715 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
4716 }
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
4717
3001
9fc89391c8fa [gaim-migrate @ 3014]
Sean Egan <seanegan@pidgin.im>
parents: 2993
diff changeset
4718 return 0;
2993
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
4719 }
0340d0a8b810 [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
4720
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4721 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
4722 {
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4723 YahooFriend *f = value;
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4724 if (f && f->presence == YAHOO_PRESENCE_ONLINE)
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4725 f->presence = YAHOO_PRESENCE_DEFAULT;
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4726 }
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4727
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4728 void yahoo_set_status(PurpleAccount *account, PurpleStatus *status)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4729 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4730 PurpleConnection *gc;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4731 PurplePresence *presence;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4732 YahooData *yd;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4733 struct yahoo_packet *pkt;
10400
5f11925078e5 [gaim-migrate @ 11631]
Sean Egan <seanegan@pidgin.im>
parents: 10394
diff changeset
4734 int old_status;
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4735 const char *msg = NULL;
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4736 char *tmp = NULL;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
4737 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
4738 gboolean utf8 = TRUE;
9984
3662f75a49fc [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
4739
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4740 if (!purple_status_is_active(status))
10400
5f11925078e5 [gaim-migrate @ 11631]
Sean Egan <seanegan@pidgin.im>
parents: 10394
diff changeset
4741 return;
5f11925078e5 [gaim-migrate @ 11631]
Sean Egan <seanegan@pidgin.im>
parents: 10394
diff changeset
4742
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4743 gc = purple_account_get_connection(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4744 presence = purple_status_get_presence(status);
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4745 yd = (YahooData *)gc->proto_data;
10400
5f11925078e5 [gaim-migrate @ 11631]
Sean Egan <seanegan@pidgin.im>
parents: 10394
diff changeset
4746 old_status = yd->current_status;
9984
3662f75a49fc [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
4747
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4748 yd->current_status = get_yahoo_status_from_purple_status(status);
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4749
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4750 if (yd->current_status == YAHOO_STATUS_CUSTOM)
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4751 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4752 msg = purple_status_get_attr_string(status, "message");
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4753
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4754 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
4755 tmp = yahoo_string_encode(gc, msg, &utf8);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4756 conv_msg = purple_markup_strip_html(tmp);
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4757 g_free(tmp);
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4758 } else {
11972
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4759 if ((msg == NULL) || (*msg == '\0'))
23ac6d9de1fa [gaim-migrate @ 14265]
Mark Doliner <markdoliner@pidgin.im>
parents: 11970
diff changeset
4760 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
4761 tmp = yahoo_string_encode(gc, msg, &utf8);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4762 conv_msg = purple_markup_strip_html(tmp);
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4763 g_free(tmp);
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4764 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4765 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4766
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4767 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4768 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4769 yahoo_packet_hash_str(pkt, 13, "2");
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
4770 yahoo_packet_send_and_free(pkt, yd);
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4771
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4772 return;
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4773 }
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4774
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4775 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4776 yahoo_packet_hash_int(pkt, 10, yd->current_status);
6847
0fda06bb588a [gaim-migrate @ 7392]
Tim Ringenbach <marv@pidgin.im>
parents: 6840
diff changeset
4777
9984
3662f75a49fc [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
4778 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
4779 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4780 yahoo_packet_hash_str(pkt, 19, conv_msg);
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4781 } else {
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4782 yahoo_packet_hash_str(pkt, 19, "");
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4783 }
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4784
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4785 g_free(conv_msg);
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4786
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4787 if (purple_presence_is_idle(presence))
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4788 yahoo_packet_hash_str(pkt, 47, "2");
28517
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4789 else {
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4790 if (!purple_status_is_available(status))
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4791 yahoo_packet_hash_str(pkt, 47, "1");
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4792 else
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4793 yahoo_packet_hash_str(pkt, 47, "0");
52c2631c31c3 Fixes #10224
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28404
diff changeset
4794 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4795
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
4796 yahoo_packet_send_and_free(pkt, yd);
9984
3662f75a49fc [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
4797
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4798 if (old_status == YAHOO_STATUS_INVISIBLE) {
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4799 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, yd->session_id);
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4800 yahoo_packet_hash_str(pkt, 13, "1");
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
4801 yahoo_packet_send_and_free(pkt, yd);
10989
ea41b63cfea5 [gaim-migrate @ 12827]
Daniel Atallah <datallah@pidgin.im>
parents: 10963
diff changeset
4802
12010
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4803 /* Any per-session presence settings are removed */
aa2f3b07ec09 [gaim-migrate @ 14303]
Peter Lawler <pidgin@bleeter.id.au>
parents: 11985
diff changeset
4804 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
4805
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4806 }
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4807 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4808
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4809 void yahoo_set_idle(PurpleConnection *gc, int idle)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4810 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4811 YahooData *yd = gc->proto_data;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4812 struct yahoo_packet *pkt = NULL;
8503
08a06c098df6 [gaim-migrate @ 9239]
Tim Ringenbach <marv@pidgin.im>
parents: 8482
diff changeset
4813 char *msg = NULL, *msg2 = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4814 PurpleStatus *status = NULL;
28360
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4815 gboolean invisible = FALSE;
13559
c7256daef931 [gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13462
diff changeset
4816
13688
240e5b90adb4 [gaim-migrate @ 16089]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13559
diff changeset
4817 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4818 yd->current_status = YAHOO_STATUS_IDLE;
13559
c7256daef931 [gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13462
diff changeset
4819 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4820 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4821 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
4822 }
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4823
28589
f06bba81ed0f I think this is the more correct way of determining invisibility.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28557
diff changeset
4824 invisible = (yd->current_status == YAHOO_STATUS_INVISIBLE);
28360
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4825
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4826 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, yd->session_id);
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4827
28360
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4828 if (!idle && invisible)
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4829 yahoo_packet_hash_int(pkt, 10, YAHOO_STATUS_AVAILABLE);
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4830 else
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4831 yahoo_packet_hash_int(pkt, 10, yd->current_status);
8530ff1fb75e Fixes #7722.
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28326
diff changeset
4832
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4833 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10401
diff changeset
4834 const char *tmp;
13559
c7256daef931 [gaim-migrate @ 15937]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 13462
diff changeset
4835 if (status == NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4836 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4837 tmp = purple_status_get_attr_string(status, "message");
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10401
diff changeset
4838 if (tmp != NULL) {
27104
86b2bd63ee1c Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27079
diff changeset
4839 gboolean utf8 = TRUE;
86b2bd63ee1c Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 27079
diff changeset
4840 msg = yahoo_string_encode(gc, tmp, &utf8);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4841 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
4842 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10401
diff changeset
4843 yahoo_packet_hash_str(pkt, 19, msg2);
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10401
diff changeset
4844 } else {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4845 /* 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
4846 * 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
4847 yahoo_packet_hash_str(pkt, 19, _("Away"));
10504
eae130eefbfe [gaim-migrate @ 11796]
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 10401
diff changeset
4848 }
6847
0fda06bb588a [gaim-migrate @ 7392]
Tim Ringenbach <marv@pidgin.im>
parents: 6840
diff changeset
4849 } else {
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4850 yahoo_packet_hash_str(pkt, 19, "");
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4851 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4852
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4853 if (idle)
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
4854 yahoo_packet_hash_str(pkt, 47, "2");
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4855
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
4856 yahoo_packet_send_and_free(pkt, yd);
10373
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4857
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4858 g_free(msg);
0bf7666d02d8 [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
4859 g_free(msg2);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4860 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4861
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4862 GList *yahoo_status_types(PurpleAccount *account)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4863 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4864 PurpleStatusType *type;
9979
fff3db335f9b [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
4865 GList *types = NULL;
fff3db335f9b [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
4866
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4867 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
4868 NULL, TRUE, TRUE, FALSE,
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4869 "message", _("Message"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4870 purple_value_new(PURPLE_TYPE_STRING), NULL);
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4871 types = g_list_append(types, type);
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4872
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4873 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
4874 NULL, TRUE, TRUE, FALSE,
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4875 "message", _("Message"),
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4876 purple_value_new(PURPLE_TYPE_STRING), NULL);
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4877 types = g_list_append(types, type);
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4878
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4879 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
4880 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4881
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4882 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
4883 types = g_list_append(types, type);
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4884
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4885 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
4886 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4887
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4888 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
4889 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4890
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4891 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
4892 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4893
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4894 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
4895 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4896
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4897 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
4898 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4899
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4900 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
4901 types = g_list_append(types, type);
f59128c6d479 [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
4902
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4903 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
4904 types = g_list_append(types, type);
a8ac8491df3a [gaim-migrate @ 14505]
Peter Lawler <pidgin@bleeter.id.au>
parents: 12152
diff changeset
4905
11970
5160cebfa5e0 [gaim-migrate @ 14263]
Mark Doliner <markdoliner@pidgin.im>
parents: 11969
diff changeset
4906
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4907 type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE);
9979
fff3db335f9b [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
4908 types = g_list_append(types, type);
fff3db335f9b [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
4909
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4910 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
4911 types = g_list_append(types, type);
4aa7a873628d [gaim-migrate @ 15001]
Mark Doliner <markdoliner@pidgin.im>
parents: 12645
diff changeset
4912
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
4913 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE);
15589
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
4914 types = g_list_append(types, type);
9f28c50427c1 Yahoo mobile status
Sean Egan <seanegan@pidgin.im>
parents: 15558
diff changeset
4915
9979
fff3db335f9b [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
4916 return types;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4917 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4918
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4919 void yahoo_keepalive(PurpleConnection *gc)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4920 {
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
4921 struct yahoo_packet *pkt;
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4922 YahooData *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
4923 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
4924
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
4925 /* 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
4926 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
4927 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
4928
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
4929 /* 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
4930 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
4931 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
4932 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
4933 } else {
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4934 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, yd->session_id);
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
4935 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
4936 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
4937 }
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
4938 } else {
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4939 pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, yd->session_id);
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
4940 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
4941 }
9376
72964e97c46e [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
4942 }
72964e97c46e [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
4943
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
4944 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
4945 yd->last_keepalive = now;
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4946 pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, yd->session_id);
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
4947 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
4948 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
4949 }
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
4950
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4951 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4952
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
4953 void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4954 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
4955 YahooData *yd = (YahooData *)gc->proto_data;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4956 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
4957 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
4958 char *group2;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4959 const char *bname;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4960 const char *fed_bname;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4961 YahooFederation fed = YAHOO_FEDERATION_NONE;
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4962
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4963 if (!yd->logged_in)
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4964 return;
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4965
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4966 fed_bname = bname = purple_buddy_get_name(buddy);
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4967 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
4968 return;
8011e6bc10b5 [gaim-migrate @ 12768]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10944
diff changeset
4969
28786
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
4970 fed = yahoo_get_federation_from_name(bname);
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
4971 if (fed != YAHOO_FEDERATION_NONE)
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4972 fed_bname += 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
4973
22367
7e33f5d352f5 Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents: 22366
diff changeset
4974 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
4975 if (g)
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
4976 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
4977 else
7e33f5d352f5 Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <markdoliner@pidgin.im>
parents: 22366
diff changeset
4978 group = "Buddies";
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
4979
7829
86a709c24689 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
4980 group2 = yahoo_string_encode(gc, group, NULL);
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
4981 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4982 if (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4983 yahoo_packet_hash(pkt, "sssssssisss",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4984 14, "",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4985 65, group2,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4986 97, "1",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4987 1, purple_connection_get_display_name(gc),
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4988 302, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4989 300, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4990 7, fed_bname,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4991 241, fed,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4992 334, "0",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4993 301, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4994 303, "319"
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4995 );
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4996 }
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4997 else {
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
4998 yahoo_packet_hash(pkt, "ssssssssss",
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
4999 14, "",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5000 65, group2,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5001 97, "1",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5002 1, purple_connection_get_display_name(gc),
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5003 302, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5004 300, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5005 7, fed_bname,
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5006 334, "0",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5007 301, "319",
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5008 303, "319"
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5009 );
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5010 }
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5011
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5012 yahoo_packet_send_and_free(pkt, yd);
7829
86a709c24689 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
5013 g_free(group2);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
5014 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
5015
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5016 void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
5017 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
5018 YahooData *yd = (YahooData *)gc->proto_data;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5019 struct yahoo_packet *pkt;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5020 GSList *buddies, *l;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5021 PurpleGroup *g;
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5022 gboolean remove = TRUE;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5023 char *cg;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5024 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
5025 YahooFriend *f = NULL;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5026 YahooFederation fed = YAHOO_FEDERATION_NONE;
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5027
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5028 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
5029 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
5030 if (!f)
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
5031 return;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5032 fed = f->fed;
6784
6623b18f188a [gaim-migrate @ 7323]
Tim Ringenbach <marv@pidgin.im>
parents: 6761
diff changeset
5033
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5034 gname = purple_group_get_name(group);
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5035 buddies = purple_find_buddies(purple_connection_get_account(gc), bname);
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5036 for (l = buddies; l; l = l->next) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5037 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
5038 if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) {
6840
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5039 remove = FALSE;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5040 break;
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5041 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5042 }
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5043
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5044 g_slist_free(buddies);
d4e05db5bccb [gaim-migrate @ 7385]
Tim Ringenbach <marv@pidgin.im>
parents: 6820
diff changeset
5045
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5046 if (remove) {
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5047 g_hash_table_remove(yd->friends, bname);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5048 f = NULL; /* f no longer valid - Just making it clear */
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5049 }
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5050
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5051 cg = yahoo_string_encode(gc, gname, NULL);
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
5052 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, yd->session_id);
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
5053
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5054 switch (fed) {
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5055 case YAHOO_FEDERATION_MSN:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5056 case YAHOO_FEDERATION_OCS:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5057 case YAHOO_FEDERATION_IBM:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5058 bname += 4;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5059 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5060 case YAHOO_FEDERATION_NONE:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5061 default:
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5062 break;
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5063 }
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5064
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5065 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
5066 7, bname, 65, cg);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5067 if (fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5068 yahoo_packet_hash_int(pkt, 241, fed);
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5069 yahoo_packet_send_and_free(pkt, yd);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5070 g_free(cg);
2681
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
5071 }
73cd94b9e78e [gaim-migrate @ 2694]
Eric Warmenhoven <warmenhoven@yahoo.com>
parents:
diff changeset
5072
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5073 void yahoo_add_deny(PurpleConnection *gc, const char *who) {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
5074 YahooData *yd = (YahooData *)gc->proto_data;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5075 struct yahoo_packet *pkt;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5076 YahooFederation fed = YAHOO_FEDERATION_NONE;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5077
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5078 if (!yd->logged_in)
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5079 return;
8113
6a2ffc66c022 [gaim-migrate @ 8817]
Tim Ringenbach <marv@pidgin.im>
parents: 8087
diff changeset
5080
6a2ffc66c022 [gaim-migrate @ 8817]
Tim Ringenbach <marv@pidgin.im>
parents: 8087
diff changeset
5081 if (!who || who[0] == '\0')
6a2ffc66c022 [gaim-migrate @ 8817]
Tim Ringenbach <marv@pidgin.im>
parents: 8087
diff changeset
5082 return;
6a2ffc66c022 [gaim-migrate @ 8817]
Tim Ringenbach <marv@pidgin.im>
parents: 8087
diff changeset
5083
28786
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
5084 fed = yahoo_get_federation_from_name(who);
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
5085
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
5086 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
28371
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5087
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5088 if(fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5089 yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "1");
28371
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5090 else
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5091 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "1");
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5092
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5093 yahoo_packet_send_and_free(pkt, yd);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5094 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5095
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5096 void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
5097 YahooData *yd = (YahooData *)gc->proto_data;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5098 struct yahoo_packet *pkt;
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5099 YahooFederation fed = YAHOO_FEDERATION_NONE;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5100
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5101 if (!yd->logged_in)
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5102 return;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5103
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5104 if (!who || who[0] == '\0')
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5105 return;
28786
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
5106 fed = yahoo_get_federation_from_name(who);
a0366821d1e4 Cannot send a file to a federated user on yahoo.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 28770
diff changeset
5107
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
5108 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, yd->session_id);
28371
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5109
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5110 if(fed)
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5111 yahoo_packet_hash(pkt, "ssis", 1, purple_connection_get_display_name(gc), 7, who+4, 241, fed, 13, "2");
28371
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5112 else
0e82a49046ca This will fix adding, removing MSN contacts on yahoo's deny list
Sulabh Mahajan <sulabh@pidgin.im>
parents: 28369
diff changeset
5113 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2");
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31285
diff changeset
5114
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5115 yahoo_packet_send_and_free(pkt, yd);
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5116 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5117
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5118 void yahoo_set_permit_deny(PurpleConnection *gc)
22371
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5119 {
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5120 PurpleAccount *account;
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5121 GSList *deny;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5122
22371
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5123 account = purple_connection_get_account(gc);
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5124
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5125 switch (account->perm_deny)
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5126 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5127 case PURPLE_PRIVACY_ALLOW_ALL:
22371
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5128 for (deny = account->deny; deny; deny = deny->next)
10143
4c6356719734 [gaim-migrate @ 11214]
Tim Ringenbach <marv@pidgin.im>
parents: 10141
diff changeset
5129 yahoo_rem_deny(gc, deny->data);
4c6356719734 [gaim-migrate @ 11214]
Tim Ringenbach <marv@pidgin.im>
parents: 10141
diff changeset
5130 break;
22371
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5131
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5132 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
5133 case PURPLE_PRIVACY_ALLOW_USERS:
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5134 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
5135 case PURPLE_PRIVACY_DENY_ALL:
22371
b1497b68575c Clean up a function
Mark Doliner <markdoliner@pidgin.im>
parents: 22370
diff changeset
5136 for (deny = account->deny; deny; deny = deny->next)
6760
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5137 yahoo_add_deny(gc, deny->data);
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5138 break;
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5139 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5140 }
b7078ee3cc54 [gaim-migrate @ 7292]
Jesse Farmer
parents: 6729
diff changeset
5141
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5142 void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5143 const char *old_group, const char *new_group)
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5144 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
5145 YahooData *yd = gc->proto_data;
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5146 struct yahoo_packet *pkt;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5147 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
5148 YahooFriend *f = yahoo_friend_find(gc, who);
26370
2f3de165c4bf msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26369
diff changeset
5149 const char *temp = NULL;
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5150
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5151 /* Step 0: If they aren't on the server list anyway,
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5152 * don't bother letting the server know.
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5153 */
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5154 if (!f)
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5155 return;
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5156
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5157 if(f->fed) {
26370
2f3de165c4bf msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26369
diff changeset
5158 temp = who+4;
2f3de165c4bf msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26369
diff changeset
5159 } else
2f3de165c4bf msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26369
diff changeset
5160 temp = who;
2f3de165c4bf msn interoperability: change groups
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26369
diff changeset
5161
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5162 /* If old and new are the same, we would probably
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5163 * end up deleting the buddy, which would be bad.
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5164 * This might happen because of the charset conversation.
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5165 */
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5166 gpn = yahoo_string_encode(gc, new_group, NULL);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5167 gpo = yahoo_string_encode(gc, old_group, NULL);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5168 if (!strcmp(gpn, gpo)) {
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5169 g_free(gpn);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5170 g_free(gpo);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5171 return;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5172 }
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5173
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
5174 pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, yd->session_id);
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5175 if(f->fed)
26362
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5176 yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc),
28660
db3b43e7fcea Handle adding Lotus Sametime and Microsoft OCS buddies to Yahoo! accounts.
Jason Cohen <kryojenik23-pidgin@steltek.com>
parents: 28602
diff changeset
5177 302, "240", 300, "240", 7, temp, 241, f->fed, 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
5178 "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
5179 else
de9cf498a73a resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@pidgin.im>
parents: 26360
diff changeset
5180 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
5181 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
5182 "240", 303, "240");
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5183 yahoo_packet_send_and_free(pkt, yd);
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5184
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5185 g_free(gpn);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5186 g_free(gpo);
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5187 }
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5188
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5189 void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5190 PurpleGroup *group, GList *moved_buddies)
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5191 {
27959
f842ae57da4e Move from "struct yahoo_data" to "YahooData" to be consistent with other structs
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27939
diff changeset
5192 YahooData *yd = gc->proto_data;
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5193 struct yahoo_packet *pkt;
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5194 char *gpn, *gpo;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5195
24398
4865c2ee6ea8 Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 24334
diff changeset
5196 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
5197 gpo = yahoo_string_encode(gc, old_name, NULL);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5198 if (!strcmp(gpn, gpo)) {
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5199 g_free(gpn);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5200 g_free(gpo);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5201 return;
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5202 }
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5203
27856
14c310410721 Change a crapton of our Yahoo! packets to use the session ID we're assigned
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27852
diff changeset
5204 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, yd->session_id);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5205 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
10394
ad8f7dfef0cb [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
5206 65, gpo, 67, gpn);
10392
6a9728e72c11 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
5207 yahoo_packet_send_and_free(pkt, yd);
7827
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5208 g_free(gpn);
080c98045e12 [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
5209 g_free(gpo);
6793
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5210 }
f96cfd6ee8cd [gaim-migrate @ 7332]
Tim Ringenbach <marv@pidgin.im>
parents: 6792
diff changeset
5211
10937
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
5212 /********************************* Commands **********************************/
1753f4709889 [gaim-migrate @ 12721]
Peter Lawler <pidgin@bleeter.id.au>
parents: 10784
diff changeset
5213
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5214 PurpleCmdRet
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5215 yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) {
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5216 PurpleAccount *account = purple_conversation_get_account(c);
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5217
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5218 if (*args && args[0])
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5219 return PURPLE_CMD_RET_FAILED;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5220
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
5221 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
5222
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5223 return PURPLE_CMD_RET_OK;
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5224 }
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5225
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5226 PurpleCmdRet
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5227 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd,
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5228 char **args, char **error, void *data)
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5229 {
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5230 GHashTable *comp;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5231 PurpleConnection *gc;
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5232
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5233 if (!args || !args[0])
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5234 return PURPLE_CMD_RET_FAILED;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5235
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5236 gc = purple_conversation_get_gc(conv);
27547
c136491361eb Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27529
diff changeset
5237 purple_debug_info("yahoo", "Trying to join %s \n", args[0]);
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5238
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5239 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
25335
f1039393e25a Plug a small leak
Daniel Atallah <datallah@pidgin.im>
parents: 24858
diff changeset
5240 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
5241 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat"));
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5242
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5243 yahoo_c_join(gc, comp);
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5244
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5245 g_hash_table_destroy(comp);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5246 return PURPLE_CMD_RET_OK;
10119
9c2b5c525a5e [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
5247 }
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12600
diff changeset
5248
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5249 PurpleCmdRet
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5250 yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd,
13041
0eebc22048e6 [gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents: 13021
diff changeset
5251 char **args, char **error, void *data)
0eebc22048e6 [gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents: 13021
diff changeset
5252 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5253 PurpleAccount *account = purple_conversation_get_account(conv);
13041
0eebc22048e6 [gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents: 13021
diff changeset
5254 if (*args && args[0])
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5255 return PURPLE_CMD_RET_FAILED;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5256 purple_roomlist_show_with_account(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15807
diff changeset
5257 return PURPLE_CMD_RET_OK;
13041
0eebc22048e6 [gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents: 13021
diff changeset
5258 }
0eebc22048e6 [gaim-migrate @ 15400]
Peter Lawler <pidgin@bleeter.id.au>
parents: 13021
diff changeset
5259
27560
95e7692b99eb Moved functions around and made some no longer static. All the functions
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27558
diff changeset
5260 gboolean yahoo_offline_message(const PurpleBuddy *buddy)
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12600
diff changeset
5261 {
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12600
diff changeset
5262 return TRUE;
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12600
diff changeset
5263 }
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
5264
19642
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5265 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
5266 {
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5267 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
5268
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
5269 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
5270 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
5271
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5272 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
5273
27547
c136491361eb Convert the yahoo prpl to using the debug convenience functions instead of
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 27529
diff changeset
5274 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
5275 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
5276 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
5277
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5278 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
5279 }
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5280
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5281 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
5282 {
19643
1794c23309d3 In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19642
diff changeset
5283 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
5284
1794c23309d3 In MSN prpl, use attention API. Can be disabled by undefining
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19642
diff changeset
5285 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
5286 /* 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
5287 /* 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
5288 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
5289 _("%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
5290 }
19642
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5291
f27b0a59548e Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeff Connelly <jeff2@soc.pidgin.im>
parents: 19609
diff changeset
5292 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
5293 }
12645
a907ba243930 [gaim-migrate @ 14983]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 12600
diff changeset
5294

mercurial