annotate libpurple/protocols/yahoo/yahoo.c @ 27071:077eae6f3d84

Update the yahoo prpl to use the new function I added. This should fix the issue in Adium's ticket 12231.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Sat, 30 May 2009 00:58:04 +0000
parents 37436c98201e
children 1dcf9c7311f1
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2 * purple
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
6 * source distribution.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
7 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
11 * (at your option) any later version.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
12 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
16 * GNU General Public License for more details.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
17 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
19680
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19672
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
21 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
22 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
23
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
24 #include "internal.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
25
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
26 #include "account.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
27 #include "accountopt.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
28 #include "blist.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
29 #include "cipher.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
30 #include "cmds.h"
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
31 #include "core.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "debug.h"
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
33 #include "network.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
34 #include "notify.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
35 #include "privacy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
36 #include "prpl.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
37 #include "proxy.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
38 #include "request.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
39 #include "server.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
40 #include "util.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
41 #include "version.h"
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
42 #include "xmlnode.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
43
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
44 #include "yahoo.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
45 #include "yahoochat.h"
18763
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
46 #include "yahoo_aliases.h"
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
47 #include "yahoo_doodle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "yahoo_filexfer.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "yahoo_friend.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "yahoo_packet.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "yahoo_picture.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "ycht.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 /* #define YAHOO_DEBUG */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
56 /* #define TRY_WEBMESSENGER_LOGIN 0 */
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
57
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
58 /* One hour */
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
59 #define PING_TIMEOUT 3600
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
60
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
61 /* One minute */
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
62 #define KEEPALIVE_TIMEOUT 60
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
63
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
64 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *, PurpleGroup *);
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
65 #ifdef TRY_WEBMESSENGER_LOGIN
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
66 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message);
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
67 #endif
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
68 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
70 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
71 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
72 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
73
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
74 if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
76
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
77 if (f->status == YAHOO_STATUS_OFFLINE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
78 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
79 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
80 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
81
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83 case YAHOO_STATUS_AVAILABLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 status = YAHOO_STATUS_TYPE_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 case YAHOO_STATUS_BRB:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 status = YAHOO_STATUS_TYPE_BRB;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 case YAHOO_STATUS_BUSY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 status = YAHOO_STATUS_TYPE_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 case YAHOO_STATUS_NOTATHOME:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 status = YAHOO_STATUS_TYPE_NOTATHOME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 case YAHOO_STATUS_NOTATDESK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 status = YAHOO_STATUS_TYPE_NOTATDESK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 case YAHOO_STATUS_NOTINOFFICE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 status = YAHOO_STATUS_TYPE_NOTINOFFICE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 case YAHOO_STATUS_ONPHONE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 status = YAHOO_STATUS_TYPE_ONPHONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 case YAHOO_STATUS_ONVACATION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 status = YAHOO_STATUS_TYPE_ONVACATION;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 case YAHOO_STATUS_OUTTOLUNCH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 status = YAHOO_STATUS_TYPE_OUTTOLUNCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 case YAHOO_STATUS_STEPPEDOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 status = YAHOO_STATUS_TYPE_STEPPEDOUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 case YAHOO_STATUS_INVISIBLE: /* this should never happen? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 status = YAHOO_STATUS_TYPE_INVISIBLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
116 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 if (!f->away)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 status = YAHOO_STATUS_TYPE_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 status = YAHOO_STATUS_TYPE_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 default:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
124 purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
126 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 if (status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129 if (f->status == YAHOO_STATUS_CUSTOM)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
130 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 yahoo_friend_get_status_message(f), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
132 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
133 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
136 if (f->idle != 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
137 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
139 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0);
15525
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
140
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
141 if (f->sms)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
142 purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL);
15525
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
143 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
144 purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
145 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
146
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
147 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
149 PurpleAccount *account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 char *name = NULL;
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
154 gboolean unicode = FALSE;
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
155 char *message = NULL;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
156 char *msn_name = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
158 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
20589
5723dbc6212d 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 <daniel.atallah@gmail.com>
parents: 19718
diff changeset
159 if (!purple_account_get_remember_password(account))
5723dbc6212d 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 <daniel.atallah@gmail.com>
parents: 19718
diff changeset
160 purple_account_set_password(account, NULL);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
161 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NAME_IN_USE,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
162 _("You have signed on from another location."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
164 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
165
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170 case 0: /* we won't actually do anything with this */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 case 1: /* we don't get the full buddy list here. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 if (!yd->logged_in) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
174 purple_connection_set_display_name(gc, pair->value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
175 purple_connection_set_state(gc, PURPLE_CONNECTED);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
176 yd->logged_in = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
177 if (yd->picture_upload_todo) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 yd->picture_upload_todo = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
181 yahoo_set_status(account, purple_account_get_active_status(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
183 /* this requests the list. i have a feeling that this is very evil
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 * scs.yahoo.com sends you the list before this packet without it being
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 * requested
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 * do_import(gc, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 * yahoo_packet_send_and_free(newpkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 case 8: /* how many online buddies we have */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 case 7: /* the current buddy */
19444
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
198 /* update the previous buddy before changing the variables */
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
199 if (f) {
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
200 if (message)
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
201 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode));
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
202 if (name)
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
203 yahoo_update_status(gc, name, f);
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
204 }
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
205 name = message = NULL;
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
206 f = NULL;
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
207 if (pair->value && g_utf8_validate(pair->value, -1, NULL)) {
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
208 name = pair->value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 f = yahoo_friend_find_or_new(gc, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 case 10: /* state */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 f->status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 f->away = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 f->away = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 if (f->status == YAHOO_STATUS_IDLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 /* Idle may have already been set in a more precise way in case 137 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
226 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 f->idle = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 if (f->status != YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230 yahoo_friend_set_status_message(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 f->sms = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 case 19: /* custom message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 if (f)
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
236 message = pair->value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 case 11: /* this is the buddy's session id */
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
239 if (f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
240 f->session_id = strtol(pair->value, NULL, 10);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
241 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
242 case 17: /* in chat? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 case 47: /* is custom status away or not? 2=idle*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
247
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 /* I have no idea what it means when this is
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249 * set when someone's available, but it doesn't
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 * mean idle. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 if (f->status == YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
252 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 f->away = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 if (f->away == 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 /* Idle may have already been set in a more precise way in case 137 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
262 case 138: /* either we're not idle, or we are but won't say how long */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 if (f->idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 f->idle = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 case 137: /* usually idle time in seconds, sometimes login time */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 if (f->status != YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 f->idle = time(NULL) - strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
277 if (strtol(pair->value, NULL, 10) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
279 f->status = YAHOO_STATUS_OFFLINE;
15525
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
280 if (name) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
281 purple_prpl_got_user_status(account, name, "offline", NULL);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
282 purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE);
15525
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
283 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 case 60: /* SMS */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 if (f) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 f->sms = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 case 197: /* Avatars */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 gsize len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 if (pair->value) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
300 decoded = purple_base64_decode(pair->value, &len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 if (len) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
302 tmp = purple_str_binary_to_ascii(decoded, len);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
303 purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
306 g_free(decoded);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
309 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
310 case 192: /* Pictures, aka Buddy Icons, checksum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 {
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15946
diff changeset
312 /* FIXME: Please, if you know this protocol,
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15946
diff changeset
313 * FIXME: fix up the strtol() stuff if possible. */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
314 int cksum = strtol(pair->value, NULL, 10);
16530
0b49b01e9482 Thanks to Bleeter, yahoo will not crash for non-existent buddyicons anymore.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16483
diff changeset
315 const char *locksum = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
316 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
321 b = purple_find_buddy(gc->account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 if (!cksum || (cksum == -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 yahoo_friend_set_buddy_icon_need_request(f, TRUE);
16386
e0c9a46b459f Move the prpl icon checksum code into the core, so we can delete the
Richard Laager <rlaager@wiktel.com>
parents: 15946
diff changeset
326 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
17054
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16998
diff changeset
334 if (b) {
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16998
diff changeset
335 locksum = purple_buddy_icons_get_checksum_for_user(b);
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16998
diff changeset
336 if (!locksum || (cksum != strtol(locksum, NULL, 10)))
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16998
diff changeset
337 yahoo_send_picture_request(gc, name);
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16998
diff changeset
338 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
340 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 case 16: /* Custom error message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
343 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
344 char *tmp = yahoo_string_decode(gc, pair->value, TRUE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
345 purple_notify_error(gc, NULL, tmp, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
348 break;
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
349 case 97: /* Unicode status message */
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
350 unicode = !strcmp(pair->value, "1");
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
351 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
352 case 244: /* client version number. Yahoo Client Detection */
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
353 if(f && strtol(pair->value, NULL, 10))
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
354 f->version_id = strtol(pair->value, NULL, 10);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
355 break;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
356 case 241: /* protocol buddy belongs to */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
357 if(strtol(pair->value, NULL, 10) == 2) {
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
358 msn_name = g_strconcat("msn/", name, NULL);
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
359 name = msn_name;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
360 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
361 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 default:
22651
3378d2701c2b I don't consider this an error.
Mark Doliner <mark@kingant.net>
parents: 22414
diff changeset
363 purple_debug_warning("yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 "Unknown status key %d\n", pair->key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
365 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
369 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
370
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
371 if (message && f)
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
372 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, message, unicode));
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
373
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
374 if (name && f) /* update the last buddy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
378 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
380 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
381 PurpleGroup *g;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 GSList *list, *i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
383 gboolean onlist = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 char *oname = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 char **oname_p = &oname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 GSList **list_p = &list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
388 if (!g_hash_table_lookup_extended(ht, purple_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
389 list = purple_find_buddies(account, name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
390 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 g_hash_table_steal(ht, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 b = i->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
395 g = purple_buddy_get_group(b);
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
396 if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
397 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 "Oh good, %s is in the right group (%s).\n", name, group);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 list = g_slist_delete_link(list, i);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 onlist = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 if (!onlist) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
406 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
408 if (!(g = purple_find_group(group))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
409 g = purple_group_new(group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
410 purple_blist_add_group(g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
411 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
412 b = purple_buddy_new(account, name, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
413 purple_blist_add_buddy(b, NULL, g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
414 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
415
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
416 if (list) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 if (!oname)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
418 oname = g_strdup(purple_normalize(account, name));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 g_hash_table_insert(ht, oname, list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 } else if (oname)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 g_free(oname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 char *name = key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427 GSList *list = value, *i;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
428 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
429 PurpleGroup *g;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
431 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 b = i->data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
433 g = purple_buddy_get_group(b);
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
434 purple_debug(PURPLE_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name,
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
435 purple_group_get_name(g));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
436 purple_blist_remove_buddy(b);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
438 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 static char *_getcookie(char *rawcookie)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 char *cookie = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 char *tmpcookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 char *cookieend;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 if (strlen(rawcookie) < 2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 tmpcookie = g_strdup(rawcookie+2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 cookieend = strchr(tmpcookie, ';');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 if (cookieend)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452 *cookieend = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 cookie = g_strdup(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455 g_free(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 return cookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 static void yahoo_process_cookie(struct yahoo_data *yd, char *c)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 if (c[0] == 'Y') {
22017
97d530d11cc0 Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
463 if (yd->cookie_y)
97d530d11cc0 Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
464 g_free(yd->cookie_y);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
465 yd->cookie_y = _getcookie(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
466 } else if (c[0] == 'T') {
22017
97d530d11cc0 Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
467 if (yd->cookie_t)
97d530d11cc0 Revert patch that added receive-only transfer support for Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
468 g_free(yd->cookie_t);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 yd->cookie_t = _getcookie(c);
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
470 } else
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
471 purple_debug_info("yahoo", "Unrecognized cookie '%c'\n", c[0]);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
472 yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
475 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
478
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
479 PurpleAccount *account = purple_connection_get_account(gc);
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
480 struct yahoo_data *yd = gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
481 GHashTable *ht;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 char *norm_bud = NULL;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
483 char *temp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 YahooFriend *f = NULL; /* It's your friends. They're going to want you to share your StarBursts. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
485 /* But what if you had no friends? */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
486 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
487 PurpleGroup *g;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
488 int protocol = 0;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
489 int stealth = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
491
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
495 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 switch (pair->key) {
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
499 case 302:
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 /* This is always 318 before a group, 319 before the first s/n in a group, 320 before any ignored s/n.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
501 * It is not sent for s/n's in a group after the first.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 * All ignored s/n's are listed last, so when we see a 320 we clear the group and begin marking the
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
503 * s/n's as ignored. It is always followed by an identical 300 key.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
504 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
505 if (pair->value && !strcmp(pair->value, "320")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
506 /* No longer in any group; this indicates the start of the ignore list. */
22406
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
507 g_free(yd->current_list15_grp);
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
508 yd->current_list15_grp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
509 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
513 if(temp != NULL) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
514 if(protocol == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
515 norm_bud = g_strconcat("msn/", temp, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
516 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
517 norm_bud = g_strdup(temp);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
518
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
519 if (yd->current_list15_grp) {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
520 /* This buddy is in a group */
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
521 f = yahoo_friend_find_or_new(gc, norm_bud);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
522 if (!(b = purple_find_buddy(account, norm_bud))) {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
523 if (!(g = purple_find_group(yd->current_list15_grp))) {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
524 g = purple_group_new(yd->current_list15_grp);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
525 purple_blist_add_group(g, NULL);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
526 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
527 b = purple_buddy_new(account, norm_bud, NULL);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
528 purple_blist_add_buddy(b, NULL, g, NULL);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
529 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
530 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
531 if(protocol != 0) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
532 f->protocol = protocol;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
533 purple_debug_info("yahoo", "Setting protocol to %d\n", f->protocol);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
534 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
535 if(stealth == 2)
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
536 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
537
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
538 /* set p2p status not connected and no p2p packet sent */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
539 if(protocol == 0) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
540 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
541 f->p2p_packet_sent = 0;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
542 } else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
543 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
544 } else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
545 /* This buddy is on the ignore list (and therefore in no group) */
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
546 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);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
547 purple_privacy_deny_add(account, norm_bud, 1);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
548 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
549
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
550 protocol = 0;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
551 stealth = 0;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
552 norm_bud = NULL;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
553 temp = NULL;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
554 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 case 300: /* This is 318 before a group, 319 before any s/n in a group, and 320 before any ignored s/n. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 case 65: /* This is the group */
22406
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
559 g_free(yd->current_list15_grp);
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
560 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
561 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
562 case 7: /* buddy's s/n */
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
563 temp = g_strdup(purple_normalize(account, pair->value));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
565 case 241: /* another protocol user */
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
566 protocol = strtol(pair->value, NULL, 10);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
568 case 59: /* somebody told cookies come here too, but im not sure */
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
569 yahoo_process_cookie(yd, pair->value);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
570 break;
19358
b3901a15147a Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19348
diff changeset
571 case 317: /* Stealth Setting */
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
572 stealth = strtol(pair->value, NULL, 10);
19358
b3901a15147a Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19348
diff changeset
573 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
574 /* case 242: */ /* this seems related to 241 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 /* break; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580 g_hash_table_destroy(ht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 g_free(norm_bud);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
582 g_free(temp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
585 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 gboolean export = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 gboolean got_serv_list = FALSE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
590 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
591 PurpleGroup *g;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 YahooFriend *f = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
593 PurpleAccount *account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 GHashTable *ht;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 char **lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598 char **split;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 char **buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 char **tmp, **bud, *norm_bud;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 char *grp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 if (pkt->id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 yd->session_id = pkt->id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611 case 87:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 if (!yd->tmp_serv_blist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 yd->tmp_serv_blist = g_string_new(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 g_string_append(yd->tmp_serv_blist, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 case 88:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
618 if (!yd->tmp_serv_ilist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 yd->tmp_serv_ilist = g_string_new(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 g_string_append(yd->tmp_serv_ilist, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 case 59: /* cookies, yum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 yahoo_process_cookie(yd, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 if (!yd->tmp_serv_plist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 yd->tmp_serv_plist = g_string_new(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 g_string_append(yd->tmp_serv_plist, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
631 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 if (pkt->status != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 if (yd->tmp_serv_blist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
642 for (tmp = lines; *tmp; tmp++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 split = g_strsplit(*tmp, ":", 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
644 if (!split)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 if (!split[0] || !split[1]) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 grp = yahoo_string_decode(gc, split[0], FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 buddies = g_strsplit(split[1], ",", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 for (bud = buddies; bud && *bud; bud++) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
653 norm_bud = g_strdup(purple_normalize(account, *bud));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 f = yahoo_friend_find_or_new(gc, norm_bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
656 if (!(b = purple_find_buddy(account, norm_bud))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
657 if (!(g = purple_find_group(grp))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
658 g = purple_group_new(grp);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
659 purple_blist_add_group(g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 }
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
661 b = purple_buddy_new(account, norm_bud, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
662 purple_blist_add_buddy(b, NULL, g, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 export = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
665
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 yahoo_do_group_check(account, ht, norm_bud, grp);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
667 /* set p2p status not connected and no p2p packet sent */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
668 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
669 f->p2p_packet_sent = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
670
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
671 g_free(norm_bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
672 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 g_free(grp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 g_strfreev(lines);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 g_string_free(yd->tmp_serv_blist, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 yd->tmp_serv_blist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 g_hash_table_destroy(ht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
684
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 if (yd->tmp_serv_ilist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 /* The server is already ignoring the user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
689 got_serv_list = TRUE;
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
690 purple_privacy_deny_add(account, *bud, 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
692 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 g_string_free(yd->tmp_serv_ilist, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 yd->tmp_serv_ilist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
696 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 if (got_serv_list &&
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
699 ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
700 (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
701 (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS)))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
702 {
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
703 account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
704 purple_debug_info("yahoo", "%s privacy defaulting to PURPLE_PRIVACY_DENY_USERS.\n",
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
705 account->username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
706 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
707
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 if (yd->tmp_serv_plist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 f = yahoo_friend_find(gc, *bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
712 if (f) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
713 purple_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n",
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
714 account->username, *bud);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 g_string_free(yd->tmp_serv_plist, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 yd->tmp_serv_plist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 }
18763
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
723 /* Now that we've got the list, request aliases */
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
724 yahoo_fetch_aliases(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
726
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
727 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
728 static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
729 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
730 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
731 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
732 char *from = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 char *stat = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 char *game = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 GSList *l = pkt->hash;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
737 gint val_11 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
738 struct yahoo_data *yd = gc->proto_data;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
739 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
740 char *msn_from = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
742 account = purple_connection_get_account(gc);
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
743
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
744 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
745 struct yahoo_pair *pair = l->data;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
746 if (pair->key == 4 || pair->key == 1)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 if (pair->key == 49)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 stat = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 game = pair->value;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
754 if (pair->key == 11)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
755 val_11 = strtol(pair->value, NULL, 10);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
756 if (pair->key == 241)
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
757 if(strtol(pair->value, NULL, 10) == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
758 msn = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
759 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
760 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 if (!from || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
765 /* disconnect the peer if connected through p2p and sends wrong value for session id */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
766 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
767 purple_debug_warning("yahoo","p2p: %s sent us notify with wrong session id. Disconnecting p2p connection to peer\n", from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
768 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
769 g_hash_table_remove(yd->peers, from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
770 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
771 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
772
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
773 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
774 msn_from = g_strconcat("msn/", from, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
775
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
776 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
777 && (purple_privacy_check(account, from)))
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
778 {
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
779 if(msn) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
780 if (*stat == '1')
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
781 serv_got_typing(gc, msn_from, 0, PURPLE_TYPING);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
782 else
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
783 serv_got_typing_stopped(gc, msn_from);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
784 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
785 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
786 if (*stat == '1')
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
787 serv_got_typing(gc, from, 0, PURPLE_TYPING);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
788 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
789 serv_got_typing_stopped(gc, from);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
790 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
792 PurpleBuddy *bud = purple_find_buddy(account, from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794 if (!bud) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
795 purple_debug(PURPLE_DEBUG_WARNING, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 "%s is playing a game, and doesn't want "
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 "you to know.\n", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 f = yahoo_friend_find(gc, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 return; /* if they're not on the list, don't bother */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 yahoo_friend_set_game(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 if (*stat == '1') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807 yahoo_friend_set_game(f, game);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 if (bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 yahoo_update_status(gc, from, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 }
19365
756dad225d90 Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@gmail.com>
parents: 19360
diff changeset
811 } else if (!g_ascii_strncasecmp(msg, "WEBCAMINVITE", strlen("WEBCAMINVITE"))) {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
812 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, from, account);
19365
756dad225d90 Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@gmail.com>
parents: 19360
diff changeset
813 char *buf = g_strdup_printf(_("%s has sent you a webcam invite, which is not yet supported."), from);
756dad225d90 Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@gmail.com>
parents: 19360
diff changeset
814 purple_conversation_write(conv, NULL, buf, PURPLE_MESSAGE_SYSTEM|PURPLE_MESSAGE_NOTIFY, time(NULL));
756dad225d90 Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@gmail.com>
parents: 19360
diff changeset
815 g_free(buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 }
19444
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
817
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
818 g_free(msn_from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
819 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822 struct _yahoo_im {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823 char *from;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 int time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 int utf8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 int buddy_icon;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
830 static void yahoo_process_sms_message(PurpleConnection *gc, struct yahoo_packet *pkt)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
831 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
832 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
833 GSList *l = pkt->hash;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
834 struct _yahoo_im *sms = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
835 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
836 char *server_msg = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
837 char *m;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
838
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
839 yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
840 account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
841
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
842 while (l != NULL) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
843 struct yahoo_pair *pair = l->data;
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
844 if (pair->key == 4) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
845 sms = g_new0(struct _yahoo_im, 1);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
846 sms->from = g_strdup_printf("+%s", pair->value);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
847 sms->time = time(NULL);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
848 sms->utf8 = TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
849 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
850 if (pair->key == 14) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
851 if (sms)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
852 sms->msg = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
853 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
854 if (pair->key == 68)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
855 if(sms)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
856 g_hash_table_insert(yd->sms_carrier, g_strdup(sms->from), g_strdup(pair->value));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
857 if (pair->key == 16)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
858 server_msg = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
859 l = l->next;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
860 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
861
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
862 if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) {
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
863 if (server_msg) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
864 PurpleConversation *c;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
865 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms->from, account);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
866 if (c == NULL)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
867 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sms->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
868 purple_conversation_write(c, NULL, server_msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
869 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
870 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
871 purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
872
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
873 g_free(sms->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
874 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
875 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
876 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
877
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
878 if (!sms->from || !sms->msg) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
879 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
880 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
881 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
882
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
883 m = yahoo_string_decode(gc, sms->msg, sms->utf8);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
884 serv_got_im(gc, sms->from, m, 0, sms->time);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
885
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
886 g_free(m);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
887 g_free(sms->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
888 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
889 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
890
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
891 /* pkt_type is YAHOO_PKT_TYPE_SERVER if pkt arrives from yahoo server, YAHOO_PKT_TYPE_P2P if pkt arrives through p2p */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
892 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
893 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
894 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
895 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
896 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 GSList *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 struct _yahoo_im *im = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 const char *imv = NULL;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
900 gint val_11 = 0;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
901 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
902 char *msn_from = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
904 account = purple_connection_get_account(gc);
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
905
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
906 if (pkt->status <= 1 || pkt->status == 5 || pkt->status == YAHOO_STATUS_OFFLINE) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
907 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 while (l != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 struct yahoo_pair *pair = l->data;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
910 if (pair->key == 4 || pair->key == 1) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 im = g_new0(struct _yahoo_im, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 list = g_slist_append(list, im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 im->from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 im->time = time(NULL);
23285
ea998456c3bd Yahoo seems to always send messages encoded in utf-8 now. Hopefully this
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23113
diff changeset
915 im->utf8 = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 if (pair->key == 97)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 im->utf8 = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 if (pair->key == 15)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 im->time = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 if (pair->key == 206)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 im->buddy_icon = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 if (pair->key == 14) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 im->msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 }
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
930 if (pair->key == 241) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
931 if(strtol(pair->value, NULL, 10) == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
932 msn = TRUE;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
933 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
934 /* peer session id */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
935 if (pair->key == 11) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
936 if (im)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
937 val_11 = strtol(pair->value, NULL, 10);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
938 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939 /* IMV key */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
940 if (pair->key == 63)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 imv = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 } else if (pkt->status == 2) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
947 purple_notify_error(gc, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 _("Your Yahoo! message did not get sent."), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
949 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
951 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
952 msn_from = g_strconcat("msn/", im->from, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
953
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
954 /* disconnect the peer if connected through p2p and sends wrong value for session id */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
955 if( (pkt_type == YAHOO_PKT_TYPE_P2P) && (val_11 != yd->session_id) ) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
956 purple_debug_warning("yahoo","p2p: %s sent us message with wrong session id. Disconnecting p2p connection to peer\n", im->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
957 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
958 g_hash_table_remove(yd->peers, im->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
959 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
960 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
961
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
962 /** TODO: It seems that this check should be per IM, not global */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 /* Check for the Doodle IMV */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 if (im != NULL && imv!= NULL && im->from != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 g_hash_table_replace(yd->imvironments, g_strdup(im->from), g_strdup(imv));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
967
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
968 if (strstr(imv, "doodle;") != NULL)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
970 PurpleWhiteboard *wb;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
972 if (!purple_privacy_check(account, im->from)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
973 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
974 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
975 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
976
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
977 /* I'm not sure the following ever happens -DAA */
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
978
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
979 wb = purple_whiteboard_get_session(account, im->from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
980
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
981 /* If a Doodle session doesn't exist between this user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 if(wb == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 {
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
984 doodle_session *ds;
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
985 wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED);
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
986 ds = wb->proto_data;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
987 ds->imv_key = g_strdup(imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
988
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
989 yahoo_doodle_command_send_request(gc, im->from, imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19718
diff changeset
990 yahoo_doodle_command_send_ready(gc, im->from, imv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 for (l = list; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 char *m, *m2;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
998 PurpleConversation *c;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 im = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 if (!im->from || !im->msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002 g_free(im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1006 if (!purple_privacy_check(account, im->from)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1007 purple_debug_info("yahoo", "Message from %s dropped.\n", im->from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1008 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1010
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 m = yahoo_string_decode(gc, im->msg, im->utf8);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012 /* This may actually not be necessary, but it appears
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 * that at least at one point some clients were sending
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 * "\r\n" as line delimiters, so we want to avoid double
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1015 * lines. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1016 m2 = purple_strreplace(m, "\r\n", "\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1017 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1018 m = m2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1019 purple_util_chrreplace(m, '\r', '\n');
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1021 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->from, account);
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1022 if ((c == NULL) && msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1023 c=purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, msn_from, account);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1024
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1025 if (!strcmp(m, "<ding>")) {
21537
9dbf38f270da Fix #3421 by checking for an existing conversation in which to display a yahoo buzz.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21425
diff changeset
1026 char *username;
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
1027
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1028 if(c == NULL) {
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1029 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1030 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, msn_from);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1031 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1032 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, im->from);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1033 }
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1034 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1035 username = g_markup_escape_text(msn_from, -1);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1036 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1037 username = g_markup_escape_text(im->from, -1);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1038
23751
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23404
diff changeset
1039 purple_prpl_got_attention(gc, username, YAHOO_BUZZ);
15946
e058328dc954 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 <evan.s@dreskin.net>
parents: 15823
diff changeset
1040 g_free(username);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1041 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1042 g_free(im);
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1043 g_free(msn_from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 m2 = yahoo_codes_to_html(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048 g_free(m);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1049
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1050 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1051 serv_got_im(gc, msn_from, m2, 0, im->time);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1052 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1053 serv_got_im(gc, im->from, m2, 0, im->time);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1054
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055 g_free(m2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1057 /* laters : implement buddy icon for msn friends */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1058 if(!msn) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1059 if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1060 if (yahoo_friend_get_buddy_icon_need_request(f)) {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1061 yahoo_send_picture_request(gc, im->from);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1062 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1063 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1065 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1067 g_free(im);
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1068 g_free(msn_from);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1070 g_slist_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1073 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1075 GSList *l = pkt->hash;
16998
8e7a4295ff85 Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <stu@nosnilmot.com>
parents: 16996
diff changeset
1076 char *prim, *me = NULL, *msg = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1078 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 if (pair->key == 5)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082 me = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 if (!msg || !g_utf8_validate(msg, -1, NULL))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 prim = g_strdup_printf(_("Yahoo! system message for %s:"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1093 me?me:purple_connection_get_display_name(gc));
16998
8e7a4295ff85 Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <stu@nosnilmot.com>
parents: 16996
diff changeset
1094 purple_notify_info(NULL, NULL, prim, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1095 g_free(prim);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1096 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 struct yahoo_add_request {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1099 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1101 char *who;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1102 int protocol;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1104
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1106 yahoo_buddy_add_authorize_cb(gpointer data)
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1107 {
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19189
diff changeset
1108 struct yahoo_add_request *add_req = data;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1109 struct yahoo_packet *pkt;
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1110 struct yahoo_data *yd = add_req->gc->proto_data;
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1111
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1112 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15, YAHOO_STATUS_AVAILABLE, 0);
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1113 yahoo_packet_hash(pkt, "ssiii",
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1114 1, add_req->id,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1115 5, add_req->who,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1116 241, add_req->protocol,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1117 13, 1,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1118 334, 0);
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1119 yahoo_packet_send_and_free(pkt, yd);
19358
b3901a15147a Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19348
diff changeset
1120
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1121 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1122 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1127 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg)
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1128 {
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1129 struct yahoo_data *yd = add_req->gc->proto_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1130 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1131 char *encoded_msg = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1132 PurpleAccount *account = purple_connection_get_account(add_req->gc);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1133
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1134 if (msg && *msg)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1137 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138 YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1140 yahoo_packet_hash(pkt, "ssiiis",
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1141 1, purple_normalize(account, purple_account_get_username(account)),
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1142 5, add_req->who,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1143 13, 2,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1144 334, 0,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1145 97, 1,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 14, encoded_msg ? encoded_msg : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 g_free(encoded_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158 yahoo_buddy_add_deny_noreason_cb(struct yahoo_add_request *add_req, const char*msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 yahoo_buddy_add_deny_cb(add_req, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1161 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1163 static void
19195
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19189
diff changeset
1164 yahoo_buddy_add_deny_reason_cb(gpointer data) {
1ca6c4b234ab Warning fixes in the aftermath of resiak's authorize_cb and deny_cb type fixing.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19189
diff changeset
1165 struct yahoo_add_request *add_req = data;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1166 purple_request_input(add_req->gc, NULL, _("Authorization denied message:"),
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
1167 NULL, _("No reason given."), TRUE, FALSE, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1168 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb),
16442
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
1169 _("Cancel"), G_CALLBACK(yahoo_buddy_add_deny_noreason_cb),
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
1170 purple_connection_get_account(add_req->gc), add_req->who, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1171 add_req);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1172 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1173
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1174 static void yahoo_buddy_denied_our_add(PurpleConnection *gc, const char *who, const char *reason)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1175 {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1176 char *notify_msg;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1177 struct yahoo_data *yd = gc->proto_data;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1178
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1179 if (who == NULL)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1180 return;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1181
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1182 if (reason != NULL) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1183 char *msg2 = yahoo_string_decode(gc, reason, FALSE);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1184 notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1185 g_free(msg2);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1186 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1187 notify_msg = g_strdup_printf(_("%s has (retroactively) denied your request to add them to your list."), who);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1188
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1189 purple_notify_info(gc, NULL, _("Add buddy rejected"), notify_msg);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1190 g_free(notify_msg);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1191
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1192 g_hash_table_remove(yd->friends, who);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1193 purple_prpl_got_user_status(purple_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1194 /* TODO: Shouldn't we remove the buddy from our local list? */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1195 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1196
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1197 static void yahoo_buddy_auth_req_15(PurpleConnection *gc, struct yahoo_packet *pkt) {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1198 PurpleAccount *account;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1199 GSList *l = pkt->hash;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1200 const char *msg = NULL;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1201 int protocol = 0;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1202
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1203 account = purple_connection_get_account(gc);
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1204
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1205 /* Buddy authorized/declined our addition */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1206 if (pkt->status == 1) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1207 char *temp = NULL;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1208 char *who = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1209 int response = 0;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1210
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1211 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1212 struct yahoo_pair *pair = l->data;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1213
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1214 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1215 case 4:
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1216 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1217 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1218 case 13:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1219 response = strtol(pair->value, NULL, 10);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1220 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1221 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1222 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1223 break;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1224 case 241:
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1225 protocol = strtol(pair->value, NULL, 10);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1226 break;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1227 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1228 l = l->next;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1229 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1230
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1231 if(protocol == 0)
26252
94ffdbdd16fb clear a double free bug
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26248
diff changeset
1232 who = g_strdup(temp);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1233 else if(protocol == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1234 who = g_strconcat("msn/", temp, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1235
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1236 if (response == 1) /* Authorized */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1237 purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)");
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1238 else if (response == 2) { /* Declined */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1239 purple_debug_info("yahoo", "Received authorization decline from buddy '%s'.\n", who ? who : "(Unknown Buddy)");
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1240 yahoo_buddy_denied_our_add(gc, who, msg);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1241 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1242 purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)");
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1243 g_free(who);
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1244 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1245 /* Buddy requested authorization to add us. */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1246 else if (pkt->status == 3) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1247 struct yahoo_add_request *add_req;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1248 const char *firstname = NULL, *lastname = NULL;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1249 char *temp = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1250
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1251 add_req = g_new0(struct yahoo_add_request, 1);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1252 add_req->gc = gc;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1253
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1254 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1255 struct yahoo_pair *pair = l->data;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1256
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1257 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1258 case 4:
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1259 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1260 add_req->who = g_strdup(pair->value);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1261 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1262 case 5:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1263 add_req->id = g_strdup(pair->value);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1264 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1265 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1266 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1267 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1268 case 216:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1269 firstname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1270 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1271 case 241:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1272 add_req->protocol = strtol(pair->value, NULL, 10);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1273 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1274 case 254:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1275 lastname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1276 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1277
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1278 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1279 l = l->next;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1280 }
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1281 if(add_req->protocol == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
1282 add_req->who = g_strconcat("msn/", temp, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1283 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
1284 add_req->who = g_strdup(temp);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1285
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1286 if (add_req->id && add_req->who) {
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1287 char *alias = NULL, *dec_msg = NULL;
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1288
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1289 if (!purple_privacy_check(account, add_req->who))
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1290 {
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1291 purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n",
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1292 add_req->who);
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1293 yahoo_buddy_add_deny_cb(add_req, NULL);
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1294 return;
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1295 }
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1296
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1297 if (msg)
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1298 dec_msg = yahoo_string_decode(gc, msg, FALSE);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1299
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1300 if (firstname && lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1301 alias = g_strdup_printf("%s %s", firstname, lastname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1302 else if (firstname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1303 alias = g_strdup(firstname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1304 else if (lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1305 alias = g_strdup(lastname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1306
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1307 /* DONE! this is almost exactly the same as what MSN does,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1308 * this should probably be moved to the core.
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1309 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1310 purple_account_request_authorization(account, add_req->who, add_req->id,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1311 alias, dec_msg,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1312 purple_find_buddy(account, add_req->who) != NULL,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1313 yahoo_buddy_add_authorize_cb,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1314 yahoo_buddy_add_deny_reason_cb,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1315 add_req);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1316 g_free(alias);
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1317 g_free(dec_msg);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1318 } else {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1319 g_free(add_req->id);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1320 g_free(add_req->who);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1321 g_free(add_req);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1322 }
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1323 } else {
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1324 purple_debug_error("yahoo", "Received authorization of unknown status (%d).\n", pkt->status);
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1325 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1326 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1327
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1328 /* I don't think this happens anymore in Version 15 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1329 static void yahoo_buddy_added_us(PurpleConnection *gc, struct yahoo_packet *pkt) {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1330 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331 struct yahoo_add_request *add_req;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1335 account = purple_connection_get_account(gc);
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1336
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 add_req = g_new0(struct yahoo_add_request, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 add_req->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1340 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 add_req->id = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 add_req->who = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 case 15: /* time, for when they add us and we're offline */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1353 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1359 if (add_req->id && add_req->who) {
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1360 char *dec_msg = NULL;
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1361
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1362 if (!purple_privacy_check(account, add_req->who)) {
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1363 purple_debug_misc("yahoo", "Auth. request from %s dropped and automatically denied due to privacy settings!\n",
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1364 add_req->who);
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1365 yahoo_buddy_add_deny_cb(add_req, NULL);
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1366 return;
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1367 }
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1368
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1369 if (msg)
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1370 dec_msg = yahoo_string_decode(gc, msg, FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 /* DONE! this is almost exactly the same as what MSN does,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 * this should probably be moved to the core.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1375 purple_account_request_authorization(account, add_req->who, add_req->id,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1376 NULL, dec_msg,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1377 purple_find_buddy(account,add_req->who) != NULL,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1378 yahoo_buddy_add_authorize_cb,
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1379 yahoo_buddy_add_deny_reason_cb, add_req);
19543
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1380 g_free(dec_msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1388 /* I have no idea if this every gets called in version 15 */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1389 static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1409 yahoo_buddy_denied_our_add(gc, who, msg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1411
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1412 static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 switch (pkt->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 yahoo_buddy_added_us(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 case 7:
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1422 yahoo_buddy_denied_our_add_old(gc, pkt);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429 #define OUT_CHARSET "utf-8"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 static char *yahoo_decode(const char *text)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 char *converted = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434 char *n, *new;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 const char *end, *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 int i, k;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 n = new = g_malloc(strlen (text) + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 end = text + strlen(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 for (p = text; p < end; p++, n++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 if (*p == '\\') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443 if (p[1] >= '0' && p[1] <= '7') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 p += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 for (i = 0, k = 0; k < 3; k += 1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 char c = p[k];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 if (c < '0' || c > '7') break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 i *= 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 i += c - '0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 *n = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 p += k - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 } else { /* bug 959248 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 /* If we see a \ not followed by an octal number,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 * it means that it is actually a \\ with one \
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 * already eaten by some unknown function.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 * This is arguably broken.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1458 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 * I think wing is wrong here, there is no function
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 * called that I see that could have done it. I guess
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461 * it is just really sending single \'s. That's yahoo
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 * for you.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1464 *n = *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1467 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 *n = *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471 *n = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 if (strstr(text, "\033$B"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474 converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 if (!converted)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 g_free(new);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479 return converted;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1482 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1484 PurpleAccount *account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 struct yahoo_data *yd = gc->proto_data;
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
1486 const char *who = NULL;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
1487 const char *email = NULL;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
1488 const char *subj = NULL;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
1489 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 int count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1493 if (!purple_account_get_check_mail(account))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 if (pair->key == 9)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 count = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 else if (pair->key == 43)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 else if (pair->key == 42)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 email = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 else if (pair->key == 18)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 subj = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 if (who && subj && email && *email) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510 char *dec_who = yahoo_decode(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 char *dec_subj = yahoo_decode(subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 char *from = g_strdup_printf("%s (%s)", dec_who, email);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1514 purple_notify_email(gc, dec_subj, from, purple_account_get_username(account),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 yahoo_mail_url, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1517 g_free(dec_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518 g_free(dec_subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 g_free(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 } else if (count > 0) {
26934
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26807
diff changeset
1521 const char *tos[2] = { purple_account_get_username(account) };
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26807
diff changeset
1522 const char *urls[2] = { yahoo_mail_url };
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26807
diff changeset
1523
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26807
diff changeset
1524 purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1526 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1528
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1529 /* We use this structure once while we authenticate */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1530 struct yahoo_auth_data
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1531 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1532 PurpleConnection *gc;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1533 char *seed;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1534 };
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1535
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536 /* This is the y64 alphabet... it's like base64, but has a . and a _ */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1537 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1539 /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1540 * in util.c, but it is different from the one yahoo uses */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 static void to_y64(char *out, const unsigned char *in, gsize inlen)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544 for (; inlen >= 3; inlen -= 3)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 *out++ = base64digits[in[2] & 0x3f];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 in += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 if (inlen > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554 unsigned char fragment;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1556 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 fragment = (in[0] << 4) & 0x30;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 if (inlen > 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 fragment |= in[1] >> 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560 *out++ = base64digits[fragment];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1561 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 *out++ = '-';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1564 *out = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1566
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1567 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568 {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1569 struct yahoo_data *yd = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1570 PurpleAccount *account = purple_connection_get_account(gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1571 const char *name = purple_normalize(account, purple_account_get_username(account));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1572 PurpleCipher *md5_cipher;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1573 PurpleCipherContext *md5_ctx;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1574 guchar md5_digest[16];
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1575 gchar base64_string[25];
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1576 struct yahoo_packet *pkt;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1577
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1578 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1580 md5_cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1581 md5_ctx = purple_cipher_context_new(md5_cipher, NULL);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1582 purple_cipher_context_append(md5_ctx, (guchar *)crypt, strlen(crypt));
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1583 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1584
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1585 to_y64(base64_string, md5_digest, 16);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1586
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1587 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_WEBLOGIN, yd->session_id);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1588 if(yd->jp) {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1589 yahoo_packet_hash(pkt, "ssssssss",
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1590 1, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1591 0, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1592 277, yd->cookie_y,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1593 278, yd->cookie_t,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1594 307, base64_string,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1595 2, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1596 2, "1",
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1597 135, YAHOOJP_CLIENT_VERSION);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1598 } else {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1599 yahoo_packet_hash(pkt, "sssssssss",
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1600 1, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1601 0, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1602 277, yd->cookie_y,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1603 278, yd->cookie_t,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1604 307, base64_string,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1605 244, YAHOO_CLIENT_VERSION_ID,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1606 2, name,
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1607 2, "1",
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1608 135, YAHOO_CLIENT_VERSION);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1609 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1610 if (yd->picture_checksum)
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1611 yahoo_packet_hash_int(pkt, 192, yd->picture_checksum);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1612 yahoo_packet_send_and_free(pkt, yd);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1613
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1614 purple_cipher_context_destroy(md5_ctx);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1615 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1616
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1617 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message)
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1618 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1619 struct yahoo_auth_data *auth_data = user_data;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1620 PurpleConnection *gc = auth_data->gc;
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1621 struct yahoo_data *yd;
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1622 gboolean try_login_on_error = FALSE;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1623
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1624 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage2\n");
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1625
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1626 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1627 g_free(auth_data->seed);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1628 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1629 g_return_if_reached();
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1630 }
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1631
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1632 yd = (struct yahoo_data *)gc->proto_data;
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1633
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1634 if (error_message != NULL) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1635 purple_debug_error("yahoo", "Login Failed, unable to retrieve stage 2 url: %s\n", error_message);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1636 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1637 g_free(auth_data->seed);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1638 g_free(auth_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1639 return;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1640 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1641 else if (len > 0 && ret_data && *ret_data) {
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1642 gchar **split_data = g_strsplit(ret_data, "\r\n", -1);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1643 int totalelements = g_strv_length(split_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1644 int response_no = -1;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1645 char *crumb = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1646 char *crypt = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1647
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1648 if (totalelements >= 5) {
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1649 response_no = strtol(split_data[1], NULL, 10);
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1650 crumb = g_strdup(split_data[2] + strlen("crumb="));
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1651 yd->cookie_y = g_strdup(split_data[3] + strlen("Y="));
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1652 yd->cookie_t = g_strdup(split_data[4] + strlen("T="));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1655 g_strfreev(split_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1656
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1657 if(response_no != 0) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1658 /* Some error in the login process */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1659 PurpleConnectionError error;
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1660 char *error_reason = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1661
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1662 switch(response_no) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1663 case -1:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1664 /* Some error in the received stream */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1665 error_reason = g_strdup(_("Received invalid data"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1666 error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1667 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1668 case 100:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1669 /* Unknown error */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1670 error_reason = g_strdup(_("Unknown error"));
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1671 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1672 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1673 default:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1674 /* if we have everything we need, why not try to login irrespective of response */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1675 if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1676 try_login_on_error = TRUE;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1677 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1678 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1679 error_reason = g_strdup(_("Unknown error"));
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1680 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1681 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682 }
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1683 if(error_reason) {
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1684 purple_debug_error("yahoo", "Authentication error: %s\n",
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1685 error_reason);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1686 purple_connection_error_reason(gc, error, error_reason);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1687 g_free(error_reason);
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1688 g_free(auth_data->seed);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1689 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1690 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1694 crypt = g_strconcat(crumb, auth_data->seed, NULL);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1695 yahoo_auth16_stage3(gc, crypt);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1696 g_free(crypt);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1697 g_free(crumb);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1698 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1699 g_free(auth_data->seed);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1700 g_free(auth_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1701 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1702
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1703 static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message)
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1704 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1705 struct yahoo_auth_data *auth_data = user_data;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1706 PurpleConnection *gc = auth_data->gc;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1707
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1708 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage1_cb\n");
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1709
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1710 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1711 g_free(auth_data->seed);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1712 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1713 g_return_if_reached();
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1714 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1715
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1716 if (error_message != NULL) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1717 purple_debug_error("yahoo", "Login Failed, unable to retrieve login url: %s\n", error_message);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1718 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, error_message);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1719 g_free(auth_data->seed);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1720 g_free(auth_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1721 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1723 else if (len > 0 && ret_data && *ret_data) {
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1724 gchar **split_data = g_strsplit(ret_data, "\r\n", -1);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1725 int totalelements = g_strv_length(split_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1726 int response_no = -1;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1727 char *token = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1728
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1729 if(totalelements >= 5) {
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1730 response_no = strtol(split_data[1], NULL, 10);
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1731 token = g_strdup(split_data[2] + strlen("ymsgr="));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1732 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1733
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1734 g_strfreev(split_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1735
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1736 if(response_no != 0) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1737 /* Some error in the login process */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1738 PurpleConnectionError error;
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1739 char *error_reason;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1740
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1741 switch(response_no) {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1742 case -1:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1743 /* Some error in the received stream */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1744 error_reason = g_strdup(_("Received invalid data"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1745 error = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1746 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1747 case 1212:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1748 /* Password incorrect */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1749 error_reason = g_strdup(_("Incorrect Password"));
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1750 error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1751 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1752 case 1213:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1753 /* security lock from too many failed login attempts */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1754 error_reason = g_strdup(_("Account locked: Too many failed login attempts"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1755 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1756 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1757 case 1235:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1758 /* the username does not exist */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1759 error_reason = g_strdup(_("Username does not exist"));
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1760 error = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1761 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1762 case 1236:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1763 /* indicates a lock of some description */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1764 error_reason = g_strdup(_("Account locked: See the debug log"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1765 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1766 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1767 case 100:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1768 /* username or password missing */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1769 error_reason = g_strdup(_("Username or password missing"));
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1770 error = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1771 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1772 default:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1773 /* Unknown error! */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1774 error_reason = g_strdup(_("Unknown error"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1775 error = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1776 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1777 }
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1778 purple_debug_error("yahoo", "Authentication error: %s\n",
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1779 error_reason);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1780 purple_connection_error_reason(gc, error, error_reason);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1781 g_free(error_reason);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1782 g_free(auth_data->seed);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1783 g_free(auth_data);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1784 }
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1785 else {
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1786 /* OK to login, correct information provided */
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1787 PurpleUtilFetchUrlData *url_data = NULL;
26906
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1788 char *url = NULL;
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1789 gboolean yahoojp = purple_account_get_bool(purple_connection_get_account(gc),
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1790 "yahoojp", 0);
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1791
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1792 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token);
27071
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1793 url_data = purple_util_fetch_url_request_len_with_account(
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1794 purple_connection_get_account(gc), url, TRUE,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1795 YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1796 yahoo_auth16_stage2, auth_data);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1797 g_free(url);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1798 g_free(token);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1799 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1801 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1802
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1803 static void yahoo_auth16_stage1(PurpleConnection *gc, const char *seed)
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1804 {
26906
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1805 PurpleUtilFetchUrlData *url_data = NULL;
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1806 struct yahoo_auth_data *auth_data = NULL;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1807 char *url = NULL;
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1808 char *encoded_username;
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1809 char *encoded_password;
26906
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1810 gboolean yahoojp;
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1811
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1812 purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n");
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1813
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1814 if(!purple_ssl_is_supported()) {
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
1815 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable"));
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1816 return;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 }
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1818
26906
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1819 yahoojp = purple_account_get_bool(purple_connection_get_account(gc),
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26904
diff changeset
1820 "yahoojp", 0);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1821 auth_data = g_new0(struct yahoo_auth_data, 1);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1822 auth_data->gc = gc;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1823 auth_data->seed = g_strdup(seed);
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1824
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1825 encoded_username = g_strdup(purple_url_encode(purple_account_get_username(purple_connection_get_account(gc))));
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1826 encoded_password = g_strdup(purple_url_encode(purple_connection_get_password(gc)));
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1827 url = g_strdup_printf(yahoojp ? YAHOOJP_TOKEN_URL : YAHOO_TOKEN_URL,
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1828 encoded_username, encoded_password, purple_url_encode(seed));
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1829 g_free(encoded_password);
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
1830 g_free(encoded_username);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1831
27071
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1832 url_data = purple_util_fetch_url_request_len_with_account(
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1833 purple_connection_get_account(gc), url, TRUE,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1834 YAHOO_CLIENT_USERAGENT, TRUE, NULL, FALSE, -1,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1835 yahoo_auth16_stage1_cb, auth_data);
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
1836
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1837 g_free(url);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1838 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1839
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1840 static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 char *seed = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 char *sn = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 int m = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 if (pair->key == 94)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 seed = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 if (pair->key == 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853 sn = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 m = atoi(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1859 if (seed) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1860 switch (m) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1861 case 0:
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1862 /* used to be for really old auth routine, dont support now */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863 case 1:
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1864 case 2: /* Yahoo ver 16 authentication */
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1865 yahoo_auth16_stage1(gc, seed);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1866 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1867 default:
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1868 {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1869 GHashTable *ui_info = purple_core_get_ui_info();
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1870
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1871 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized "
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1872 "authentication method. You will probably not be able "
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1873 "to successfully sign on to Yahoo. Check %s for updates."),
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1874 ((ui_info && g_hash_table_lookup(ui_info, "website")) ? (char *)g_hash_table_lookup(ui_info, "website") : PURPLE_WEBSITE));
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1875 purple_notify_error(gc, "", _("Failed Yahoo! Authentication"),
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1876 buf);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1877 g_free(buf);
26904
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26807
diff changeset
1878 yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */
23404
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1879 break;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23401
diff changeset
1880 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1884
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1885 static void ignore_buddy(PurpleBuddy *buddy) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1886 PurpleGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1887 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1888 gchar *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 if (!buddy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1893 group = purple_buddy_get_group(buddy);
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1894 name = g_strdup(purple_buddy_get_name(buddy));
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1895 account = purple_buddy_get_account(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1897 purple_debug(PURPLE_DEBUG_INFO, "blist",
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1898 "Removing '%s' from buddy list.\n", name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1899 purple_account_remove_buddy(account, buddy, group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1900 purple_blist_remove_buddy(buddy);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1902 serv_add_deny(purple_account_get_connection(account), name);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1904 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1905 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1907 static void keep_buddy(PurpleBuddy *b)
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1908 {
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1909 purple_privacy_deny_remove(purple_buddy_get_account(b),
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
1910 purple_buddy_get_name(b), 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1913 static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1914 PurpleBuddy *b;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 gchar *who = NULL;
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1917 gchar *me = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918 gchar buf[BUF_LONG];
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1919 gboolean ignore = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1920 gint status = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922 for (l = pkt->hash; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 case 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1926 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1927 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928 case 1:
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1929 me = pair->value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 case 13:
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1932 /* 1 == ignore, 2 == unignore */
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1933 ignore = (strtol(pair->value, NULL, 10) == 1);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1935 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1936 status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1937 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1938 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1939 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1943 /*
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1944 * status
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1945 * 0 - ok
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1946 * 2 - already in ignore list, could not add
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1947 * 3 - not in ignore list, could not delete
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1948 * 12 - is a buddy, could not add (and possibly also a not-in-ignore list condition?)
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1949 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1950 switch (status) {
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1951 case 12:
22414
35c4a9b4a699 Fix a missing a comma
Mark Doliner <mark@kingant.net>
parents: 22413
diff changeset
1952 purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s",
22413
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1953 who, (ignore ? "ignoring" : "unignoring"));
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1954
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1955 if (ignore) {
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1956 b = purple_find_buddy(gc->account, who);
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1957 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1958 "user is on your buddy list. Clicking \"Yes\" "
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1959 "will remove and ignore the buddy."), who);
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1960 purple_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0,
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1961 gc->account, who, NULL,
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1962 b,
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1963 G_CALLBACK(ignore_buddy),
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1964 G_CALLBACK(keep_buddy));
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1965 break;
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1966 }
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1967 case 2:
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1968 purple_debug_info("yahoo", "Server reported that %s is already in the ignore list.",
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1969 who);
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1970 break;
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1971 case 3:
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1972 purple_debug_info("yahoo", "Server reported that %s is not in the ignore list; could not delete",
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1973 who);
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1974 case 0:
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1975 default:
288af4cb9884 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 <evan.s@dreskin.net>
parents: 22406
diff changeset
1976 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
1980 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981 {
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
1982 #ifdef TRY_WEBMESSENGER_LOGIN
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983 struct yahoo_data *yd = gc->proto_data;
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
1984 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 char *url = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989 char *fullmsg;
18650
648545b2c1f1 make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@hxbc.us>
parents: 18642
diff changeset
1990 PurpleAccount *account = gc->account;
24536
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
1991 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996 if (pair->key == 66)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997 err = strtol(pair->value, NULL, 10);
21537
9dbf38f270da Fix #3421 by checking for an existing conversation in which to display a yahoo buzz.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 21425
diff changeset
1998 else if (pair->key == 20)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999 url = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 switch (err) {
24536
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2005 case 0:
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2006 msg = g_strdup(_("Unknown error."));
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2007 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2008 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 case 3:
22770
cc8903c59d6b Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents: 22666
diff changeset
2010 msg = g_strdup(_("Invalid username."));
21425
cd4173014f50 Use PURPLE_CONNECTION_ERROR_INVALID_USERNAME in oscar and yahoo, which were
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2011 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 case 13:
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
2014 #ifdef TRY_WEBMESSENGER_LOGIN
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015 if (!yd->wm) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2016 PurpleUtilFetchUrlData *url_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 yd->wm = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 if (gc->inpa)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2021 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2022 url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2023 "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 if (url_data != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 }
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
2028 #endif
18650
648545b2c1f1 make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@hxbc.us>
parents: 18642
diff changeset
2029 if (!purple_account_get_remember_password(account))
648545b2c1f1 make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@hxbc.us>
parents: 18642
diff changeset
2030 purple_account_set_password(account, NULL);
648545b2c1f1 make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@hxbc.us>
parents: 18642
diff changeset
2031
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 msg = g_strdup(_("Incorrect password."));
24536
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2033 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036 msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website."));
24536
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24343
diff changeset
2037 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2043 if (url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044 fullmsg = g_strdup_printf("%s\n%s", msg, url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 fullmsg = g_strdup(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047
21425
cd4173014f50 Use PURPLE_CONNECTION_ERROR_INVALID_USERNAME in oscar and yahoo, which were
Will Thompson <will.thompson@collabora.co.uk>
parents: 21418
diff changeset
2048 purple_connection_error_reason(gc, reason, fullmsg);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050 g_free(fullmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2053 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056 char *who = NULL;
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2057 char *temp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 char *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 char *decoded_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 GSList *l = pkt->hash;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2063 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2064 int protocol = 0;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
2065 gboolean msn = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2071 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072 err = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 case 7:
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2075 temp = pair->value;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077 case 65:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 group = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 break;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2080 case 241:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2081 protocol = strtol(pair->value, NULL, 10);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2082 if(protocol == 2)
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
2083 msn = TRUE;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2084 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2090 if (!temp)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 group = "";
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2094
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
2095 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
2096 who = g_strconcat("msn/", temp, NULL);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2097 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2098 who = g_strdup(temp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 f = yahoo_friend_find_or_new(gc, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 yahoo_update_status(gc, who, f);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2103 if(protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2104 f->protocol = protocol;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2105
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2106 if( !g_hash_table_lookup(yd->peers, who) ) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2107 /* we are not connected as client, so set friend to not connected */
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
2108 if(msn)
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2109 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2110 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2111 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2112 f->p2p_packet_sent = 0;
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2113 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2114 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2115 else /* we are already connected. set friend to YAHOO_P2PSTATUS_WE_ARE_CLIENT */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2116 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 decoded_group = yahoo_string_decode(gc, group, FALSE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2122 who, decoded_group, purple_connection_get_display_name(gc));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2123 if (!purple_conv_present_error(who, purple_connection_get_account(gc), buf))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2124 purple_notify_error(gc, NULL, _("Could not add buddy to server list"), buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 g_free(decoded_group);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
2127 g_free(who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2129
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2130 /* write pkt to the source */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2131 static void yahoo_p2p_write_pkt(gint source, struct yahoo_packet *pkt)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2132 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2133 size_t pkt_len;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2134 guchar *raw_packet;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2135
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2136 /*build the raw packet and send it to the host*/
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2137 pkt_len = yahoo_packet_build(pkt, 0, 0, 0, &raw_packet);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2138 if(write(source, raw_packet, pkt_len) != pkt_len)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2139 purple_debug_warning("yahoo","p2p: couldn't write to the source\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2140 g_free(raw_packet);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2141 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2142
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2143 static void yahoo_p2p_keepalive_cb(gpointer key, gpointer value, gpointer user_data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2144 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2145 struct yahoo_p2p_data *p2p_data = value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2146 PurpleConnection *gc = user_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2147 struct yahoo_packet *pkt_to_send;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2148 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2149 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2150
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2151 account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2152
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2153 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2154 yahoo_packet_hash(pkt_to_send, "ssisi",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2155 4, purple_normalize(account, purple_account_get_username(account)),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2156 5, p2p_data->host_username,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2157 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2158 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2159 13, 7);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2160 yahoo_p2p_write_pkt(p2p_data->source, pkt_to_send);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2161
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2162 yahoo_packet_free(pkt_to_send);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2163 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2164
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2165 static gboolean yahoo_p2p_keepalive(gpointer data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2166 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2167 PurpleConnection *gc = data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2168 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2169
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2170 g_hash_table_foreach(yd->peers, yahoo_p2p_keepalive_cb, gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2171
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2172 return TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2173 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2174
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2175 /* destroy p2p_data associated with a peer and close p2p connection.
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2176 * g_hash_table_remove() calls this function to destroy p2p_data associated with the peer,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2177 * call g_hash_table_remove() instead of this fucntion if peer has an entry in the table */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2178 static void yahoo_p2p_disconnect_destroy_data(gpointer data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2179 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2180 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2181 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2182
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2183 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2184 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2185
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2186 /* If friend, set him not connected */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2187 f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2188 if (f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2189 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_NOT_CONNECTED);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2190
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2191 if(p2p_data->source >= 0)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2192 close(p2p_data->source);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2193 purple_input_remove(p2p_data->input_event);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2194 g_free(p2p_data->host_ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2195 g_free(p2p_data->host_username);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2196 g_free(p2p_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2197 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2198
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2199 /* exchange of initial p2pfilexfer packets, service type YAHOO_SERVICE_P2PFILEXFER */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2200 static void yahoo_p2p_process_p2pfilexfer(gpointer data, gint source, struct yahoo_packet *pkt)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2201 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2202 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2203 char *who = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2204 GSList *l = pkt->hash;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2205 struct yahoo_packet *pkt_to_send;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2206 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2207 int val_13_to_send = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2208 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2209 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2210
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2211 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2212 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2213
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2214 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2215
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2216 /* lets see whats in the packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2217 while (l) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2218 struct yahoo_pair *pair = l->data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2219
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2220 switch (pair->key) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2221 case 4:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2222 who = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2223 if(strncmp(who, p2p_data->host_username, strlen(p2p_data->host_username)) != 0) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2224 /* from whom are we receiving the packets ?? */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2225 purple_debug_warning("yahoo","p2p: received data from wrong user\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2226 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2227 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2228 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2229 case 13:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2230 p2p_data->val_13 = strtol(pair->value, NULL, 10); /* Value should be 5-7 */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2231 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2232 /* case 5, 49 look laters, no use right now */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2233 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2234 l = l->next;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2235 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2236
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2237 account = purple_connection_get_account(p2p_data->gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2239 /* key_13: sort of a counter.
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2240 * WHEN WE ARE CLIENT: yahoo server sends val_13 = 0, we send to peer val_13 = 1, receive back val_13 = 5,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2241 * we send val_13=6, receive val_13=7, we send val_13=7, HALT. Keep sending val_13 = 7 as keep alive.
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2242 * WHEN WE ARE SERVER: we send val_13 = 0 to yahoo server, peer sends us val_13 = 1, we send val_13 = 5,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2243 * receive val_13 = 6, send val_13 = 7, receive val_13 = 7. HALT. Keep sending val_13 = 7 as keep alive. */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2244
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2245 switch(p2p_data->val_13) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2246 case 1 : val_13_to_send = 5; break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2247 case 5 : val_13_to_send = 6; break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2248 case 6 : val_13_to_send = 7; break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2249 case 7 : if( g_hash_table_lookup(yd->peers, p2p_data->host_username) )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2250 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2251 val_13_to_send = 7; break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2252 default: purple_debug_warning("yahoo","p2p:Unknown value for key 13\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2253 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2254 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2255
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2256 /* Build the yahoo packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2257 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2258 yahoo_packet_hash(pkt_to_send, "ssisi",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2259 4, purple_normalize(account, purple_account_get_username(account)),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2260 5, p2p_data->host_username,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2261 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2262 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2263 13, val_13_to_send);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2264
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2265 /* build the raw packet and send it to the host */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2266 yahoo_p2p_write_pkt(source, pkt_to_send);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2267 yahoo_packet_free(pkt_to_send);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2268
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2269 if( val_13_to_send == 7 )
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2270 if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2271 g_hash_table_insert(yd->peers, g_strdup(p2p_data->host_username), p2p_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2272 /* If the peer is a friend, set him connected */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2273 f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2274 if (f) {
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2275 if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2276 p2p_data->session_id = f->session_id;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2277 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_SERVER);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2278 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2279 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2280 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2281 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2282 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2283 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2284
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2285 /* callback function associated with receiving of data, not considering receipt of multiple YMSG packets in a single TCP packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2286 static void yahoo_p2p_read_pkt_cb(gpointer data, gint source, PurpleInputCondition cond)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2287 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2288 guchar buf[1024]; /* is it safe to assume a fixed array length of 1024 ?? */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2289 int len;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2290 int pos = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2291 int pktlen;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2292 struct yahoo_packet *pkt;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2293 guchar *start = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2294 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2295 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2296
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2297 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2298 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2299 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2300
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2301 len = read(source, buf, sizeof(buf));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2302 if ((len < 0) && ((errno == EAGAIN) || (errno == EWOULDBLOCK)))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2303 return ; /* No Worries*/
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2304 else if (len <= 0)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2305 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2306 purple_debug_warning("yahoo","p2p: Error in connection, or host disconnected\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2307 /* remove from p2p connection lists, also calls yahoo_p2p_disconnect_destroy_data */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2308 if( g_hash_table_lookup(yd->peers, p2p_data->host_username) )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2309 g_hash_table_remove(yd->peers,p2p_data->host_username);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2310 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2311 yahoo_p2p_disconnect_destroy_data(data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2312 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2313 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2314
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2315 if(len < YAHOO_PACKET_HDRLEN)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2316 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2317
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2318 if(strncmp((char *)buf, "YMSG", MIN(4, len)) != 0) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2319 /* Not a YMSG packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2320 purple_debug_warning("yahoo","p2p: Got something other than YMSG packet\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2321
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2322 start = memchr(buf + 1, 'Y', len - 1);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2323 if(start) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2324 g_memmove(buf, start, len - (start - buf));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2325 len -= start - buf;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2326 } else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2327 g_free(buf);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2328 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2329 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2330 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2331
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2332 pos += 4; /* YMSG */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2333 pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2334 pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2335
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2336 pktlen = yahoo_get16(buf + pos); pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2337 purple_debug(PURPLE_DEBUG_MISC, "yahoo", "p2p: %d bytes to read\n", len);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2338
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2339 pkt = yahoo_packet_new(0, 0, 0);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2340 pkt->service = yahoo_get16(buf + pos); pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2341 pkt->status = yahoo_get32(buf + pos); pos += 4;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2342 pkt->id = yahoo_get32(buf + pos); pos += 4;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2343
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2344 purple_debug(PURPLE_DEBUG_MISC, "yahoo", "p2p: Yahoo Service: 0x%02x Status: %d\n",pkt->service, pkt->status);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2345 yahoo_packet_read(pkt, buf + pos, pktlen);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2346
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2347 /* packet processing */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2348 switch(pkt->service) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2349 case YAHOO_SERVICE_P2PFILEXFER:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2350 yahoo_p2p_process_p2pfilexfer(data, source, pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2351 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2352 case YAHOO_SERVICE_MESSAGE:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2353 yahoo_process_message(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2354 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2355 case YAHOO_SERVICE_NOTIFY:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2356 yahoo_process_notify(p2p_data->gc, pkt, YAHOO_PKT_TYPE_P2P);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2357 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2358 default:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2359 purple_debug_warning("yahoo","p2p: p2p service %d Unhandled\n",pkt->service);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2360 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2361
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2362 yahoo_packet_free(pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2363 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2364
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2365 static void yahoo_p2p_server_send_connected_cb(gpointer data, gint source, PurpleInputCondition cond)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2366 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2367 int acceptfd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2368 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2369 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2370
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2371 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2372 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2373 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2374
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2375 acceptfd = accept(source, NULL, 0);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2376 if(acceptfd == -1 && (errno == EAGAIN || errno == EWOULDBLOCK))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2377 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2378 else if(acceptfd == -1) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2379 purple_debug_warning("yahoo","yahoo_p2p_server_send_connected_cb: accept: %s\n", g_strerror(errno));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2380 yahoo_p2p_disconnect_destroy_data(data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2381 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2382 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2383
26240
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26239
diff changeset
2384 /* remove timeout */
26802
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2385 if (yd->yahoo_p2p_server_timeout_handle) {
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2386 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2387 yd->yahoo_p2p_server_timeout_handle = 0;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2388 }
26240
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26239
diff changeset
2389
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2390 /* remove watcher and close p2p server */
26802
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2391 if (yd->yahoo_p2p_server_watcher) {
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2392 purple_input_remove(yd->yahoo_p2p_server_watcher);
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2393 yd->yahoo_p2p_server_watcher = 0;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2394 }
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2395 if (yd->yahoo_local_p2p_server_fd >= 0) {
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2396 close(yd->yahoo_local_p2p_server_fd);
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2397 yd->yahoo_local_p2p_server_fd = -1;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
2398 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2399
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2400 /* Add an Input Read event to the file descriptor */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2401 p2p_data->input_event = purple_input_add(acceptfd, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2402 p2p_data->source = acceptfd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2403 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2404
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2405 static gboolean yahoo_cancel_p2p_server_listen_cb(gpointer data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2406 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2407 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2408 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2409
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2410 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2411 return FALSE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2412
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2413 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2414
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2415 purple_debug_warning("yahoo","yahoo p2p server timeout, peer failed to connect");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2416 yahoo_p2p_disconnect_destroy_data(data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2417 purple_input_remove(yd->yahoo_p2p_server_watcher);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2418 yd->yahoo_p2p_server_watcher = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2419 close(yd->yahoo_local_p2p_server_fd);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2420 yd->yahoo_local_p2p_server_fd = -1;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2421 yd->yahoo_p2p_server_timeout_handle = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2422
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2423 return FALSE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2424 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2425
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2426 static void yahoo_p2p_server_listen_cb(int listenfd, gpointer data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2427 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2428 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2429 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2430
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2431 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2432 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2433
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2434 if(listenfd == -1) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2435 purple_debug_warning("yahoo","p2p: error starting p2p server\n");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2436 yahoo_p2p_disconnect_destroy_data(data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2437 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2438 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2439
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2440 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2441
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2442 /* Add an Input Read event to the file descriptor */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2443 yd->yahoo_local_p2p_server_fd = listenfd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2444 yd->yahoo_p2p_server_watcher = purple_input_add(listenfd, PURPLE_INPUT_READ, yahoo_p2p_server_send_connected_cb,data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2445
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2446 /* add timeout */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2447 yd->yahoo_p2p_server_timeout_handle = purple_timeout_add_seconds(YAHOO_P2P_SERVER_TIMEOUT, yahoo_cancel_p2p_server_listen_cb, data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2448 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2449
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2450 /* send p2p pkt containing our encoded ip, asking peer to connect to us */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2451 void yahoo_send_p2p_pkt(PurpleConnection *gc, const char *who, int val_13)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2452 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2453 const char *public_ip;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2454 guint32 temp[4];
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2455 guint32 ip;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2456 char temp_str[100];
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2457 gchar *base64_ip = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2458 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2459 struct yahoo_packet *pkt;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2460 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2461 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2462 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2463
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2464 f = yahoo_friend_find(gc, who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2465 account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2466
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2467 /* Do not send invitation if already listening for other connection */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2468 if(yd->yahoo_local_p2p_server_fd >= 0)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2469 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2470
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2471 /* One shouldn't try to connect to self */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2472 if( strcmp(purple_normalize(account, purple_account_get_username(account)), who) == 0)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2473 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2474
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2475 /* 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 */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2476 if( !( f && (yahoo_friend_get_p2p_status(f) == YAHOO_P2PSTATUS_NOT_CONNECTED) && (f->p2p_packet_sent == 0)) )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2477 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2478
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2479 /* Dont send p2p packet to buddies of other protocols */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2480 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2481 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2482
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2483 /* Finally, don't try to connect to buddies not online or on sms */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2484 if( (f->status == YAHOO_STATUS_OFFLINE) || f->sms )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2485 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2486
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2487 public_ip = purple_network_get_public_ip();
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2488 if( (sscanf(public_ip, "%u.%u.%u.%u", &temp[0], &temp[1], &temp[2], &temp[3])) !=4 )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2489 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2490
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2491 ip = (temp[3] << 24) | (temp[2] <<16) | (temp[1] << 8) | temp[0];
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2492 sprintf(temp_str, "%d", ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2493 base64_ip = purple_base64_encode( (guchar *)temp_str, strlen(temp_str) );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2494
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2495 pkt = yahoo_packet_new(YAHOO_SERVICE_PEERTOPEER, YAHOO_STATUS_AVAILABLE, 0);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2496 yahoo_packet_hash(pkt, "sssissis",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2497 1, purple_normalize(account, purple_account_get_username(account)),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2498 4, purple_normalize(account, purple_account_get_username(account)),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2499 12, base64_ip, /* base64 encode ip */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2500 61, 0, /* To-do : figure out what is 61 for?? */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2501 2, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2502 5, who,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2503 13, val_13,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2504 49, "PEERTOPEER");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2505 yahoo_packet_send_and_free(pkt, yd);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2506
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2507 f->p2p_packet_sent = 1; /* set p2p_packet_sent to sent */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2508
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2509 p2p_data = g_new0(struct yahoo_p2p_data, 1);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2510
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2511 p2p_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2512 p2p_data->host_ip = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2513 p2p_data->host_username = g_strdup(who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2514 p2p_data->val_13 = val_13;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2515 p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER;
26592
d9439f76c118 Initialize file descriptors to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26361
diff changeset
2516 p2p_data->source = -1;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2517
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2518 purple_network_listen(YAHOO_PAGER_PORT_P2P, SOCK_STREAM, yahoo_p2p_server_listen_cb, p2p_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2519
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2520 g_free(base64_ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2521 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2522
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2523 /* function called when connection to p2p host is setup */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2524 static void yahoo_p2p_init_cb(gpointer data, gint source, const gchar *error_message)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2525 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2526 struct yahoo_p2p_data *p2p_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2527 struct yahoo_packet *pkt_to_send;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2528 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2529 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2530
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2531 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2532 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2533 yd = p2p_data->gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2534
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2535 if(error_message != NULL) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2536 purple_debug_warning("yahoo","p2p: %s\n",error_message);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2537 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2538
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2539 yahoo_p2p_disconnect_destroy_data(p2p_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2540 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2541 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2542
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2543 /* Add an Input Read event to the file descriptor */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2544 p2p_data->input_event = purple_input_add(source, PURPLE_INPUT_READ, yahoo_p2p_read_pkt_cb, data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2545 p2p_data->source = source;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2546
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2547 account = purple_connection_get_account(p2p_data->gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2548
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2549 /* Build the yahoo packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2550 pkt_to_send = yahoo_packet_new(YAHOO_SERVICE_P2PFILEXFER, YAHOO_STATUS_AVAILABLE, yd->session_id);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2551 yahoo_packet_hash(pkt_to_send, "ssisi",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2552 4, purple_normalize(account, purple_account_get_username(account)),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2553 5, p2p_data->host_username,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2554 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2555 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2556 13, 1); /* we receive key13= 0 or 2, we send key13=1 */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2557
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2558 yahoo_p2p_write_pkt(source, pkt_to_send); /* build raw packet and send */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2559 yahoo_packet_free(pkt_to_send);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2560 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2561
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2562 static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2563 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2564 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2565 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2566 char *base64 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2567 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2568 gsize len;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2569 gint val_13 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2570 gint val_11 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2571 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2572 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2573
26241
ffb0d441d0a3 identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26240
diff changeset
2574 /* if status is not 1 ie YAHOO_STATUS_BRB, the packet bounced back, so contains our own ip */
ffb0d441d0a3 identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26240
diff changeset
2575 if(!(pkt->status == YAHOO_STATUS_BRB))
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2576 return ;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2577
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2578 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2579 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2582 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2583 /* our identity */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2584 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2585 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2586 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2587 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2588 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2589 /* who again, the master identity this time? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2590 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2591 case 12:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2592 base64 = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2593 /* so, this is an ip address. in base64. decoded it's in ascii.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2594 after strtol, it's in reversed byte order. Who thought this up?*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 break;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2596 case 13:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2597 val_13 = strtol(pair->value, NULL, 10);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2598 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2599 case 11:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2600 val_11 = strtol(pair->value, NULL, 10); /* session id of peer */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2601 if( (f = yahoo_friend_find(gc, who)) )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2602 f->session_id = val_11;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2603 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2604 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2605 TODO: figure these out
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 yahoo: Key: 61 Value: 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607 yahoo: Key: 2 Value:
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2608 yahoo: Key: 13 Value: 0 packet count ??
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2609 yahoo: Key: 49 Value: PEERTOPEER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2610 yahoo: Key: 140 Value: 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2612
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2615 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2617
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2618 if (base64) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 guint32 ip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 YahooFriend *f;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2621 char *host_ip;
26593
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26592
diff changeset
2622 struct yahoo_p2p_data *p2p_data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2623
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2624 decoded = purple_base64_decode(base64, &len);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2625 if (len) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2626 char *tmp = purple_str_binary_to_ascii(decoded, len);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2627 purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2628 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2629 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2630
26593
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26592
diff changeset
2631 ip = strtol((gchar *)decoded, NULL, 10);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2632 g_free(decoded);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2633 host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2634 (ip >> 24) & 0xff);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2635 f = yahoo_friend_find(gc, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2636 if (f)
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2637 yahoo_friend_set_ip(f, host_ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2638 purple_debug_info("yahoo", "IP : %s\n", host_ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2639
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2640 account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2641
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2642 if(val_11==0) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2643 if(!f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2644 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2645 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2646 val_11 = f->session_id;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2647 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2648
26593
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26592
diff changeset
2649 p2p_data = g_new0(struct yahoo_p2p_data, 1);
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26592
diff changeset
2650 p2p_data->host_username = g_strdup(who);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2651 p2p_data->val_13 = val_13;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2652 p2p_data->session_id = val_11;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2653 p2p_data->host_ip = host_ip;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2654 p2p_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2655 p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT;
26593
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26592
diff changeset
2656 p2p_data->source = -1;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2657
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2658 /* connect to host */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
2659 if((purple_proxy_connect(NULL, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2660 purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip);
26650
3712d32363dd Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26627
diff changeset
2661 g_free(p2p_data->host_ip);
3712d32363dd Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26627
diff changeset
2662 g_free(p2p_data->host_username);
3712d32363dd Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26627
diff changeset
2663 g_free(p2p_data);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2664 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2665 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2666 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2668 static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2670 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671 char *who = NULL, *msg = NULL, *id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2673
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2674 account = purple_connection_get_account(gc);
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2675
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2676 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2679 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 /* us */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2685 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2686 case 230:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 /* the audible, in foo.locale.bar.baz format
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688 eg: base.tw.smiley.smiley43 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2689 id = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691 case 231:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2692 /* the text of the audible */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2694 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2695 case 232:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2696 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2700 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2702
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2703 if (!msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2704 msg = id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705 if (!who || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2707 if (!g_utf8_validate(msg, -1, NULL)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2708 purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2709 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2710 }
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2711 if (!purple_privacy_check(account, who)) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2712 purple_debug_misc("yahoo", "Audible message from %s for %s dropped!\n",
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2713 purple_account_get_username(account), who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2714 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2715 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2716 if (id) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2717 /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2718 char **audible_locale = g_strsplit(id, ".", 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2719 char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720 g_strfreev(audible_locale);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722 serv_got_im(gc, who, buf, 0, time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2724 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725 serv_got_im(gc, who, msg, 0, time(NULL));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2727
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2728 static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2729 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2730 switch (pkt->service) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2731 case YAHOO_SERVICE_LOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2732 case YAHOO_SERVICE_LOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733 case YAHOO_SERVICE_ISAWAY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2734 case YAHOO_SERVICE_ISBACK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2735 case YAHOO_SERVICE_GAMELOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 case YAHOO_SERVICE_GAMELOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737 case YAHOO_SERVICE_CHATLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 case YAHOO_SERVICE_CHATLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2740 case YAHOO_SERVICE_STATUS_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2742 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2743 case YAHOO_SERVICE_NOTIFY:
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2744 yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2745 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2746 case YAHOO_SERVICE_MESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2747 case YAHOO_SERVICE_GAMEMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2748 case YAHOO_SERVICE_CHATMSG:
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2749 yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2750 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2751 case YAHOO_SERVICE_SYSMESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2752 yahoo_process_sysmessage(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2753 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2754 case YAHOO_SERVICE_NEWMAIL:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2755 yahoo_process_mail(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2756 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2757 case YAHOO_SERVICE_NEWCONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2758 yahoo_process_contact(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2759 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2760 case YAHOO_SERVICE_AUTHRESP:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2761 yahoo_process_authresp(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2763 case YAHOO_SERVICE_LIST:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2764 yahoo_process_list(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2765 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 case YAHOO_SERVICE_LIST_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 yahoo_process_list_15(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2768 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2769 case YAHOO_SERVICE_AUTH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770 yahoo_process_auth(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 break;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
2772 case YAHOO_SERVICE_AUTH_REQ_15:
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
2773 yahoo_buddy_auth_req_15(gc, pkt);
19358
b3901a15147a Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19348
diff changeset
2774 break;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2775 case YAHOO_SERVICE_ADDBUDDY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2776 yahoo_process_addbuddy(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778 case YAHOO_SERVICE_IGNORECONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 yahoo_process_ignore(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781 case YAHOO_SERVICE_CONFINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 case YAHOO_SERVICE_CONFADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2783 yahoo_process_conference_invite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2784 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2785 case YAHOO_SERVICE_CONFDECLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2786 yahoo_process_conference_decline(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2787 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2788 case YAHOO_SERVICE_CONFLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2789 yahoo_process_conference_logon(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2790 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2791 case YAHOO_SERVICE_CONFLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 yahoo_process_conference_logoff(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2793 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2794 case YAHOO_SERVICE_CONFMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2795 yahoo_process_conference_message(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2796 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2797 case YAHOO_SERVICE_CHATONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2798 yahoo_process_chat_online(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2799 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2800 case YAHOO_SERVICE_CHATLOGOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2801 yahoo_process_chat_logout(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2802 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2803 case YAHOO_SERVICE_CHATGOTO:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2804 yahoo_process_chat_goto(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2805 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2806 case YAHOO_SERVICE_CHATJOIN:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2807 yahoo_process_chat_join(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2808 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2809 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2810 case YAHOO_SERVICE_CHATEXIT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2811 yahoo_process_chat_exit(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813 case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814 case YAHOO_SERVICE_CHATADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 yahoo_process_chat_addinvite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2817 case YAHOO_SERVICE_COMMENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2818 yahoo_process_chat_message(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 case YAHOO_SERVICE_PRESENCE_SESSION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2822 yahoo_process_presence(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824 case YAHOO_SERVICE_P2PFILEXFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2825 /* This case had no break and continued; thus keeping it this way.*/
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2826 yahoo_process_p2p(gc, pkt); /* P2PFILEXFER handled the same way as process_p2p */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2827 yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2828 case YAHOO_SERVICE_FILETRANSFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829 yahoo_process_filetransfer(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2830 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2831 case YAHOO_SERVICE_PEERTOPEER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832 yahoo_process_p2p(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2833 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2834 case YAHOO_SERVICE_PICTURE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2835 yahoo_process_picture(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2836 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2837 case YAHOO_SERVICE_PICTURE_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2838 yahoo_process_picture_update(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2839 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2840 case YAHOO_SERVICE_PICTURE_CHECKSUM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 yahoo_process_picture_checksum(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2842 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2843 case YAHOO_SERVICE_PICTURE_UPLOAD:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2844 yahoo_process_picture_upload(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2845 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2846 case YAHOO_SERVICE_AVATAR_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2847 yahoo_process_avatar_update(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2848 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2849 case YAHOO_SERVICE_AUDIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2850 yahoo_process_audible(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2851 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2852 case YAHOO_SERVICE_FILETRANS_15:
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2853 yahoo_process_filetrans_15(gc, pkt);
21803
ffbd2e3e10e4 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 <daniel.atallah@gmail.com>
parents: 21801
diff changeset
2854 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2855 case YAHOO_SERVICE_FILETRANS_INFO_15:
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2856 yahoo_process_filetrans_info_15(gc, pkt);
21803
ffbd2e3e10e4 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 <daniel.atallah@gmail.com>
parents: 21801
diff changeset
2857 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2858 case YAHOO_SERVICE_FILETRANS_ACC_15:
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2859 yahoo_process_filetrans_acc_15(gc, pkt);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2860 break;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2861 case YAHOO_SERVICE_SMS_MSG:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2862 yahoo_process_sms_message(gc, pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
2863 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2864
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2865 default:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2866 purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867 "Unhandled service 0x%02x\n", pkt->service);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2868 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2869 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2870 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2871
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2872 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2874 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2875 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876 char buf[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2878
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2879 len = read(yd->fd, buf, sizeof(buf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2885 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2886 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888 tmp = g_strdup_printf(_("Lost connection with server:\n%s"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 21030
diff changeset
2889 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2890 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2891 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2892 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2893 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2894 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
2895 _("Server closed the connection."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 }
22149
252b96b6a32c Don't send keep-alives if we've received data since in the last KEEPALIVE_INTERVAL seconds
Sean Egan <seanegan@gmail.com>
parents: 22097
diff changeset
2898 gc->last_received = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 while (1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2904 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905 int pos = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 int pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2910
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2911 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2912 /* HEY! This isn't even a YMSG packet. What
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2913 * are you trying to pull? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2914 guchar *start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
2916 purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2918 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2919 if (start) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2920 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2921 yd->rxlen -= start - yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2924 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931 pos += 4; /* YMSG */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2932 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2933 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2936 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2937 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2938
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2939 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2940 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2941
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2942 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944 pkt = yahoo_packet_new(0, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2946 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2947 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2948 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2949 "Yahoo Service: 0x%02x Status: %d\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2950 pkt->service, pkt->status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2953 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2954
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2955 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 if (yd->rxlen) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2957 guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2958 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2959 yd->rxqueue = tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2962 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2963 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2964
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2965 yahoo_packet_process(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2967 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971 static void yahoo_got_connected(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2973 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2974 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2975 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2976
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2977 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2978 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2979 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2980 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2981
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2982 if (source < 0) {
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
2983 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
2984 tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"),
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
2985 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2986 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
2987 g_free(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2990
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2991 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2996 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2997 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2998
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
2999 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3000 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3001
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3002 #ifdef TRY_WEBMESSENGER_LOGIN
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 static void yahoo_got_web_connected(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3004 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3005 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3006 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3009 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3010 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3011 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3013
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3014 if (source < 0) {
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3015 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3016 tmp = g_strdup_printf(_("Could not establish a connection with the server:\n%s"),
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3017 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3018 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3019 g_free(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3021 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3027
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3028 yahoo_packet_hash(pkt, "sss", 0,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3029 purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3030 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3031 6, yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3032 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3034 g_free(yd->auth);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3035 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3037
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3038 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3039 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3040 PurpleConnection *gc = data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3041 PurpleAccount *account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3042 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3043 char bufread[2048], *i = bufread, *buf = bufread;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3044 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3045 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3046
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3047 len = read(source, bufread, sizeof(bufread) - 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3049 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3050 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3053 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3054 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056 tmp = g_strdup_printf(_("Lost connection with server:\n%s"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 21030
diff changeset
3057 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3058 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3059 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3060 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3061 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3062 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3063 _("Server closed the connection."));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3065 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3066
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3067 if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3068 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3069 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3070 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3071 i = buf = (char *)yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3072 len = yd->rxlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3074 buf[len] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3076 if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) &&
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3078 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3079 _("Received unexpected HTTP response from server."));
24539
9fb7910c1176 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <mark@kingant.net>
parents: 24536
diff changeset
3080 purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3081 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3082 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3083
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3084 s = g_string_sized_new(len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3085
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3086 while ((i = strstr(i, "Set-Cookie: "))) {
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3087
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3088 i += strlen("Set-Cookie: ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3089 for (;*i != ';' && *i != '\0'; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3090 g_string_append_c(s, *i);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
3091
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3092 g_string_append(s, "; ");
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3093 /* Should these cookies be included too when trying for xfer?
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3094 * It seems to work without these
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3095 */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3096 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3097
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3098 yd->auth = g_string_free(s, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3099 purple_input_remove(gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3100 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3101 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3104 /* Now we have our cookies to login with. I'll go get the milk. */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3105 if (purple_proxy_connect(gc, account, "wcs2.msg.dcn.yahoo.com",
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3106 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3107 yahoo_got_web_connected, gc) == NULL) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3108 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3109 _("Connection problem"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3110 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3111 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3112 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3114 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3115 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3116 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3117 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3118 int written, remaining;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3119
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3120 gc = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 remaining = strlen(yd->auth) - yd->auth_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 written = write(source, yd->auth + yd->auth_written, remaining);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3125
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3126 if (written < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3127 written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128 else if (written <= 0) {
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3129 gchar *tmp;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3130 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3131 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132 if (gc->inpa)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3133 purple_input_remove(gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 gc->inpa = 0;
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3135 tmp = g_strdup_printf(_("Lost connection with %s:\n%s"),
21121
35b4f1dc4c8d replace most calls to strerror with calls to g_strerror. strerror will return
Nathan Walp <nwalp@pidgin.im>
parents: 21030
diff changeset
3136 "login.yahoo.com:80", g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3137 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3138 g_free(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3142 if (written < remaining) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 yd->auth_written += written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3144 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3146
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3147 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3148 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3149 yd->auth_written = 0;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3150 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3151 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3152 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3153
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3154 static void yahoo_got_cookies(gpointer data, gint source, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3155 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3156 PurpleConnection *gc = data;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3158 if (source < 0) {
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3159 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3160 tmp = g_strdup_printf(_("Could not establish a connection with %s:\n%s"),
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3161 "login.yahoo.com:80", error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3162 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17672
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17054
diff changeset
3163 g_free(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3164 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3166
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3167 if (gc->inpa == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3168 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3169 gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3170 yahoo_got_cookies_send_cb, gc);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3171 yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3172 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3173 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3174
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3175 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3176 {
24539
9fb7910c1176 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <mark@kingant.net>
parents: 24536
diff changeset
3177 if (!strcmp(key, "passwd") || !strcmp(key, "login"))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3178 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3179 g_string_append_c(url, '&');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3180 g_string_append(url, key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3181 g_string_append_c(url, '=');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3182 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3183 g_string_append_c(url, '1');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3184 else if (!strcmp(key, ".challenge"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3185 g_string_append(url, val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3186 else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3187 g_string_append(url, purple_url_encode(val));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3188 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3189
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3190 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3191 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3192 GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3193 const char *c = buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3194 char *d;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3195 char name[64], value[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3196 int count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3197 int input_len = strlen("<input ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3198 int name_len = strlen("name=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3199 int value_len = strlen("value=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3200 while ((len > ((c - buf) + input_len))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3201 && (c = strstr(c, "<input "))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3202 if (!(c = g_strstr_len(c, len - (c - buf), "name=\"")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3203 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3204 c += name_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3205 count = sizeof(name)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3206 for (d = name; (len > ((c - buf) + 1)) && *c!='"'
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3207 && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3208 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3209 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3210 count = sizeof(value)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3211 if (!(d = g_strstr_len(c, len - (c - buf), "value=\"")))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3212 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3213 d += value_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3214 if (strchr(c, '>') < d)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3215 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3216 for (c = d, d = value; (len > ((c - buf) + 1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3217 && *c!='"' && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3218 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3219 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3220 g_hash_table_insert(hash, g_strdup(name), g_strdup(value));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3221 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3222 return hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3223 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3225 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3226 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3227 const gchar *url_text, size_t len, const gchar *error_message)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3228 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3229 PurpleConnection *gc = (PurpleConnection *)user_data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3230 PurpleAccount *account = purple_connection_get_account(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3231 struct yahoo_data *yd = gc->proto_data;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3232 const char *sn = purple_account_get_username(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3233 const char *pass = purple_connection_get_password(gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3234 GHashTable *hash = yahoo_login_page_hash(url_text, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3235 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3236 char md5[33], *hashp = md5, *chal;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3237 int i;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3238 PurpleCipher *cipher;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3239 PurpleCipherContext *context;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3240 guchar digest[16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3241
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3242 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3243
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3244 if (error_message != NULL)
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3245 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3246 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3247 error_message);
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3248 return;
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3249 }
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3250
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3251 url = g_string_append(url, sn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3252 url = g_string_append(url, "&passwd=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3254 cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3255 context = purple_cipher_context_new(cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3256
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3257 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3258 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3259 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3262 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3263
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3264 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3265 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3266 purple_cipher_context_append(context, (const guchar *)chal, strlen(chal));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3267 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3268 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3269 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3270 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3271 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3272 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3274 * I dunno why this is here and commented out.. but in case it's needed
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3275 * I updated it..
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3277 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3278 purple_cipher_context_append(context, md5, strlen(md5));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3279 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3280 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3281 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3282 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3283 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3285 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3286 g_free(chal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3287
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3288 url = g_string_append(url, md5);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3289 g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3290
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3291 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3292 "Host: login.yahoo.com\r\n\r\n");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3293 g_hash_table_destroy(hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3294 yd->auth = g_string_free(url, FALSE);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3295 if (purple_proxy_connect(gc, account, "login.yahoo.com", 80, yahoo_got_cookies, gc) == NULL) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3296 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3297 _("Connection problem"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3298 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3299 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3300
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3301 purple_cipher_context_destroy(context);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3302 }
15744
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15624
diff changeset
3303 #endif
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3304
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3305 static void yahoo_server_check(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3306 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3307 const char *server;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3308
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3309 server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3310
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3311 if (strcmp(server, "scs.yahoo.com") == 0)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3312 purple_account_set_string(account, "server", YAHOO_PAGER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3313 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3314
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3315 static void yahoo_picture_check(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3316 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3317 PurpleConnection *gc = purple_account_get_connection(account);
16390
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16386
diff changeset
3318 PurpleStoredImage *img = purple_buddy_icons_find_account_icon(account);
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16386
diff changeset
3319
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16386
diff changeset
3320 yahoo_set_buddy_icon(gc, img);
4fc51a87ce42 Updates for the account buddy icon stuff. This doesn't yet work fully (and maybe not even partly), but it compiles.
Richard Laager <rlaager@wiktel.com>
parents: 16386
diff changeset
3321 purple_imgstore_unref(img);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3322 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3323
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3324 static int get_yahoo_status_from_purple_status(PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3325 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3326 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 const char *status_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3328 const char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3329
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3330 presence = purple_status_get_presence(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3331 status_id = purple_status_get_id(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3332 msg = purple_status_get_attr_string(status, "message");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3333
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3334 if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3335 if ((msg != NULL) && (*msg != '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3336 return YAHOO_STATUS_CUSTOM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3337 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3338 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3339 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 return YAHOO_STATUS_BRB;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3341 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 return YAHOO_STATUS_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3343 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 return YAHOO_STATUS_NOTATHOME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3345 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3346 return YAHOO_STATUS_NOTATDESK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3347 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3348 return YAHOO_STATUS_NOTINOFFICE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3349 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3350 return YAHOO_STATUS_ONPHONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3351 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3352 return YAHOO_STATUS_ONVACATION;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3353 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3354 return YAHOO_STATUS_OUTTOLUNCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3355 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3356 return YAHOO_STATUS_STEPPEDOUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3357 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3358 return YAHOO_STATUS_INVISIBLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3359 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3360 return YAHOO_STATUS_CUSTOM;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3361 } else if (purple_presence_is_idle(presence)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3362 return YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3363 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3364 purple_debug_error("yahoo", "Unexpected PurpleStatus!\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3365 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3366 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3367 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3368
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3369 static void yahoo_login(PurpleAccount *account) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3370 PurpleConnection *gc = purple_account_get_connection(account);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3371 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3372 PurpleStatus *status = purple_account_get_active_status(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3373 gc->flags |= PURPLE_CONNECTION_HTML | PURPLE_CONNECTION_NO_BGCOLOR | PURPLE_CONNECTION_NO_URLDESC;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3374
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3375 purple_connection_update_progress(gc, _("Connecting"), 1, 2);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3376
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3377 purple_connection_set_display_name(gc, purple_account_get_username(account));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3378
26239
969b0e6f3f44 set fd to -1 initially, if not done, no p2p connection is initiated ever.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26238
diff changeset
3379 yd->yahoo_local_p2p_server_fd = -1;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3380 yd->fd = -1;
19393
35ae010cc037 Input handlers are unsigned integers. So set them to 0 instead of -1 after
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19365
diff changeset
3381 yd->txhandler = 0;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3382 /* TODO: Is there a good grow size for the buffer? */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3383 yd->txbuf = purple_circ_buffer_new(0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3384 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3385 yd->imvironments = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
3386 yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3387 yd->peers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_p2p_disconnect_destroy_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3388 yd->sms_carrier = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3389 yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, yahoo_p2p_keepalive, gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3390 yd->confs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3391 yd->conf_id = 2;
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
3392 yd->last_keepalive = yd->last_ping = time(NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3393
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3394 yd->current_status = get_yahoo_status_from_purple_status(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3395
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3396 yahoo_server_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3397 yahoo_picture_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3398
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3399 if (purple_account_get_bool(account, "yahoojp", FALSE)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3400 yd->jp = TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3401 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3402 purple_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3403 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3404 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3405 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3406 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3407 _("Connection problem"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3408 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3409 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3410 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3411 yd->jp = FALSE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3412 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3413 purple_account_get_string(account, "server", YAHOO_PAGER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3414 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3415 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3416 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3417 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR,
20132
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19718
diff changeset
3418 _("Connection problem"));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3419 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3420 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3421 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3422 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3423
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3424 static void yahoo_close(PurpleConnection *gc) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3425 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3426 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3428 if (gc->inpa)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3429 purple_input_remove(gc->inpa);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3431 while (yd->url_datas) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3432 purple_util_fetch_url_cancel(yd->url_datas->data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3433 yd->url_datas = g_slist_delete_link(yd->url_datas, yd->url_datas);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3434 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3436 for (l = yd->confs; l; l = l->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3437 PurpleConversation *conv = l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3438
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3439 yahoo_conf_leave(yd, purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3440 purple_connection_get_display_name(gc),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3441 purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3442 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 g_slist_free(yd->confs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3444
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3445 for (l = yd->cookies; l; l = l->next) {
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3446 g_free(l->data);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3447 l->data=NULL;
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3448 }
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3449 g_slist_free(yd->cookies);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3450
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
3451 yd->chat_online = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3452 if (yd->in_chat)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3453 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3454
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3455 purple_timeout_remove(yd->yahoo_p2p_timer);
26802
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3456 if(yd->yahoo_p2p_server_timeout_handle != 0) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3457 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
26802
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3458 yd->yahoo_p2p_server_timeout_handle = 0;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3459 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3460
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3461 /* close p2p server if it is waiting for a peer to connect */
26802
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3462 if (yd->yahoo_p2p_server_watcher) {
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3463 purple_input_remove(yd->yahoo_p2p_server_watcher);
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3464 yd->yahoo_p2p_server_watcher = 0;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3465 }
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3466 if (yd->yahoo_local_p2p_server_fd >= 0) {
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3467 close(yd->yahoo_local_p2p_server_fd);
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3468 yd->yahoo_local_p2p_server_fd = -1;
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26650
diff changeset
3469 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3470
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3471 g_hash_table_destroy(yd->sms_carrier);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
3472 g_hash_table_destroy(yd->peers);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3473 g_hash_table_destroy(yd->friends);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3474 g_hash_table_destroy(yd->imvironments);
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3475 g_hash_table_destroy(yd->xfer_peer_idstring_map);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3476 g_free(yd->chat_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3477
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3478 g_free(yd->cookie_y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3479 g_free(yd->cookie_t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 if (yd->txhandler)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3482 purple_input_remove(yd->txhandler);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3483
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3484 purple_circ_buffer_destroy(yd->txbuf);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3485
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3486 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3487 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3488
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3489 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3490 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3491 g_free(yd->picture_url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3493 if (yd->buddy_icon_connect_data)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3494 purple_proxy_connect_cancel(yd->buddy_icon_connect_data);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3495 if (yd->picture_upload_todo)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3496 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3497 if (yd->ycht)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3498 ycht_connection_close(yd->ycht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499
19554
c07a9c6f0263 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 <daniel.atallah@gmail.com>
parents: 19543
diff changeset
3500 g_free(yd->pending_chat_room);
c07a9c6f0263 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 <daniel.atallah@gmail.com>
parents: 19543
diff changeset
3501 g_free(yd->pending_chat_id);
c07a9c6f0263 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 <daniel.atallah@gmail.com>
parents: 19543
diff changeset
3502 g_free(yd->pending_chat_topic);
c07a9c6f0263 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 <daniel.atallah@gmail.com>
parents: 19543
diff changeset
3503 g_free(yd->pending_chat_goto);
c07a9c6f0263 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 <daniel.atallah@gmail.com>
parents: 19543
diff changeset
3504
22406
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
3505 g_free(yd->current_list15_grp);
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22320
diff changeset
3506
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3507 g_free(yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3508 gc->proto_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3509 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3510
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3511 static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3512 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3513 return "yahoo";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3514 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3515
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3516 static const char *yahoo_list_emblem(PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3517 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3518 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3519 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3520 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3521 YahooFriend *f;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3522 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3523
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3524 if (!b || !(account = purple_buddy_get_account(b)) ||
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3525 !(gc = purple_account_get_connection(account)) ||
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3526 !(yd = gc->proto_data))
15498
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15463
diff changeset
3527 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3528
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3529 f = yahoo_friend_find(gc, purple_buddy_get_name(b));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3530 if (!f) {
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15383
diff changeset
3531 return "not-authorized";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3533
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3534 presence = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3535
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3536 if (purple_presence_is_online(presence)) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3537 if (yahoo_friend_get_game(f))
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15383
diff changeset
3538 return "game";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539 if (f->protocol == 2)
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15383
diff changeset
3540 return "msn";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3541 }
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15383
diff changeset
3542 return NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3543 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3545 static const char *yahoo_get_status_string(enum yahoo_status a)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3546 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3547 switch (a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548 case YAHOO_STATUS_BRB:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3549 return _("Be Right Back");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3550 case YAHOO_STATUS_BUSY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3551 return _("Busy");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3552 case YAHOO_STATUS_NOTATHOME:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3553 return _("Not at Home");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3554 case YAHOO_STATUS_NOTATDESK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3555 return _("Not at Desk");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556 case YAHOO_STATUS_NOTINOFFICE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557 return _("Not in Office");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3558 case YAHOO_STATUS_ONPHONE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3559 return _("On the Phone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3560 case YAHOO_STATUS_ONVACATION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3561 return _("On Vacation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3562 case YAHOO_STATUS_OUTTOLUNCH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3563 return _("Out to Lunch");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3564 case YAHOO_STATUS_STEPPEDOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3565 return _("Stepped Out");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3566 case YAHOO_STATUS_INVISIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3567 return _("Invisible");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3568 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3569 return _("Idle");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3570 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3571 return _("Offline");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3572 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3573 return _("Available");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3574 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3575 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3577 static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3578
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3579 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3580 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3581
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3582 GHashTable *components;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3583 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3584 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3585
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3586 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3587
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3588 buddy = (PurpleBuddy *) node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3589 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3590 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3591 id = yd->conf_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3592
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3593 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3594 g_hash_table_replace(components, g_strdup("room"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3595 g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3596 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference..."));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3597 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3598 yahoo_c_join(gc, components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3599 g_hash_table_destroy(components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3600
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3601 yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3603
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3604 static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3605 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3606 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3607 int presence_val = GPOINTER_TO_INT(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3608
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3609 buddy = (PurpleBuddy *) node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3610 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3611
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3612 yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3614
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3615 static void yahoo_game(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3616
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3617 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3618 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3619
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3620 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3621 const char *game;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3622 char *game2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3623 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3624 char url[256];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3625 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3626
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3627 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3628
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3629 buddy = (PurpleBuddy *) node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3630 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3631 yd = (struct yahoo_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3632
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3633 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3634 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3635 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3637 game = yahoo_friend_get_game(f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3638 if (!game)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3639 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3640
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3641 t = game2 = g_strdup(strstr(game, "ante?room="));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3642 while (*t && *t != '\t')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3643 t++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3644 *t = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3645 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3646 purple_notify_uri(gc, url);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3647 g_free(game2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3648 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3649
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3650 static char *yahoo_status_text(PurpleBuddy *b)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3651 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3652 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3653 const char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3654 char *msg2;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3655 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3656
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3657 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3658 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3659 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3660 return g_strdup(_("Not on server list"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3662 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3663 case YAHOO_STATUS_AVAILABLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3664 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3665 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3666 if (f->idle == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3667 return g_strdup(yahoo_get_status_string(f->status));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3668 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3669 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3670 if (!(msg = yahoo_friend_get_status_message(f)))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3671 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3672 msg2 = g_markup_escape_text(msg, strlen(msg));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3673 purple_util_chrreplace(msg2, '\n', ' ');
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3674 return msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3675
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3676 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3677 return g_strdup(yahoo_get_status_string(f->status));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3678 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3680
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3681 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3682 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3684 char *escaped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3685 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3686 const char *presence = NULL;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3687 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3688
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3689 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3690 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3691 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 status = g_strdup_printf("\n%s", _("Not on server list"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3693 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3694 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3695 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3696 if (!yahoo_friend_get_status_message(f))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3697 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3698 status = g_strdup(yahoo_friend_get_status_message(f));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3699 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3700 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3701 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3702 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3703 status = g_strdup(yahoo_get_status_string(f->status));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3704 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3706
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 switch (f->presence) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3708 case YAHOO_PRESENCE_ONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3709 presence = _("Appear Online");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3710 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711 case YAHOO_PRESENCE_PERM_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3712 presence = _("Appear Permanently Offline");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3714 case YAHOO_PRESENCE_DEFAULT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3715 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3716 default:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3717 purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3719 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3720 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3721
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3722 if (status != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3723 escaped = g_markup_escape_text(status, strlen(status));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3724 purple_notify_user_info_add_pair(user_info, _("Status"), escaped);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 g_free(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3726 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3728
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3729 if (presence != NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3730 purple_notify_user_info_add_pair(user_info, _("Presence"), presence);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3731 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3732
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3733 static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3734 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3735 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3736 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3737
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3738 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3739
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3740 buddy = (PurpleBuddy *) node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3741 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3742
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3743 yahoo_add_buddy(gc, buddy, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3744 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3747 static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3748 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3749 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3750 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3751
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3752 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3753
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3754 buddy = (PurpleBuddy *) node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3755 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3756
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3757 yahoo_chat_goto(gc, purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3759
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3760 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3761 GList *m = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3762 PurpleMenuAction *act;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3763 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3764
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3765 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3766 if (f->presence != YAHOO_PRESENCE_ONLINE) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3767 act = purple_menu_action_new(_("Appear Online"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3768 PURPLE_CALLBACK(yahoo_presence_settings),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3769 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3770 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3771 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3772 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3773 act = purple_menu_action_new(_("Appear Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3774 PURPLE_CALLBACK(yahoo_presence_settings),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3775 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3776 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3777 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3778 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3779 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3780
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3781 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3782 act = purple_menu_action_new(_("Don't Appear Permanently Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3783 PURPLE_CALLBACK(yahoo_presence_settings),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3784 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3785 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3786 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3787 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3788 act = purple_menu_action_new(_("Appear Permanently Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3789 PURPLE_CALLBACK(yahoo_presence_settings),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3790 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3791 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3792 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3793 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3795 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3797
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3798 static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3799 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3800 PurpleBuddy *b = (PurpleBuddy *)node;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3801 PurpleAccount *account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3802 PurpleConnection *gc = purple_account_get_connection(account);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3803
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3804 yahoo_doodle_initiate(gc, purple_buddy_get_name(b));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3807 static GList *yahoo_buddy_menu(PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3808 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3809 GList *m = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3810 PurpleMenuAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3811
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3812 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3813 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3814 static char buf2[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3815 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3816
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
3817 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3818
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3819 if (!f && !yd->wm) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3820 act = purple_menu_action_new(_("Add Buddy"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3821 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3822 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3823 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3825 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3827 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3828
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3829 if (f && f->status != YAHOO_STATUS_OFFLINE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 if (!yd->wm) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3831 act = purple_menu_action_new(_("Join in Chat"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3832 PURPLE_CALLBACK(yahoo_chat_goto_menu),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3833 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3834 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3835 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3836
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3837 act = purple_menu_action_new(_("Initiate Conference"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3838 PURPLE_CALLBACK(yahoo_initiate_conference),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3839 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3840 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3842 if (yahoo_friend_get_game(f)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3843 const char *game = yahoo_friend_get_game(f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3844 char *room;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3845 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3846
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3847 if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3848 while (*room && *room != '\t') /* skip to the tab */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3849 room++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850 t = room++; /* room as now at the name */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3851 while (*t != '\n')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3852 t++; /* replace the \n with a space */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3853 *t = ' ';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3854 g_snprintf(buf2, sizeof buf2, "%s", room);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3855
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3856 act = purple_menu_action_new(buf2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3857 PURPLE_CALLBACK(yahoo_game),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3860 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3864 if (f) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3865 act = purple_menu_action_new(_("Presence Settings"), NULL, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3866 build_presence_submenu(f, gc));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3869
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3870 if (f) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3871 act = purple_menu_action_new(_("Start Doodling"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3872 PURPLE_CALLBACK(yahoo_doodle_blist_node),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3873 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3874 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3875 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3877 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3878 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3879
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3880 static GList *yahoo_blist_node_menu(PurpleBlistNode *node)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3882 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3883 return yahoo_buddy_menu((PurpleBuddy *) node);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3884 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3885 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3886 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3887 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3888
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3889 static void yahoo_act_id(PurpleConnection *gc, const char *entry)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3891 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3892
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3894 yahoo_packet_hash_str(pkt, 3, entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3895 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3896
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3897 purple_connection_set_display_name(gc, entry);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3898 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3899
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3900 static void
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3901 yahoo_get_inbox_token_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3902 const gchar *token, size_t len, const gchar *error_message)
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3903 {
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3904 PurpleConnection *gc = user_data;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3905 gboolean set_cookie = FALSE;
22807
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3906 gchar *url;
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3907 struct yahoo_data *yd = gc->proto_data;
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3908
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3909 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
22807
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3910
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3911 yd->url_datas = g_slist_remove(yd->url_datas, url_data);
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3912
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3913 if (error_message != NULL)
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3914 purple_debug_error("yahoo", "Requesting mail login token failed: %s\n", error_message);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3915 else if (len > 0 && token && *token) {
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3916 /* Should we not be hardcoding the rd url? */
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3917 url = g_strdup_printf(
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3918 "http://login.yahoo.com/config/reset_cookies_token?"
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3919 ".token=%s"
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3920 "&.done=http://us.rd.yahoo.com/messenger/client/%%3fhttp://mail.yahoo.com/",
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3921 token);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3922 set_cookie = TRUE;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3923 }
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3924
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3925 if (!set_cookie) {
19653
941965d6fd88 Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19554
diff changeset
3926 purple_debug_error("yahoo", "No mail login token; forwarding to login screen.\n");
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3927 url = g_strdup(yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3928 }
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3929
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3930 /* Open the mailbox with the parsed url data */
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3931 purple_notify_uri(gc, url);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3932
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3933 g_free(url);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3934 }
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3935
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3936
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3937 static void yahoo_show_inbox(PurplePluginAction *action)
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3938 {
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3939 /* Setup a cookie that can be used by the browser */
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3940 /* XXX I have no idea how this will work with Yahoo! Japan. */
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3941
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3942 PurpleConnection *gc = action->context;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3943 struct yahoo_data *yd = gc->proto_data;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3944
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3945 PurpleUtilFetchUrlData *url_data;
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3946 const char* base_url = "http://login.yahoo.com";
23916
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23751
diff changeset
3947 /* use whole URL if using HTTP Proxy */
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23751
diff changeset
3948 gboolean use_whole_url = yahoo_account_use_http_proxy(gc);
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23751
diff changeset
3949 gchar *request = g_strdup_printf(
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23751
diff changeset
3950 "POST %s/config/cookie_token HTTP/1.0\r\n"
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3951 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n"
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
3952 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n"
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3953 "Host: login.yahoo.com\r\n"
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3954 "Content-Length: 0\r\n\r\n",
23916
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23751
diff changeset
3955 use_whole_url ? base_url : "",
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3956 yd->cookie_t, yd->cookie_y);
22056
b0ed2ce8514d A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
3957
27071
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
3958 url_data = purple_util_fetch_url_request_len_with_account(
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
3959 purple_connection_get_account(gc), base_url, use_whole_url,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
3960 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1,
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3961 yahoo_get_inbox_token_cb, gc);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3962
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3963 g_free(request);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3964
22807
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3965 if (url_data != NULL)
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3966 yd->url_datas = g_slist_prepend(yd->url_datas, url_data);
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22770
diff changeset
3967 else {
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3968 const char *yahoo_mail_url = (yd->jp ? YAHOOJP_MAIL_URL : YAHOO_MAIL_URL);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3969 purple_debug_error("yahoo",
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3970 "Unable to request mail login token; forwarding to login screen.");
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3971 purple_notify_uri(gc, yahoo_mail_url);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3972 }
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3973
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3974 }
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3975
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
3976
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3977 static void yahoo_show_act_id(PurplePluginAction *action)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3979 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3980 purple_request_input(gc, NULL, _("Activate which ID?"), NULL,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3981 purple_connection_get_display_name(gc), FALSE, FALSE, NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3982 _("OK"), G_CALLBACK(yahoo_act_id),
16442
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
3983 _("Cancel"), NULL,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
3984 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3985 gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3986 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3987
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3988 static void yahoo_show_chat_goto(PurplePluginAction *action)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3989 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3990 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3991 purple_request_input(gc, NULL, _("Join whom in chat?"), NULL,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3992 "", FALSE, FALSE, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3993 _("OK"), G_CALLBACK(yahoo_chat_goto),
16442
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
3994 _("Cancel"), NULL,
08db93bbd798 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 <evan.s@dreskin.net>
parents: 15946
diff changeset
3995 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3996 gc);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3998
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
3999 static GList *yahoo_actions(PurplePlugin *plugin, gpointer context) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000 GList *m = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4001 PurplePluginAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4002
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4003 act = purple_plugin_action_new(_("Activate ID..."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4004 yahoo_show_act_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4005 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4006
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4007 act = purple_plugin_action_new(_("Join User in Chat..."),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4008 yahoo_show_chat_goto);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4010
18743
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
4011 m = g_list_append(m, NULL);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
4012 act = purple_plugin_action_new(_("Open Inbox"),
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
4013 yahoo_show_inbox);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
4014 m = g_list_append(m, act);
dbaf12fb6ac7 Add "Open Inbox" account action to the yahoo prpl that logs your browser into your yahoo account and opens your inbox.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18650
diff changeset
4015
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4016 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4017 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4018
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4019 struct yahoo_sms_carrier_cb_data {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4020 PurpleConnection *gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4021 char *who;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4022 char *what;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4023 };
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4024
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4025 static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4026
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4027 static void yahoo_get_sms_carrier_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4028 const gchar *webdata, size_t len, const gchar *error_message)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4029 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4030 struct yahoo_sms_carrier_cb_data *sms_cb_data = user_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4031 PurpleConnection *gc = sms_cb_data->gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4032 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4033 char *mobile_no = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4034 char *status = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4035 char *carrier = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4036 PurpleAccount *account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4037 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4038
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4039 if (error_message != NULL) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4040 purple_conversation_write(conv, NULL, "Cant send SMS, Unable to obtain mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4041
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4042 g_free(sms_cb_data->who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4043 g_free(sms_cb_data->what);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4044 g_free(sms_cb_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4045 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4046 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4047 else if (len > 0 && webdata && *webdata) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4048 xmlnode *validate_data_root = xmlnode_from_str(webdata, -1);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4049 xmlnode *validate_data_child = xmlnode_get_child(validate_data_root, "mobile_no");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4050 mobile_no = (char *)xmlnode_get_attrib(validate_data_child, "msisdn");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4051
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4052 validate_data_root = xmlnode_copy(validate_data_child);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4053 validate_data_child = xmlnode_get_child(validate_data_root, "status");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4054 status = xmlnode_get_data(validate_data_child);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4055
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4056 validate_data_child = xmlnode_get_child(validate_data_root, "carrier");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4057 carrier = xmlnode_get_data(validate_data_child);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4058
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4059 purple_debug_info("yahoo","SMS validate data: Mobile:%s, Status:%s, Carrier:%s\n", mobile_no, status, carrier);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4060
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4061 if( strcmp(status, "Valid") == 0) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4062 g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup(carrier));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4063 yahoo_send_im(sms_cb_data->gc, sms_cb_data->who, sms_cb_data->what, PURPLE_MESSAGE_SEND);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4064 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4065 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4066 g_hash_table_insert(yd->sms_carrier, g_strdup_printf("+%s", mobile_no), g_strdup("Unknown"));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4067 purple_conversation_write(conv, NULL, "Cant send SMS, Unknown mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4068 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4069
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4070 xmlnode_free(validate_data_child);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4071 xmlnode_free(validate_data_root);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4072 g_free(sms_cb_data->who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4073 g_free(sms_cb_data->what);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4074 g_free(sms_cb_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4075 g_free(mobile_no);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4076 g_free(status);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4077 g_free(carrier);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4078 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4079 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4080
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4081 static void yahoo_get_sms_carrier(PurpleConnection *gc, gpointer data)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4082 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4083 struct yahoo_data *yd = gc->proto_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4084 PurpleUtilFetchUrlData *url_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4085 struct yahoo_sms_carrier_cb_data *sms_cb_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4086 char *validate_request_str = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4087 char *request = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4088 gboolean use_whole_url = FALSE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4089 xmlnode *validate_request_root = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4090 xmlnode *validate_request_child = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4091
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4092 if(!(sms_cb_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4093 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4094
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4095 validate_request_root = xmlnode_new("validate");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4096 xmlnode_set_attrib(validate_request_root, "intl", "us");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4097 xmlnode_set_attrib(validate_request_root, "version", YAHOO_CLIENT_VERSION);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4098 xmlnode_set_attrib(validate_request_root, "qos", "0");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4099
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4100 validate_request_child = xmlnode_new_child(validate_request_root, "mobile_no");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4101 xmlnode_set_attrib(validate_request_child, "msisdn", sms_cb_data->who + 1);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4102
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4103 validate_request_str = xmlnode_to_str(validate_request_root, NULL);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4104
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4105 xmlnode_free(validate_request_child);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4106 xmlnode_free(validate_request_root);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4107
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4108 request = g_strdup_printf(
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4109 "POST /mobileno?intl=us&version=%s HTTP/1.1\r\n"
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4110 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n"
26909
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26907
diff changeset
4111 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n"
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4112 "Host: validate.msg.yahoo.com\r\n"
26627
98d8c336234d Fix two int/size_t format build warnings on 64-bit
Paul Aurich <paul@darkrain42.org>
parents: 26593
diff changeset
4113 "Content-Length: %" G_GSIZE_FORMAT "\r\n"
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4114 "Cache-Control: no-cache\r\n\r\n%s",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4115 YAHOO_CLIENT_VERSION, yd->cookie_t, yd->cookie_y, strlen(validate_request_str), validate_request_str);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4116
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4117 /* use whole URL if using HTTP Proxy */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4118 if ((gc->account->proxy_info) && (gc->account->proxy_info->type == PURPLE_PROXY_HTTP))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4119 use_whole_url = TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4120
27071
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
4121 url_data = purple_util_fetch_url_request_len_with_account(
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
4122 purple_connection_get_account(gc), YAHOO_SMS_CARRIER_URL, use_whole_url,
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26975
diff changeset
4123 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1,
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4124 yahoo_get_sms_carrier_cb, data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4125
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4126 g_free(request);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4127 g_free(validate_request_str);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4128
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4129 if (!url_data) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4130 PurpleAccount *account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4131 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, sms_cb_data->who, account);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4132 purple_conversation_write(conv, NULL, "Cant send SMS, Unable to obtain mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4133 g_free(sms_cb_data->who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4134 g_free(sms_cb_data->what);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4135 g_free(sms_cb_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4136 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4137 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4138
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4139 static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4140 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4141 struct yahoo_data *yd = gc->proto_data;
26245
2cc85ecc27ef initialize *pkt to NULL, remove a warning from the compiler
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26244
diff changeset
4142 struct yahoo_packet *pkt = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4143 char *msg = yahoo_html_to_codes(what);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4144 char *msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4145 gboolean utf8 = TRUE;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4146 PurpleWhiteboard *wb;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4147 int ret = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4148 YahooFriend *f = NULL;
24343
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4149 gsize lenb = 0;
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4150 glong lenc = 0;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4151 struct yahoo_p2p_data *p2p_data;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4152 gboolean msn = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4153 msg2 = yahoo_string_encode(gc, msg, &utf8);
24343
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4154
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4155 if(msg2) {
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4156 lenb = strlen(msg2);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4157 lenc = g_utf8_strlen(msg2, -1);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4158
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4159 if(lenb > YAHOO_MAX_MESSAGE_LENGTH_BYTES || lenc > YAHOO_MAX_MESSAGE_LENGTH_CHARS) {
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4160 purple_debug_info("yahoo", "Message too big. Length is %" G_GSIZE_FORMAT
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4161 " bytes, %ld characters. Max is %d bytes, %d chars."
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4162 " Message is '%s'.\n", lenb, lenc, YAHOO_MAX_MESSAGE_LENGTH_BYTES,
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4163 YAHOO_MAX_MESSAGE_LENGTH_CHARS, msg2);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4164 g_free(msg);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4165 g_free(msg2);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4166 return -E2BIG;
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4167 }
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24102
diff changeset
4168 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4169
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4170 msn = g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/");
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4171
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4172 if( strncmp(who, "+", 1) == 0 ) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4173 /* we have an sms to be sent */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4174 gchar *carrier = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4175 const char *alias = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4176 PurpleAccount *account = purple_connection_get_account(gc);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4177 PurpleConversation *conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4178
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4179 carrier = g_hash_table_lookup(yd->sms_carrier, who);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4180 if (!carrier) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4181 struct yahoo_sms_carrier_cb_data *sms_cb_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4182 sms_cb_data = g_malloc(sizeof(struct yahoo_sms_carrier_cb_data));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4183 sms_cb_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4184 sms_cb_data->who = g_malloc(strlen(who));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4185 sms_cb_data->what = g_malloc(strlen(what));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4186 strcpy(sms_cb_data->who, who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4187 strcpy(sms_cb_data->what, what);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4188
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4189 purple_conversation_write(conv, NULL, "Getting mobile carrier to send the sms", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4190
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4191 yahoo_get_sms_carrier(gc, sms_cb_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4192
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4193 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4194 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4195 return ret;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4196 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4197 else if( strcmp(carrier,"Unknown") == 0 ) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4198 purple_conversation_write(conv, NULL, "Cant send SMS, Unknown mobile carrier", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4199
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4200 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4201 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4202 return -1;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4203 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4204
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4205 alias = purple_account_get_alias(account);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4206 pkt = yahoo_packet_new(YAHOO_SERVICE_SMS_MSG, YAHOO_STATUS_AVAILABLE, 0);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4207 yahoo_packet_hash(pkt, "sssss",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4208 1, purple_connection_get_display_name(gc),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4209 69, alias,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4210 5, who + 1,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4211 68, carrier,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4212 14, msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4213 yahoo_packet_send_and_free(pkt, yd);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4214
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4215 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4216 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4217
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4218 return ret;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4219 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4220
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4221 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4222 if(msn) {
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4223 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who+4);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4224 yahoo_packet_hash_int(pkt, 241, 2);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4225 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4226 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4227 yahoo_packet_hash(pkt, "ss", 1, purple_connection_get_display_name(gc), 5, who);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4228 if ((f = yahoo_friend_find(gc, who)) && f->protocol)
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4229 yahoo_packet_hash_int(pkt, 241, f->protocol);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4230 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4231
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4232 if (utf8)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4233 yahoo_packet_hash_str(pkt, 97, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4234 yahoo_packet_hash_str(pkt, 14, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4235
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4236 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4237 * IMVironment.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4238 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4239 * If this message is to a user who is also Doodling with the local user,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4240 * format the chat packet with the correct IMV information (thanks Yahoo!)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4241 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4242 * Otherwise attempt to use the same IMVironment as the remote user,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4243 * just so that we don't inadvertantly reset their IMVironment back
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4244 * to nothing.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4245 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4246 * If they have no set an IMVironment, then use the default.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4247 */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4248 wb = purple_whiteboard_get_session(gc->account, who);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4249 if (wb)
18769
cddf062baa71 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 <daniel.atallah@gmail.com>
parents: 18763
diff changeset
4250 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4251 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4252 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4253 const char *imv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4254 imv = g_hash_table_lookup(yd->imvironments, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4255 if (imv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4256 yahoo_packet_hash_str(pkt, 63, imv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4257 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4258 yahoo_packet_hash_str(pkt, 63, ";0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4259 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4260
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4261 yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4262 yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4263 if (!yd->picture_url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4264 yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4265 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4266 yahoo_packet_hash_str(pkt, 206, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4268 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4269 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4270 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4271 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4272 yahoo_packet_hash_int(pkt, 11, p2p_data->session_id);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4273 yahoo_p2p_write_pkt(p2p_data->source, pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4274 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4275 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4276 yahoo_packet_send(pkt, yd);
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4277 if(!msn)
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4278 yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4279 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4280 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4281 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4282 ret = -E2BIG;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4283
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4284 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4285
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4286 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4287 g_free(msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4288
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4289 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4290 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4291
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4292 static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4293 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4294 struct yahoo_data *yd = gc->proto_data;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4295 struct yahoo_p2p_data *p2p_data;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4296 gboolean msn = (g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/"));
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4297 struct yahoo_packet *pkt = NULL;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4298
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4299 /* Don't do anything if sms is being typed */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4300 if( strncmp(who, "+", 1) == 0 )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4301 return 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4302
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4303 pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4304
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4305 /* check to see if p2p link exists, send through it */
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4306 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4307 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4308 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4309 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4310 yahoo_p2p_write_pkt(p2p_data->source, pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4311 yahoo_packet_free(pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4312 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4313 else { /* send through yahoo server */
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4314 if(msn)
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4315 yahoo_packet_hash(pkt, "sssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4316 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4317 5, who+4, 1002, "1", 241, "2");
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4318 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4319 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4320 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4321 5, who+4, 1002, "1");
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4322 yahoo_packet_send_and_free(pkt, yd);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4323 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4325 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4326 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4327
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328 static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 YahooFriend *f = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4331 if (f && f->presence == YAHOO_PRESENCE_ONLINE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4332 f->presence = YAHOO_PRESENCE_DEFAULT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4333 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4334
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4335 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4336 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4337 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4338 PurplePresence *presence;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4339 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4340 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4341 int old_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342 const char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4343 char *tmp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4344 char *conv_msg = NULL;
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
4345 gboolean utf8 = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4346
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4347 if (!purple_status_is_active(status))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4348 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4349
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4350 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4351 presence = purple_status_get_presence(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4352 yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 old_status = yd->current_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4354
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4355 yd->current_status = get_yahoo_status_from_purple_status(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4356
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4357 if (yd->current_status == YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4358 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4359 msg = purple_status_get_attr_string(status, "message");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4360
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4361 if (purple_status_is_available(status)) {
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
4362 tmp = yahoo_string_encode(gc, msg, &utf8);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4363 conv_msg = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4364 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4365 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4366 if ((msg == NULL) || (*msg == '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4367 msg = _("Away");
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
4368 tmp = yahoo_string_encode(gc, msg, &utf8);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4369 conv_msg = purple_markup_strip_html(tmp);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4370 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4371 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4372 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4374 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4375 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4376 yahoo_packet_hash_str(pkt, 13, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4377 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4378
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4379 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4382 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4383 yahoo_packet_hash_int(pkt, 10, yd->current_status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4384
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4385 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
18758
0a2059a1b0cc Did you know we didn't support i18n in Yahoo status messages? We do now! Fixes #2356
Sean Egan <seanegan@gmail.com>
parents: 18743
diff changeset
4386 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4387 yahoo_packet_hash_str(pkt, 19, conv_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4388 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4389 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4390 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4392 g_free(conv_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4393
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4394 if (purple_presence_is_idle(presence))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4395 yahoo_packet_hash_str(pkt, 47, "2");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4396 else if (!purple_status_is_available(status))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4397 yahoo_packet_hash_str(pkt, 47, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4398
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4399 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4400
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4401 if (old_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4402 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4403 yahoo_packet_hash_str(pkt, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4404 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4405
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4406 /* Any per-session presence settings are removed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4407 g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4408
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4409 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4410 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4411
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4412 static void yahoo_set_idle(PurpleConnection *gc, int idle)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4413 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4414 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4415 struct yahoo_packet *pkt = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4416 char *msg = NULL, *msg2 = NULL;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4417 PurpleStatus *status = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4419 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4420 yd->current_status = YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4421 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4422 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4423 yd->current_status = get_yahoo_status_from_purple_status(status);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4426 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4428 yahoo_packet_hash_int(pkt, 10, yd->current_status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4429 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4430 const char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4431 if (status == NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4432 status = purple_presence_get_active_status(purple_account_get_presence(purple_connection_get_account(gc)));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4433 tmp = purple_status_get_attr_string(status, "message");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4434 if (tmp != NULL) {
26953
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26934
diff changeset
4435 gboolean utf8 = TRUE;
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26934
diff changeset
4436 msg = yahoo_string_encode(gc, tmp, &utf8);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4437 msg2 = purple_markup_strip_html(msg);
26953
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26934
diff changeset
4438 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4439 yahoo_packet_hash_str(pkt, 19, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4440 } else {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4441 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4442 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4443 yahoo_packet_hash_str(pkt, 19, _("Away"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4444 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4445 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4446 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4447 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4448
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4449 if (idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4450 yahoo_packet_hash_str(pkt, 47, "2");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4451 else if (!purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc))))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4452 yahoo_packet_hash_str(pkt, 47, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4453
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4454 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4456 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4457 g_free(msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4458 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4459
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4460 static GList *yahoo_status_types(PurpleAccount *account)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4461 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4462 PurpleStatusType *type;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4463 GList *types = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4464
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4465 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4466 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4467 "message", _("Message"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4468 purple_value_new(PURPLE_TYPE_STRING), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4469 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4470
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4471 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4472 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4473 "message", _("Message"),
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4474 purple_value_new(PURPLE_TYPE_STRING), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4475 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4476
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4477 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4478 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4479
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4480 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4481 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4482
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4483 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4484 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4485
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4486 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4487 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4488
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4489 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4490 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4491
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4492 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4493 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4494
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4495 type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4496 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4497
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4498 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4499 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4500
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4501 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4502 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4503
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4504
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4505 type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4506 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4507
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4508 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4509 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4510
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4511 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE);
15525
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4512 types = g_list_append(types, type);
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15498
diff changeset
4513
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4514 return types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4515 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4516
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4517 static void yahoo_keepalive(PurpleConnection *gc)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4518 {
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4519 struct yahoo_packet *pkt;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4520 struct yahoo_data *yd = gc->proto_data;
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4521 time_t now = time(NULL);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4522
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4523 /* We're only allowed to send a ping once an hour or the servers will boot us */
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4524 if ((now - yd->last_ping) >= PING_TIMEOUT) {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4525 yd->last_ping = now;
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4526
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4527 /* The native client will only send PING or CHATPING */
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4528 if (yd->chat_online) {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4529 if (yd->wm) {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4530 ycht_chat_send_keepalive(yd->ycht);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4531 } else {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4532 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4533 yahoo_packet_hash_str(pkt, 109, purple_connection_get_display_name(gc));
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4534 yahoo_packet_send_and_free(pkt, yd);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4535 }
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4536 } else {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4537 pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4538 yahoo_packet_send_and_free(pkt, yd);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4539 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4541
24102
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4542 if ((now - yd->last_keepalive) >= KEEPALIVE_TIMEOUT) {
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4543 yd->last_keepalive = now;
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4544 pkt = yahoo_packet_new(YAHOO_SERVICE_KEEPALIVE, YAHOO_STATUS_AVAILABLE, 0);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4545 yahoo_packet_hash_str(pkt, 0, purple_connection_get_display_name(gc));
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4546 yahoo_packet_send_and_free(pkt, yd);
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4547 }
b5210bb72273 Only send a yahoo ping once an hour. The server doesn't like it when send it
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23970
diff changeset
4548
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4549 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4550
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4551 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4552 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4553 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4554 struct yahoo_packet *pkt;
19348
f0c4b4fdbd16 Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19299
diff changeset
4555 const char *group = NULL;
f0c4b4fdbd16 Add some additional yahoo keys to the stealth packets to make them work again. Fixes #2654.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19299
diff changeset
4556 char *group2;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
4557 YahooFriend *f;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4558 const char *bname;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4559 gboolean msn = FALSE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4560
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4561 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4562 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4563
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4564 bname = purple_buddy_get_name(buddy);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4565 if (!purple_privacy_check(purple_connection_get_account(gc), bname))
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4566 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4567
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4568 f = yahoo_friend_find(gc, bname);
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4569 msn = g_str_has_prefix(bname, "msn/") || g_str_has_prefix(bname, "MSN/");
19358
b3901a15147a Fully fix #2654 by parsing the yahoo stealth information from the buddy list at logon time.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19348
diff changeset
4570
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4571 g = purple_buddy_get_group(buddy);
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4572 if (g)
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4573 group = purple_group_get_name(g);
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4574 else
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4575 group = "Buddies";
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4576
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4577 group2 = yahoo_string_encode(gc, group, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4578 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4579 if(msn) {
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4580 yahoo_packet_hash(pkt, "sssssssssss",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4581 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4582 65, group2,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4583 97, "1",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4584 1, purple_connection_get_display_name(gc),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4585 302, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4586 300, "319",
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4587 7, bname + 4,
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4588 241, "2",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4589 334, "0",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4590 301, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4591 303, "319"
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4592 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4593 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4594 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4595 yahoo_packet_hash(pkt, "ssssssssss",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4596 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4597 65, group2,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4598 97, "1",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4599 1, purple_connection_get_display_name(gc),
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4600 302, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4601 300, "319",
26254
7114d475a9e7 propagate from branch 'im.pidgin.pidgin' (head aa9e255d8e32921a2fe4e6bd74fe36d1ffdc9ec1)
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26253 25416
diff changeset
4602 7, bname,
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4603 334, "0",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4604 301, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4605 303, "319"
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4606 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4607 }
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4608 if (f && f->protocol && !msn)
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
4609 yahoo_packet_hash_int(pkt, 241, f->protocol);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4610
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4611 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4612 g_free(group2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4613 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4614
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4615 static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4616 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4617 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4618 struct yahoo_packet *pkt;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4619 GSList *buddies, *l;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4620 PurpleGroup *g;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4621 gboolean remove = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4622 char *cg;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4623 const char *bname, *gname;
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4624 YahooFriend *f = NULL;
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4625 gboolean msn = FALSE;
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4626
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4627 bname = purple_buddy_get_name(buddy);
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4628 f = yahoo_friend_find(gc, bname);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4629 if (!f)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4630 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4631
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4632 gname = purple_group_get_name(group);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4633 buddies = purple_find_buddies(purple_connection_get_account(gc), bname);
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4634 if(f->protocol == 2)
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4635 msn = TRUE;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4636 for (l = buddies; l; l = l->next) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4637 g = purple_buddy_get_group(l->data);
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4638 if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4639 remove = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4640 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4641 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4642 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4643
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4644 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4645
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4646 if (remove)
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4647 g_hash_table_remove(yd->friends, bname);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4648
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4649 cg = yahoo_string_encode(gc, gname, NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4650 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4651
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4652 if(msn)
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4653 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
26253
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26252
diff changeset
4654 7, bname+4, 65, cg);
26242
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4655 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26241
diff changeset
4656 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4657 7, bname, 65, cg);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4658 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4659 yahoo_packet_hash_int(pkt, 241, f->protocol);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4660 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4661 g_free(cg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4662 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4663
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4664 static void yahoo_add_deny(PurpleConnection *gc, const char *who) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4665 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4666 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4668 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4669 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4670
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4671 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4672 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4673
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4674 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4675 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4676 7, who, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4677 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4678 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4679
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4680 static void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4681 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4682 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4683
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4684 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4685 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4687 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4688 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4690 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4691 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4692 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4693 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4694
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4695 static void yahoo_set_permit_deny(PurpleConnection *gc)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4696 {
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4697 PurpleAccount *account;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4698 GSList *deny;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4699
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4700 account = purple_connection_get_account(gc);
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4701
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4702 switch (account->perm_deny)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4703 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4704 case PURPLE_PRIVACY_ALLOW_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4705 for (deny = account->deny; deny; deny = deny->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4706 yahoo_rem_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4707 break;
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4708
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4709 case PURPLE_PRIVACY_ALLOW_BUDDYLIST:
22245
31863f2d7c3c Our Yahoo! protocol has this crappy implementation where it tries
Mark Doliner <mark@kingant.net>
parents: 22243
diff changeset
4710 case PURPLE_PRIVACY_ALLOW_USERS:
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4711 case PURPLE_PRIVACY_DENY_USERS:
22245
31863f2d7c3c Our Yahoo! protocol has this crappy implementation where it tries
Mark Doliner <mark@kingant.net>
parents: 22243
diff changeset
4712 case PURPLE_PRIVACY_DENY_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4713 for (deny = account->deny; deny; deny = deny->next)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4714 yahoo_add_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4715 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4716 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4718
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4719 static gboolean yahoo_unload_plugin(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4720 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4721 yahoo_dest_colorht();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4723 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4724 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4725
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4726 static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4727 const char *old_group, const char *new_group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4728 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4729 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4730 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4731 char *gpn, *gpo;
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4732 YahooFriend *f = yahoo_friend_find(gc, who);
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4733 gboolean msn = FALSE;
26246
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4734 const char *temp = NULL;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4736 /* Step 0: If they aren't on the server list anyway,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4737 * don't bother letting the server know.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4738 */
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4739 if (!f)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4740 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4741
26907
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26906
diff changeset
4742 if(f->protocol == 2) {
26248
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26246
diff changeset
4743 msn = TRUE;
26246
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4744 temp = who+4;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4745 } else
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4746 temp = who;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4747
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4748 /* If old and new are the same, we would probably
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4749 * end up deleting the buddy, which would be bad.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4750 * This might happen because of the charset conversation.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4751 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4752 gpn = yahoo_string_encode(gc, new_group, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4753 gpo = yahoo_string_encode(gc, old_group, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4754 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4755 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4756 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4757 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4759
19189
07413ddcd49c Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents: 18769
diff changeset
4760 pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, 0);
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4761 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4762 yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc),
26246
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4763 302, "240", 300, "240", 7, temp, 241, f->protocol, 224, gpo, 264, gpn, 301,
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4764 "240", 303, "240");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4765 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4766 yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc),
26246
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26245
diff changeset
4767 302, "240", 300, "240", 7, temp, 224, gpo, 264, gpn, 301,
19189
07413ddcd49c Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents: 18769
diff changeset
4768 "240", 303, "240");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4769 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4770
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4771 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4772 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4773 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4774
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4775 static void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4776 PurpleGroup *group, GList *moved_buddies)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4777 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4778 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4779 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4780 char *gpn, *gpo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4781
24120
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24102
diff changeset
4782 gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4783 gpo = yahoo_string_encode(gc, old_name, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4784 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4785 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4786 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4787 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4788 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4790 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4791 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4792 65, gpo, 67, gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4793 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4794 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4795 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4796 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4797
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4798 /********************************* Commands **********************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4799
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4800 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4801 yahoopurple_cmd_buzz(PurpleConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4802 PurpleAccount *account = purple_conversation_get_account(c);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4803
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4804 if (*args && args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4805 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4806
23751
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23404
diff changeset
4807 purple_prpl_send_attention(account->gc, c->name, YAHOO_BUZZ);
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4808
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4809 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4810 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4811
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4812 static PurplePlugin *my_protocol = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4813
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4814 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4815 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4816 char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4817 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4818 GHashTable *comp;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4819 PurpleConnection *gc;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4820 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4821 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4823 if (!args || !args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4824 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4825
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4826 gc = purple_conversation_get_gc(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4827 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4828 id = yd->conf_id;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4829 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4830 "Trying to join %s \n", args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4831
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4832 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
24865
b26e8a41a937 Plug a small leak
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24539
diff changeset
4833 g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1));
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4834 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4836 yahoo_c_join(gc, comp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4838 g_hash_table_destroy(comp);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4839 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4840 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4841
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4842 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4843 yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4844 char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4845 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4846 PurpleAccount *account = purple_conversation_get_account(conv);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4847 if (*args && args[0])
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4848 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4849 purple_roomlist_show_with_account(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4850 return PURPLE_CMD_RET_OK;
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4851 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4852
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4853 static gboolean yahoo_offline_message(const PurpleBuddy *buddy)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4854 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4855 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4856 }
20589
5723dbc6212d 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 <daniel.atallah@gmail.com>
parents: 19718
diff changeset
4857
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4858 gboolean yahoo_send_attention(PurpleConnection *gc, const char *username, guint type)
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4859 {
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4860 PurpleConversation *c;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4861
20589
5723dbc6212d 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 <daniel.atallah@gmail.com>
parents: 19718
diff changeset
4862 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM,
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4863 username, gc->account);
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4864
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4865 g_return_val_if_fail(c != NULL, FALSE);
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4866
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4867 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4868 "Sending <ding> on account %s to buddy %s.\n", username, c->name);
19511
ea26d30449fd Add a new flag PURPLE_MESSAGE_INVISIBLE which can be used to send a message
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19465
diff changeset
4869 purple_conv_im_send_with_flags(PURPLE_CONV_IM(c), "<ding>", PURPLE_MESSAGE_INVISIBLE);
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4870
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4871 return TRUE;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4872 }
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4873
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4874 GList *yahoo_attention_types(PurpleAccount *account)
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4875 {
19465
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
4876 static GList *list = NULL;
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
4877
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
4878 if (!list) {
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4879 /* Yahoo only supports one attention command: the 'buzz'. */
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4880 /* This is index number YAHOO_BUZZ. */
22097
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22080
diff changeset
4881 list = g_list_append(list, purple_attention_type_new("Buzz", _("Buzz"),
eab7d03edfcb This adds accessor and mutator API for the PurpleAttentionType struct.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22080
diff changeset
4882 _("%s has buzzed you!"), _("Buzzing %s...")));
20589
5723dbc6212d 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 <daniel.atallah@gmail.com>
parents: 19718
diff changeset
4883 }
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4884
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4885 return list;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4886 }
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4887
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4888 /************************** Plugin Initialization ****************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4889 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4890 yahoopurple_register_commands(void)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4891 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4892 purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4893 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4894 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4895 "prpl-yahoo", yahoopurple_cmd_chat_join,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4896 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4897 purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4898 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4899 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4900 "prpl-yahoo", yahoopurple_cmd_chat_list,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4901 _("list: List rooms on the Yahoo network"), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4902 purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4903 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4904 "prpl-yahoo", yahoopurple_cmd_buzz,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4905 _("buzz: Buzz a user to get their attention"), NULL);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4906 purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4907 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4908 "prpl-yahoo", yahoo_doodle_purple_cmd_start,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4909 _("doodle: Request user to start a Doodle session"), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4910 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4911
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4912 static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4913 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4914 PurpleAccount *acct = NULL;
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4915
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4916 /* If we have a specific acct, use it */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4917 if (acct_id) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4918 acct = purple_accounts_find(acct_id, prpl);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4919 if (acct && !purple_account_is_connected(acct))
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4920 acct = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4921 } else { /* Otherwise find an active account for the protocol */
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4922 GList *l = purple_accounts_get_all();
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4923 while (l) {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4924 if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4925 && purple_account_is_connected(l->data)) {
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4926 acct = l->data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4927 break;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4928 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4929 l = l->next;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4930 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4931 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4932
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4933 return acct;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4934 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4935
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4936 /* This may not be the best way to do this, but we find the first key w/o a value
25416
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 25382
diff changeset
4937 * and assume it is the buddy name */
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4938 static void yahoo_find_uri_novalue_param(gpointer key, gpointer value, gpointer user_data)
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4939 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4940 char **retval = user_data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4941
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4942 if (value == NULL && *retval == NULL) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4943 *retval = key;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4944 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4945 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4946
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4947 static gboolean yahoo_uri_handler(const char *proto, const char *cmd, GHashTable *params)
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4948 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4949 char *acct_id = g_hash_table_lookup(params, "account");
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4950 PurpleAccount *acct;
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4951
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4952 if (g_ascii_strcasecmp(proto, "ymsgr"))
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4953 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4954
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4955 acct = find_acct(purple_plugin_get_id(my_protocol), acct_id);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4956
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4957 if (!acct)
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4958 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4959
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4960 /* ymsgr:SendIM?screename&m=The+Message */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4961 if (!g_ascii_strcasecmp(cmd, "SendIM")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4962 char *sname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4963 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &sname);
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4964 if (sname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4965 char *message = g_hash_table_lookup(params, "m");
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4966
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4967 PurpleConversation *conv = purple_find_conversation_with_account(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4968 PURPLE_CONV_TYPE_IM, sname, acct);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4969 if (conv == NULL)
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4970 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4971 purple_conversation_present(conv);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4972
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4973 if (message) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4974 /* Spaces are encoded as '+' */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4975 g_strdelimit(message, "+", ' ');
18642
3f0204c58dfa Don't actually send messages using the protocol handlers (open the window and pre-populate the message, but require the user to actually send the message). Fixes #1961.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 18063
diff changeset
4976 purple_conv_send_confirm(conv, message);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4977 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4978 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4979 /* else
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4980 **If pidgindialogs_im() was in the core, we could use it here.
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4981 * It is all purple_request_* based, but I'm not sure it really belongs in the core
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4982 pidgindialogs_im(); */
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4983
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4984 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4985 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4986 /* ymsgr:Chat?roomname */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4987 else if (!g_ascii_strcasecmp(cmd, "Chat")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4988 char *rname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4989 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &rname);
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4990 if (rname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4991 /* This is somewhat hacky, but the params aren't useful after this command */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4992 g_hash_table_insert(params, g_strdup("room"), g_strdup(rname));
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4993 g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat"));
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4994 serv_join_chat(purple_account_get_connection(acct), params);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4995 }
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
4996 /* else
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
4997 ** Same as above (except that this would have to be re-written using purple_request_*)
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4998 pidgin_blist_joinchat_show(); */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
4999
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5000 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5001 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5002 /* ymsgr:AddFriend?name */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5003 else if (!g_ascii_strcasecmp(cmd, "AddFriend")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5004 char *name = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5005 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name);
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5006 purple_blist_request_add_buddy(acct, name, NULL, NULL);
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5007 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5008 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5009
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5010 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5011 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5012
23970
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5013 static GHashTable *
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5014 yahoo_get_account_text_table(PurpleAccount *account)
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5015 {
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5016 GHashTable *table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5017 table = g_hash_table_new(g_str_hash, g_str_equal);
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5018 g_hash_table_insert(table, "login_label", (gpointer)_("Yahoo ID..."));
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5019 return table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5020 }
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5021
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5022 static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5023 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5024 yahoo_doodle_start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5025 yahoo_doodle_end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5026 yahoo_doodle_get_dimensions,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028 yahoo_doodle_get_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5029 yahoo_doodle_set_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5030 yahoo_doodle_send_draw_list,
16675
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5031 yahoo_doodle_clear,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5032
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5033 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5034 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5035 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5036 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5037 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5038 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5039
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5040 static PurplePluginProtocolInfo prpl_info =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5042 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5043 NULL, /* user_splits */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5044 NULL, /* protocol_options */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5045 {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND},
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5046 yahoo_list_icon,
15463
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15383
diff changeset
5047 yahoo_list_emblem,
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5048 yahoo_status_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5049 yahoo_tooltip_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5050 yahoo_status_types,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5051 yahoo_blist_node_menu,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5052 yahoo_c_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5053 yahoo_c_info_defaults,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5054 yahoo_login,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5055 yahoo_close,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5056 yahoo_send_im,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5057 NULL, /* set info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5058 yahoo_send_typing,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5059 yahoo_get_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5060 yahoo_set_status,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5061 yahoo_set_idle,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5062 NULL, /* change_passwd*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5063 yahoo_add_buddy,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5064 NULL, /* add_buddies */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5065 yahoo_remove_buddy,
26238
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26236
diff changeset
5066 NULL, /* remove_buddies */
22242
d5b65bead569 Yahoo! has no permit list, so get rid of the add_permit and rem_permit prpl
Mark Doliner <mark@kingant.net>
parents: 22239
diff changeset
5067 NULL, /* add_permit */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5068 yahoo_add_deny,
22242
d5b65bead569 Yahoo! has no permit list, so get rid of the add_permit and rem_permit prpl
Mark Doliner <mark@kingant.net>
parents: 22239
diff changeset
5069 NULL, /* rem_permit */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5070 yahoo_rem_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5071 yahoo_set_permit_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5072 yahoo_c_join,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5073 NULL, /* reject chat invite */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5074 yahoo_get_chat_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5075 yahoo_c_invite,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5076 yahoo_c_leave,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5077 NULL, /* chat whisper */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5078 yahoo_c_send,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5079 yahoo_keepalive,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5080 NULL, /* register_user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5081 NULL, /* get_cb_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5082 NULL, /* get_cb_away */
18763
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
5083 yahoo_update_alias, /* alias_buddy */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5084 yahoo_change_buddys_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5085 yahoo_rename_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5086 NULL, /* buddy_free */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5087 NULL, /* convo_closed */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5088 purple_normalize_nocase, /* normalize */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5089 yahoo_set_buddy_icon,
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5090 NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5091 NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5092 NULL, /* set_chat_topic */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5093 NULL, /* find_blist_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5094 yahoo_roomlist_get_list,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5095 yahoo_roomlist_cancel,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5096 yahoo_roomlist_expand_category,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5097 NULL, /* can_receive_file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5098 yahoo_send_file,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5099 yahoo_new_xfer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5100 yahoo_offline_message, /* offline_message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5101 &yahoo_whiteboard_prpl_ops,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5102 NULL, /* send_raw */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5103 NULL, /* roomlist_room_serialize */
19488
ebe2d2e71223 Fixed merge errors stemming from the fact that the main branch and my branch both added something to the prpl struct
Andreas Monitzer <pidgin@monitzer.com>
parents: 19465
diff changeset
5104 NULL, /* unregister_user */
16675
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5105
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5106 yahoo_send_attention,
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5107 yahoo_attention_types,
16675
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5108
23111
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22666
diff changeset
5109 sizeof(PurplePluginProtocolInfo), /* struct_size */
23970
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23916
diff changeset
5110 yahoo_get_account_text_table, /* get_account_text_table */
25657
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23113 25637
diff changeset
5111 NULL, /* initiate_media */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23113 25637
diff changeset
5112 NULL /* can_do_media */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5113 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5114
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5115 static PurplePluginInfo info =
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5116 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5117 PURPLE_PLUGIN_MAGIC,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5118 PURPLE_MAJOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5119 PURPLE_MINOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5120 PURPLE_PLUGIN_PROTOCOL, /**< type */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5121 NULL, /**< ui_requirement */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5122 0, /**< flags */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5123 NULL, /**< dependencies */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5124 PURPLE_PRIORITY_DEFAULT, /**< priority */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5125 "prpl-yahoo", /**< id */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126 "Yahoo", /**< name */
21030
3cc856ca2338 Add a --with-extraversion option to ./configure so packagers can fine tune
Stu Tomlinson <stu@nosnilmot.com>
parents: 20687
diff changeset
5127 DISPLAY_VERSION, /**< version */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5128 /** summary */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5129 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5130 /** description */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5131 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5132 NULL, /**< author */
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5133 PURPLE_WEBSITE, /**< homepage */
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5134 NULL, /**< load */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5135 yahoo_unload_plugin, /**< unload */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5136 NULL, /**< destroy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5137 NULL, /**< ui_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5138 &prpl_info, /**< extra_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5139 NULL,
16675
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5140 yahoo_actions,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5141
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5142 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5143 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5144 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5145 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16530
diff changeset
5146 NULL
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5149 static void
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5150 init_plugin(PurplePlugin *plugin)
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5151 {
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5152 PurpleAccountOption *option;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5153
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5154 option = purple_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5155 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5156
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5157 option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5158 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5159
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5160 option = purple_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5161 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5163 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5164 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5165
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5166 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5167 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5169 option = purple_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5170 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5171
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5172 option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5173 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5174
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5175 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5176 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5177
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5178 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5179 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5180
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5181 option = purple_account_option_string_new(_("Encoding"), "local_charset", "ISO-8859-1");
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5182 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5183
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5185 #if 0
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5186 option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5187 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5188
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5189 option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5190 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5191
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5192 option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5193 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5194 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5195
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5196 my_protocol = plugin;
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5197 yahoopurple_register_commands();
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5198 yahoo_init_colorht();
15624
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15525
diff changeset
5199
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5200 purple_signal_connect(purple_get_core(), "uri-handler", plugin,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5201 PURPLE_CALLBACK(yahoo_uri_handler), NULL);
15374
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5202 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5203
15823
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15744
diff changeset
5204 PURPLE_INIT_PLUGIN(yahoo, init_plugin, info);