annotate libpurple/protocols/yahoo/yahoo.c @ 27117:e6eee2b3417c

Pass a handle to purple_proxy_connect() when making this connection. This causes the proxy attempt to be canceled and freed if the user signs off before the connection is established.
author Mark Doliner <mark@kingant.net>
date Thu, 18 Jun 2009 22:40:12 +0000
parents 510f07e1f5c1
children 3ea4e638ce81
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1 /*
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2 * purple
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3 *
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4 * Purple is the legal property of its developers, whose names are too numerous
15373
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
19681
44b4e8bd759b The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19673
diff changeset
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
15373
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"
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
31 #include "core.h"
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
32 #include "debug.h"
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
33 #include "network.h"
15373
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"
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
42 #include "xmlnode.h"
15373
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"
15373
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
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
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: 15623
diff changeset
57
24171
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: 24040
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: 24040
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: 24040
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: 24040
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: 24040
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: 24040
diff changeset
63
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
64 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *, PurpleGroup *);
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
65 #ifdef TRY_WEBMESSENGER_LOGIN
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
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);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
67 #endif /* TRY_WEBMESSENGER_LOGIN */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
68 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
69
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
70 static void yahoo_update_status(PurpleConnection *gc, const char *name, YahooFriend *f)
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
74 if (!gc || !name || !f || !purple_find_buddy(purple_connection_get_account(gc), name))
15373
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:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
124 purple_debug_warning("yahoo", "Warning, unknown status %d\n", f->status);
15373
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)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
130 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, "message",
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
133 purple_prpl_got_user_status(purple_connection_get_account(gc), name, status, NULL);
15373
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)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
137 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, TRUE, f->idle);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
139 purple_prpl_got_user_idle(purple_connection_get_account(gc), name, FALSE, 0);
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
140
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
141 if (f->sms)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
142 purple_prpl_got_user_status(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE, NULL);
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
143 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
144 purple_prpl_got_user_status_deactive(purple_connection_get_account(gc), name, YAHOO_STATUS_TYPE_MOBILE);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
147 static void yahoo_process_status(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
148 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
149 PurpleAccount *account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
150 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
151 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
152 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
153 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
154 char *message = NULL;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
155 char *msn_name = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
156
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
157 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: 19719
diff changeset
158 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: 19719
diff changeset
159 purple_account_set_password(account, NULL);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
160 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: 19719
diff changeset
161 _("You have signed on from another location."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
162 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
163 }
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
167
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
168 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 case 0: /* we won't actually do anything with this */
27028
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
170 case 1: /* we won't actually do anything with this */
15373
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 8: /* how many online buddies we have */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 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
175 /* 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
176 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
177 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
178 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
179 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
180 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
181 }
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
182 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
183 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
184 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
185 name = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 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
187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 case 10: /* state */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 break;
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 f->status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194 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
195 f->away = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 f->away = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 if (f->status == YAHOO_STATUS_IDLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
200 /* 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
201 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
202 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
203 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
204 f->idle = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
205
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
206 if (f->status != YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
207 yahoo_friend_set_status_message(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
208
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
209 f->sms = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
210 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 case 19: /* custom message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
212 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
213 message = pair->value;
15373
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 case 11: /* this is the buddy's session id */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
216 if (f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
217 f->session_id = strtol(pair->value, NULL, 10);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 case 17: /* in chat? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
220 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 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
222 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 /* 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
226 * 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
227 * mean idle. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 if (f->status == YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
230
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
231 f->away = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 if (f->away == 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233 /* 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
234 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
238 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 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
240 if (!f)
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
243 if (f->idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 f->idle = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
245 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
246 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
247 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
248 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
250 if (f->status != YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
251 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
252 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 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
254 if (strtol(pair->value, NULL, 10) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 f->status = YAHOO_STATUS_OFFLINE;
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
257 if (name) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
258 purple_prpl_got_user_status(account, name, "offline", NULL);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
259 purple_prpl_got_user_status_deactive(account, name, YAHOO_STATUS_TYPE_MOBILE);
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
260 }
15373
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
263 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
264 case 60: /* SMS */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
265 if (f) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 f->sms = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 case 197: /* Avatars */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
272 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274 gsize len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 if (pair->value) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
277 decoded = purple_base64_decode(pair->value, &len);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 if (len) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
279 tmp = purple_str_binary_to_ascii(decoded, len);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
280 purple_debug_info("yahoo", "Got key 197, value = %s\n", tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
282 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
283 g_free(decoded);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
285 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 case 192: /* Pictures, aka Buddy Icons, checksum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 {
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
289 /* 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
290 * FIXME: fix up the strtol() stuff if possible. */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 int cksum = strtol(pair->value, NULL, 10);
16522
0b49b01e9482 Thanks to Bleeter, yahoo will not crash for non-existent buddyicons anymore.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 16475
diff changeset
292 const char *locksum = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
293 PurpleBuddy *b;
15373
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 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
298 b = purple_find_buddy(gc->account, name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300 if (!cksum || (cksum == -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
302 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
303 purple_buddy_icons_set_for_user(gc->account, name, NULL, 0, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
304 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 if (!f)
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 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
17043
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16987
diff changeset
311 if (b) {
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16987
diff changeset
312 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: 16987
diff changeset
313 if (!locksum || (cksum != strtol(locksum, NULL, 10)))
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16987
diff changeset
314 yahoo_send_picture_request(gc, name);
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16987
diff changeset
315 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
317 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
318 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319 case 16: /* Custom error message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 char *tmp = yahoo_string_decode(gc, pair->value, TRUE);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
322 purple_notify_error(gc, NULL, tmp, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
323 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
324 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 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
326 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
327 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
328 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
329 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
330 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
331 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
332 break;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
333 case 241: /* protocol buddy belongs to */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
334 if(strtol(pair->value, NULL, 10) == 2) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
335 msn_name = g_strconcat("msn/", name, NULL);
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
336 name = msn_name;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
337 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
338 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
339 default:
22668
3378d2701c2b I don't consider this an error.
Mark Doliner <mark@kingant.net>
parents: 22424
diff changeset
340 purple_debug_warning("yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341 "Unknown status key %d\n", pair->key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 break;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
347
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
348 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
349 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
350
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
351 if (name && f) /* update the last buddy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
352 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
353 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
354
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
355 static void yahoo_do_group_check(PurpleAccount *account, GHashTable *ht, const char *name, const char *group)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
356 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
357 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
358 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
359 GSList *list, *i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
360 gboolean onlist = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
361 char *oname = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
362 char **oname_p = &oname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
363 GSList **list_p = &list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
365 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: 15743
diff changeset
366 list = purple_find_buddies(account, name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 g_hash_table_steal(ht, name);
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 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 b = i->data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
372 g = purple_buddy_get_group(b);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
373 if (!purple_utf8_strcasecmp(group, purple_group_get_name(g))) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
374 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
375 "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
376 list = g_slist_delete_link(list, i);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 onlist = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
380 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
381
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
382 if (!onlist) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
383 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
385 if (!(g = purple_find_group(group))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
386 g = purple_group_new(group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
387 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
389 b = purple_buddy_new(account, name, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
390 purple_blist_add_buddy(b, NULL, g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
391 }
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 if (list) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394 if (!oname)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
395 oname = g_strdup(purple_normalize(account, name));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 g_hash_table_insert(ht, oname, list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
397 } else if (oname)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
398 g_free(oname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
399 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
401 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
402 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 char *name = key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 GSList *list = value, *i;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
405 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
406 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
408 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 b = i->data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
410 g = purple_buddy_get_group(b);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
411 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: 24171
diff changeset
412 purple_group_get_name(g));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
413 purple_blist_remove_buddy(b);
15373
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417 static char *_getcookie(char *rawcookie)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 char *cookie = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
420 char *tmpcookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
421 char *cookieend;
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 if (strlen(rawcookie) < 2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425 tmpcookie = g_strdup(rawcookie+2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 cookieend = strchr(tmpcookie, ';');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
427
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 if (cookieend)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 *cookieend = '\0';
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 cookie = g_strdup(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432 g_free(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 return cookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
435 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
436
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
437 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
438 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 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
440 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
441 g_free(yd->cookie_y);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 yd->cookie_y = _getcookie(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 } 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
444 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
445 g_free(yd->cookie_t);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 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
447 } else
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
448 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
449 yd->cookies = g_slist_prepend(yd->cookies, g_strdup(c));
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
452 static void yahoo_process_list_15(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
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 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
456 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
457 struct yahoo_data *yd = gc->proto_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458 GHashTable *ht;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 char *norm_bud = NULL;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
460 char *temp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461 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
462 /* But what if you had no friends? */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
463 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
464 PurpleGroup *g;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
465 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: 26159
diff changeset
466 int stealth = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
469 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
470
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
472 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
473 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
475 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
476 case 302:
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
477 /* 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
478 * 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
479 * 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
480 * 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
481 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
482 if (pair->value && !strcmp(pair->value, "320")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
483 /* No longer in any group; this indicates the start of the ignore list. */
22416
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22330
diff changeset
484 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: 22330
diff changeset
485 yd->current_list15_grp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
487
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
488 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
489 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
490 if(temp != NULL) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
491 if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
492 norm_bud = g_strconcat("msn/", temp, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
493 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
494 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: 26159
diff changeset
495
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
496 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: 26159
diff changeset
497 /* 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: 26159
diff changeset
498 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: 26159
diff changeset
499 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: 26159
diff changeset
500 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: 26159
diff changeset
501 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: 26159
diff changeset
502 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: 26159
diff changeset
503 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
504 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: 26159
diff changeset
505 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: 26159
diff changeset
506 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
507 yahoo_do_group_check(account, ht, norm_bud, yd->current_list15_grp);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
508 if(protocol != 0) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
509 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: 26159
diff changeset
510 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: 26159
diff changeset
511 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
512 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: 26159
diff changeset
513 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: 26159
diff changeset
514
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
515 /* set p2p status not connected and no p2p packet sent */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
516 if(protocol == 0) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
517 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: 26159
diff changeset
518 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: 26159
diff changeset
519 } else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
520 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: 26159
diff changeset
521 } else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
522 /* 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: 26159
diff changeset
523 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: 26159
diff changeset
524 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: 26159
diff changeset
525 }
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
526
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
527 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: 26159
diff changeset
528 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: 26159
diff changeset
529 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: 26159
diff changeset
530 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: 26159
diff changeset
531 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
532 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
533 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
534 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
535 case 65: /* This is the group */
22416
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22330
diff changeset
536 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: 22330
diff changeset
537 yd->current_list15_grp = yahoo_string_decode(gc, pair->value, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
538 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
539 case 7: /* buddy's s/n */
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
540 temp = g_strdup(purple_normalize(account, pair->value));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
541 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
542 case 241: /* another protocol user */
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
543 protocol = strtol(pair->value, NULL, 10);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
544 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
545 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
546 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
547 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
548 case 317: /* Stealth Setting */
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
549 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
550 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
551 /* case 242: */ /* this seems related to 241 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
552 /* break; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
553 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
555
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
556 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
557
27028
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
558 /* Now that we have processed the buddy list, we can say yahoo has connected */
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
559 purple_connection_set_display_name(gc, purple_normalize(account, purple_account_get_username(account)));
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
560 purple_connection_set_state(gc, PURPLE_CONNECTED);
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
561 yd->logged_in = TRUE;
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
562 if (yd->picture_upload_todo) {
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
563 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
564 yd->picture_upload_todo = NULL;
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
565 }
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
566 yahoo_set_status(account, purple_account_get_active_status(account));
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
567 purple_debug_info("yahoo","Authentication: Connection established\n");
3acb76e56517 Set yahoo to connected after processing the buddy list, should help get rid of the bug reported by the adium user
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26995
diff changeset
568
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 g_hash_table_destroy(ht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
570 g_free(norm_bud);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
571 g_free(temp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
572 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
573
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
574 static void yahoo_process_list(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
575 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 gboolean export = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 gboolean got_serv_list = FALSE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
579 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
580 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 YahooFriend *f = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
582 PurpleAccount *account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
584 GHashTable *ht;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
585
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
586 char **lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
587 char **split;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
588 char **buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 char **tmp, **bud, *norm_bud;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 char *grp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
592 if (pkt->id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
593 yd->session_id = pkt->id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
595 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
596 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
598
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
599 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 case 87:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 if (!yd->tmp_serv_blist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 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
603 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604 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
605 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 case 88:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607 if (!yd->tmp_serv_ilist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 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
609 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 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
611 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 case 59: /* cookies, yum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 yahoo_process_cookie(yd, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
616 if (!yd->tmp_serv_plist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 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
618 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 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
620 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
622 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
624 if (pkt->status != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 if (yd->tmp_serv_blist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 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
629
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 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
631 for (tmp = lines; *tmp; tmp++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 split = g_strsplit(*tmp, ":", 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
633 if (!split)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 if (!split[0] || !split[1]) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639 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
640 buddies = g_strsplit(split[1], ",", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 for (bud = buddies; bud && *bud; bud++) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
642 norm_bud = g_strdup(purple_normalize(account, *bud));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 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
644
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
645 if (!(b = purple_find_buddy(account, norm_bud))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
646 if (!(g = purple_find_group(grp))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
647 g = purple_group_new(grp);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
648 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
650 b = purple_buddy_new(account, norm_bud, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
651 purple_blist_add_buddy(b, NULL, g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 export = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
653 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
655 yahoo_do_group_check(account, ht, norm_bud, grp);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
656 /* 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: 26154
diff changeset
657 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: 26154
diff changeset
658 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: 26154
diff changeset
659
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
660 g_free(norm_bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
661 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
663 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
664 g_free(grp);
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 g_strfreev(lines);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
667
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
668 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
669 yd->tmp_serv_blist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
670 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
671 g_hash_table_destroy(ht);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 if (yd->tmp_serv_ilist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 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
676 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 /* The server is already ignoring the user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 got_serv_list = TRUE;
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
679 purple_privacy_deny_add(account, *bud, 1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
680 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
681 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 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
684 yd->tmp_serv_ilist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
685 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
687 if (got_serv_list &&
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
688 ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
689 (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
690 (account->perm_deny != PURPLE_PRIVACY_ALLOW_USERS)))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 {
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
692 account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
693 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
694 account->username);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
695 }
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 if (yd->tmp_serv_plist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 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
699 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 f = yahoo_friend_find(gc, *bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
701 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
702 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
703 account->username, *bud);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
704 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
705 }
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 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 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
709 yd->tmp_serv_plist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 }
18763
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
712 /* 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
713 yahoo_fetch_aliases(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
715
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
716 /* 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: 26154
diff changeset
717 static void yahoo_process_notify(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
719 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 char *from = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
722 char *stat = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723 char *game = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
725 GSList *l = pkt->hash;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
726 gint val_11 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
727 struct yahoo_data *yd = gc->proto_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
728 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
729 char *msn_from = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
730
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
731 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
732
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 struct yahoo_pair *pair = l->data;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
735 if (pair->key == 4 || pair->key == 1)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 if (pair->key == 49)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
739 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
740 stat = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
741 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
742 game = pair->value;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
743 if (pair->key == 11)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
744 val_11 = strtol(pair->value, NULL, 10);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
745 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: 26159
diff changeset
746 if(strtol(pair->value, NULL, 10) == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
747 msn = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
748 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 if (!from || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
754 /* 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: 26154
diff changeset
755 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: 26154
diff changeset
756 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: 26154
diff changeset
757 /* 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: 26154
diff changeset
758 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: 26154
diff changeset
759 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
760 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
761
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
762 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
763 msn_from = g_strconcat("msn/", from, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
764
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 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
766 && (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
767 {
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
768 if(msn) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
769 if (*stat == '1')
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
770 serv_got_typing(gc, msn_from, 0, PURPLE_TYPING);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
771 else
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
772 serv_got_typing_stopped(gc, msn_from);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
773 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
774 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
775 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: 26159
diff changeset
776 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: 26159
diff changeset
777 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
778 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: 26159
diff changeset
779 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
780 } 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
781 PurpleBuddy *bud = purple_find_buddy(account, from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
782
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
783 if (!bud) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
784 purple_debug(PURPLE_DEBUG_WARNING, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
785 "%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
786 "you to know.\n", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
788
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
789 f = yahoo_friend_find(gc, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
790 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
791 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
792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 yahoo_friend_set_game(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
795 if (*stat == '1') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 yahoo_friend_set_game(f, game);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
797 if (bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 yahoo_update_status(gc, from, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
799 }
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
800 } 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
801 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
802 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
803 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
804 g_free(buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
805 }
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
806
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
807 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 struct _yahoo_im {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 char *from;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
813 int time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
814 int utf8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
815 int buddy_icon;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
816 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
817 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
819 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: 26154
diff changeset
820 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
821 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
822 GSList *l = pkt->hash;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
823 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: 26154
diff changeset
824 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
825 char *server_msg = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
826 char *m;
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
827
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
828 yd = gc->proto_data;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
829 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: 26154
diff changeset
830
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
831 while (l != NULL) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
832 struct yahoo_pair *pair = l->data;
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
833 if (pair->key == 4) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
834 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: 26154
diff changeset
835 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: 26154
diff changeset
836 sms->time = time(NULL);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
837 sms->utf8 = TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
838 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
839 if (pair->key == 14) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
840 if (sms)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
841 sms->msg = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
842 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
843 if (pair->key == 68)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
844 if(sms)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
845 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: 26154
diff changeset
846 if (pair->key == 16)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
847 server_msg = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
848 l = l->next;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
849 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
850
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
851 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: 26824
diff changeset
852 if (server_msg) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
853 PurpleConversation *c;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
854 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: 26154
diff changeset
855 if (c == NULL)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
856 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: 26154
diff changeset
857 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: 26154
diff changeset
858 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
859 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
860 purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
861
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
862 g_free(sms->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
863 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
864 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
865 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
866
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
867 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: 26154
diff changeset
868 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
869 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
870 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
871
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
872 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: 26154
diff changeset
873 serv_got_im(gc, sms->from, m, 0, sms->time);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
874
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
875 g_free(m);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
876 g_free(sms->from);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
877 g_free(sms);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
878 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
879
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
880 /* 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: 26154
diff changeset
881 static void yahoo_process_message(PurpleConnection *gc, struct yahoo_packet *pkt, yahoo_pkt_type pkt_type)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
882 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
883 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
884 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
885 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
886 GSList *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
887 struct _yahoo_im *im = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
888 const char *imv = NULL;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
889 gint val_11 = 0;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
890 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
891 char *msn_from = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
892
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
893 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
894
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
895 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: 26154
diff changeset
896 /* messages are received with status YAHOO_STATUS_OFFLINE in case of p2p */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 while (l != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 struct yahoo_pair *pair = l->data;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
899 if (pair->key == 4 || pair->key == 1) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 im = g_new0(struct _yahoo_im, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 list = g_slist_append(list, im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
902 im->from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
903 im->time = time(NULL);
23283
ea998456c3bd Yahoo seems to always send messages encoded in utf-8 now. Hopefully this
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23111
diff changeset
904 im->utf8 = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
906 if (pair->key == 97)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
907 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
908 im->utf8 = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
909 if (pair->key == 15)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
910 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 im->time = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
912 if (pair->key == 206)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
913 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 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
915 if (pair->key == 14) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
917 im->msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 }
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
919 if (pair->key == 241) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
920 if(strtol(pair->value, NULL, 10) == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
921 msn = TRUE;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
922 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
923 /* peer session id */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
924 if (pair->key == 11) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
925 if (im)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
926 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: 26154
diff changeset
927 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
928 /* IMV key */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 if (pair->key == 63)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 imv = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
933 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
934 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
935 } else if (pkt->status == 2) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
936 purple_notify_error(gc, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
937 _("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
938 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
939
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
940 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
941 msn_from = g_strconcat("msn/", im->from, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
942
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
943 /* 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: 26154
diff changeset
944 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: 26154
diff changeset
945 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: 26154
diff changeset
946 /* 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: 26154
diff changeset
947 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: 26154
diff changeset
948 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
949 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
950
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
951 /** 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
952 /* Check for the Doodle IMV */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
953 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
954 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
955 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
956
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
957 if (strstr(imv, "doodle;") != NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
958 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
959 PurpleWhiteboard *wb;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
960
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
961 if (!purple_privacy_check(account, im->from)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
962 purple_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
963 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
965
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
966 /* 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
967
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
968 wb = purple_whiteboard_get_session(account, im->from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
969
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
970 /* 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
971 if(wb == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
972 {
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
973 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
974 wb = purple_whiteboard_create(account, im->from, DOODLE_STATE_REQUESTED);
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
975 ds = wb->proto_data;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
976 ds->imv_key = g_strdup(imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
977
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
978 yahoo_doodle_command_send_request(gc, im->from, imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
979 yahoo_doodle_command_send_ready(gc, im->from, imv);
15373
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
982 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
984 for (l = list; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
986 char *m, *m2;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
987 PurpleConversation *c;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
988 im = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
990 if (!im->from || !im->msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
991 g_free(im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
992 continue;
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
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
995 if (!purple_privacy_check(account, im->from)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
996 purple_debug_info("yahoo", "Message from %s dropped.\n", im->from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1000 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
1001 /* 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
1002 * 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
1003 * "\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
1004 * lines. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1005 m2 = purple_strreplace(m, "\r\n", "\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007 m = m2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1008 purple_util_chrreplace(m, '\r', '\n');
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1009
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1010 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, im->from, account);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1011 if ((c == NULL) && msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1012 c=purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, msn_from, account);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1013
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1014 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
1015 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
1016
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1017 if(c == NULL) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1018 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1019 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, msn_from);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1020 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1021 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: 26159
diff changeset
1022 }
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1023 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1024 username = g_markup_escape_text(msn_from, -1);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1025 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1026 username = g_markup_escape_text(im->from, -1);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
1027
23693
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23402
diff changeset
1028 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: 15822
diff changeset
1029 g_free(username);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1030 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1031 g_free(im);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1032 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1033 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1034 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1035
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1036 m2 = yahoo_codes_to_html(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1037 g_free(m);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1038
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1039 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1040 serv_got_im(gc, msn_from, m2, 0, im->time);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1041 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1042 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: 26159
diff changeset
1043
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 g_free(m2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1045
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
1046 /* laters : implement buddy icon for msn friends */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1047 if(!msn) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1048 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: 26159
diff changeset
1049 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: 26159
diff changeset
1050 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: 26159
diff changeset
1051 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: 26159
diff changeset
1052 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1054 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1055
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1056 g_free(im);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1057 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1059 g_slist_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1060 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1061
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1062 static void yahoo_process_sysmessage(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1063 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1064 GSList *l = pkt->hash;
16987
8e7a4295ff85 Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <stu@nosnilmot.com>
parents: 16985
diff changeset
1065 char *prim, *me = NULL, *msg = NULL;
15373
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068 struct yahoo_pair *pair = l->data;
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 if (pair->key == 5)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 me = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 msg = pair->value;
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 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1076 }
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 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
1079 return;
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 prim = g_strdup_printf(_("Yahoo! system message for %s:"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1082 me?me:purple_connection_get_display_name(gc));
16987
8e7a4295ff85 Finish removal of yahoo system message escaping. I must have been
Stu Tomlinson <stu@nosnilmot.com>
parents: 16985
diff changeset
1083 purple_notify_info(NULL, NULL, prim, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 g_free(prim);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087 struct yahoo_add_request {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1088 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090 char *who;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1091 int protocol;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1092 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1093
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1094 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1095 yahoo_buddy_add_authorize_cb(gpointer data)
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1096 {
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
1097 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
1098 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
1099 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
1100
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1101 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
1102 yahoo_packet_hash(pkt, "ssiii",
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1103 1, add_req->id,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1104 5, add_req->who,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1105 241, add_req->protocol,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1106 13, 1,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1107 334, 0);
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1108 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
1109
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1110 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1111 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1112 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1113 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1114
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1115 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1116 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
1117 {
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1118 struct yahoo_data *yd = add_req->gc->proto_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1119 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1120 char *encoded_msg = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1121 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
1122
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1123 if (msg && *msg)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 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
1125
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1126 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH_REQ_15,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127 YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1129 yahoo_packet_hash(pkt, "ssiiis",
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1130 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
1131 5, add_req->who,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1132 13, 2,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1133 334, 0,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1134 97, 1,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1135 14, encoded_msg ? encoded_msg : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1136
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1138
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1139 g_free(encoded_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1140
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1142 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1143 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1145
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1146 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1147 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
1148 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149 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
1150 }
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 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
1153 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
1154 struct yahoo_add_request *add_req = data;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1155 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
1156 NULL, _("No reason given."), TRUE, FALSE, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 _("OK"), G_CALLBACK(yahoo_buddy_add_deny_cb),
16439
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
1158 _("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
1159 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
1160 add_req);
15373
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
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1163 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
1164 {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1165 char *notify_msg;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1166 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
1167
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1168 if (who == NULL)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1169 return;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1170
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1171 if (reason != NULL) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1172 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
1173 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
1174 g_free(msg2);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1175 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1176 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
1177
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1178 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
1179 g_free(notify_msg);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1180
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1181 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
1182 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
1183 /* 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
1184 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1185
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1186 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
1187 PurpleAccount *account;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1188 GSList *l = pkt->hash;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1189 const char *msg = NULL;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1190 int protocol = 0;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1191
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1192 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
1193
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1194 /* Buddy authorized/declined our addition */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1195 if (pkt->status == 1) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1196 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: 26159
diff changeset
1197 char *who = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1198 int response = 0;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1199
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1200 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1201 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
1202
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1203 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1204 case 4:
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1205 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1206 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1207 case 13:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1208 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
1209 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1210 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1211 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1212 break;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1213 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: 26159
diff changeset
1214 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: 26159
diff changeset
1215 break;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1216 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1217 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
1218 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1219
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1220 if(protocol == 0)
26170
94ffdbdd16fb clear a double free bug
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26166
diff changeset
1221 who = g_strdup(temp);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1222 else if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1223 who = g_strconcat("msn/", temp, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1224
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1225 if (response == 1) /* Authorized */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1226 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
1227 else if (response == 2) { /* Declined */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1228 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
1229 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
1230 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1231 purple_debug_error("yahoo", "Received unknown authorization response of %d from buddy '%s'.\n", response, who ? who : "(Unknown Buddy)");
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1232 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
1233 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1234 /* 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
1235 else if (pkt->status == 3) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1236 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
1237 const char *firstname = NULL, *lastname = NULL;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1238 char *temp = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1239
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1240 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
1241 add_req->gc = gc;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1242
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1243 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1244 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
1245
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1246 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1247 case 4:
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1248 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1249 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
1250 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1251 case 5:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1252 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
1253 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1254 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1255 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1256 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1257 case 216:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1258 firstname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1259 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1260 case 241:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1261 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
1262 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1263 case 254:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1264 lastname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1265 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1266
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1267 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1268 l = l->next;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1269 }
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1270 if(add_req->protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1271 add_req->who = g_strconcat("msn/", temp, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1272 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1273 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
1274
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
1275 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
1276 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
1277
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1278 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
1279 {
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
1280 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
1281 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
1282 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
1283 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
1284 }
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
1285
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1286 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
1287 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
1288
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1289 if (firstname && lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1290 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
1291 else if (firstname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1292 alias = g_strdup(firstname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1293 else if (lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1294 alias = g_strdup(lastname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1295
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1296 /* 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
1297 * 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
1298 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1299 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
1300 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
1301 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
1302 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
1303 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
1304 add_req);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1305 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
1306 g_free(dec_msg);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1307 } else {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1308 g_free(add_req->id);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1309 g_free(add_req->who);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1310 g_free(add_req);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1311 }
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1312 } else {
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1313 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
1314 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1315 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1316
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 /* I don't think this happens anymore in Version 15 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1318 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
1319 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1320 struct yahoo_add_request *add_req;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1321 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1322 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1323
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1324 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
1325
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1326 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
1327 add_req->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1328
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1329 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1330 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1332 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 add_req->id = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1337 add_req->who = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1338 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 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
1340 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1344 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1345 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347
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
1348 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
1349 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
1350
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1351 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
1352 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
1353 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
1354 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
1355 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
1356 }
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
1357
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358 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
1359 dec_msg = yahoo_string_decode(gc, msg, FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1361 /* 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
1362 * 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
1363 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1364 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
1365 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
1366 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
1367 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
1368 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
1369 g_free(dec_msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1370 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1372 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1373 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1375 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1376
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1377 /* 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
1378 static void yahoo_buddy_denied_our_add_old(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1379 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1380 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1381 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1382 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 struct yahoo_pair *pair = l->data;
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 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1390 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1391 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1392 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 break;
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 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1396 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1397
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1398 yahoo_buddy_denied_our_add(gc, who, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1399 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1400
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1401 static void yahoo_process_contact(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 switch (pkt->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 yahoo_buddy_added_us(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410 case 7:
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1411 yahoo_buddy_denied_our_add_old(gc, pkt);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1414 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1415 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 #define OUT_CHARSET "utf-8"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 static char *yahoo_decode(const char *text)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422 char *converted = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 char *n, *new;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1424 const char *end, *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1425 int i, k;
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 n = new = g_malloc(strlen (text) + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 end = text + strlen(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430 for (p = text; p < end; p++, n++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 if (*p == '\\') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432 if (p[1] >= '0' && p[1] <= '7') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 p += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434 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
1435 char c = p[k];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 if (c < '0' || c > '7') break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 i *= 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 i += c - '0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1440 *n = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 p += k - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442 } else { /* bug 959248 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443 /* 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
1444 * 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
1445 * already eaten by some unknown function.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 * This is arguably broken.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1448 * 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
1449 * 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
1450 * 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
1451 * for you.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1452 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1453 *n = *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1457 *n = *p;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 *n = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1462 if (strstr(text, "\033$B"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1463 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
1464 if (!converted)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 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
1466 g_free(new);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1467
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1468 return converted;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1471 static void yahoo_process_mail(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1473 PurpleAccount *account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474 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
1475 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
1476 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
1477 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
1478 const char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1479 int count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1482 if (!purple_account_get_check_mail(account))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1484
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1485 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1486 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1487 if (pair->key == 9)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1488 count = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1489 else if (pair->key == 43)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1490 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1491 else if (pair->key == 42)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1492 email = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 else if (pair->key == 18)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494 subj = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1495 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1496 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1497
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1498 if (who && subj && email && *email) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 char *dec_who = yahoo_decode(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 char *dec_subj = yahoo_decode(subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 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
1502
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1503 purple_notify_email(gc, dec_subj, from, purple_account_get_username(account),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 yahoo_mail_url, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 g_free(dec_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 g_free(dec_subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 g_free(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 } else if (count > 0) {
26852
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26725
diff changeset
1510 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: 26725
diff changeset
1511 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: 26725
diff changeset
1512
0b97f73fa3d2 correctly NULL terminate all the arrays since that's what gtknotify assumes,
Ka-Hing Cheung <khc@hxbc.us>
parents: 26725
diff changeset
1513 purple_notify_emails(gc, count, FALSE, NULL, NULL, tos, urls,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1515 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1516 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1517
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1518 /* 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: 26725
diff changeset
1519 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: 26725
diff changeset
1520 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1521 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: 26725
diff changeset
1522 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: 26725
diff changeset
1523 };
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1524
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525 /* 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
1526 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1528 /* 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: 26725
diff changeset
1529 * in util.c, but it is different from the one yahoo uses */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 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
1531 /* 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
1532 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1533 for (; inlen >= 3; inlen -= 3)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1536 *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
1537 *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
1538 *out++ = base64digits[in[2] & 0x3f];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1539 in += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 if (inlen > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1542 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1543 unsigned char fragment;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 fragment = (in[0] << 4) & 0x30;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 if (inlen > 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 fragment |= in[1] >> 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549 *out++ = base64digits[fragment];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 *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
1551 *out++ = '-';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 *out = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1556 static void yahoo_auth16_stage3(PurpleConnection *gc, const char *crypt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1558 struct yahoo_data *yd = gc->proto_data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1559 PurpleAccount *account = purple_connection_get_account(gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1560 const char *name = purple_normalize(account, purple_account_get_username(account));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1561 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: 26725
diff changeset
1562 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: 26725
diff changeset
1563 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: 26725
diff changeset
1564 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: 26725
diff changeset
1565 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: 26725
diff changeset
1566
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1567 purple_debug_info("yahoo","Authentication: In yahoo_auth16_stage3\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1569 md5_cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1570 md5_ctx = purple_cipher_context_new(md5_cipher, NULL);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1571 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: 26824
diff changeset
1572 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest), md5_digest, NULL);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1573
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1574 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: 26725
diff changeset
1575
26995
1dcf9c7311f1 Yahoo auth ver 16: Use the current status of the account when logging in. Enables logging as invisible.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26989
diff changeset
1576 purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status);
1dcf9c7311f1 Yahoo auth ver 16: Use the current status of the account when logging in. Enables logging as invisible.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26989
diff changeset
1577 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, yd->session_id);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1578 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: 26725
diff changeset
1579 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: 26725
diff changeset
1580 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: 26725
diff changeset
1581 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: 26725
diff changeset
1582 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: 26725
diff changeset
1583 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: 26725
diff changeset
1584 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: 26725
diff changeset
1585 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: 26725
diff changeset
1586 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: 26725
diff changeset
1587 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: 26725
diff changeset
1588 } else {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1589 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: 26725
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: 26725
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: 26725
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: 26725
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: 26725
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: 26725
diff changeset
1595 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: 26725
diff changeset
1596 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: 26725
diff changeset
1597 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: 26725
diff changeset
1598 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: 26725
diff changeset
1599 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1600 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: 26725
diff changeset
1601 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: 26725
diff changeset
1602 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: 26725
diff changeset
1603
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1604 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: 26725
diff changeset
1605 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1606
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1607 static void yahoo_auth16_stage2(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message)
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1608 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1609 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: 26725
diff changeset
1610 PurpleConnection *gc = auth_data->gc;
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1611 struct yahoo_data *yd;
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1612 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: 26725
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: 26725
diff changeset
1614 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: 26725
diff changeset
1615
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1616 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: 26825
diff changeset
1617 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: 26825
diff changeset
1618 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1619 g_return_if_reached();
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1620 }
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1621
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1622 yd = (struct yahoo_data *)gc->proto_data;
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1623
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1624 if (error_message != NULL) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1625 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: 26725
diff changeset
1626 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: 26725
diff changeset
1627 g_free(auth_data->seed);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
1628 g_free(auth_data);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1629 return;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1630 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1631 else if (len > 0 && ret_data && *ret_data) {
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1632 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: 26825
diff changeset
1633 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: 26825
diff changeset
1634 int response_no = -1;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1635 char *crumb = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1636 char *crypt = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1637
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1638 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: 26824
diff changeset
1639 response_no = strtol(split_data[1], NULL, 10);
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1640 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: 26825
diff changeset
1641 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: 26825
diff changeset
1642 yd->cookie_t = g_strdup(split_data[4] + strlen("T="));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1645 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: 26725
diff changeset
1646
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1647 if(response_no != 0) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1648 /* 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: 26725
diff changeset
1649 PurpleConnectionError error;
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1650 char *error_reason = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1651
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1652 switch(response_no) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1653 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: 26725
diff changeset
1654 /* Some error in the received stream */
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1655 error_reason = g_strdup(_("Received invalid data"));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1656 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: 26725
diff changeset
1657 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1658 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: 26725
diff changeset
1659 /* 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: 26725
diff changeset
1660 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: 26725
diff changeset
1661 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: 26725
diff changeset
1662 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1663 default:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1664 /* if we have everything we need, why not try to login irrespective of response */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1665 if((crumb != NULL) && (yd->cookie_y != NULL) && (yd->cookie_t != NULL)) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1666 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: 26725
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: 26725
diff changeset
1668 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1669 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: 26725
diff changeset
1670 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: 26725
diff changeset
1671 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1672 }
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1673 if(error_reason) {
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1674 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: 26825
diff changeset
1675 error_reason);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1676 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: 26725
diff changeset
1677 g_free(error_reason);
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1678 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: 26825
diff changeset
1679 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1680 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1681 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1683
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1684 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: 26825
diff changeset
1685 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: 26825
diff changeset
1686 g_free(crypt);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1687 g_free(crumb);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1689 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: 26725
diff changeset
1690 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: 26725
diff changeset
1691 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1692
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1693 static void yahoo_auth16_stage1_cb(PurpleUtilFetchUrlData *unused, gpointer user_data, const gchar *ret_data, size_t len, const gchar *error_message)
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1694 {
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1695 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: 26725
diff changeset
1696 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: 26725
diff changeset
1697
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1698 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: 26725
diff changeset
1699
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1700 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: 26825
diff changeset
1701 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: 26825
diff changeset
1702 g_free(auth_data);
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1703 g_return_if_reached();
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1704 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1705
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1706 if (error_message != NULL) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1707 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: 26725
diff changeset
1708 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: 26725
diff changeset
1709 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: 26725
diff changeset
1710 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: 26725
diff changeset
1711 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1713 else if (len > 0 && ret_data && *ret_data) {
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1714 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: 26825
diff changeset
1715 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: 26825
diff changeset
1716 int response_no = -1;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1717 char *token = NULL;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1718
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1719 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: 26824
diff changeset
1720 response_no = strtol(split_data[1], NULL, 10);
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1721 token = g_strdup(split_data[2] + strlen("ymsgr="));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1722 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1723
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1724 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: 26725
diff changeset
1725
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1726 if(response_no != 0) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1727 /* 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: 26725
diff changeset
1728 PurpleConnectionError error;
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1729 char *error_reason;
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1730
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1731 switch(response_no) {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1732 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: 26725
diff changeset
1733 /* Some error in the received stream */
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1734 error_reason = g_strdup(_("Received invalid data"));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1735 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: 26725
diff changeset
1736 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1737 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: 26725
diff changeset
1738 /* 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: 26725
diff changeset
1739 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: 26725
diff changeset
1740 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: 26725
diff changeset
1741 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1742 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: 26725
diff changeset
1743 /* security lock from too many failed login attempts */
27057
48bf7a893709 yahoo login ver 16: Add another case of error reporting. Ask user to visit yahoo website in case of locked account.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 27028
diff changeset
1744 error_reason = g_strdup(_("Account locked: Too many failed login attempts.\nLogging into the Yahoo! website may fix this."));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1745 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: 26725
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: 26725
diff changeset
1747 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: 26725
diff changeset
1748 /* 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: 26725
diff changeset
1749 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: 26725
diff changeset
1750 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: 26725
diff changeset
1751 break;
27057
48bf7a893709 yahoo login ver 16: Add another case of error reporting. Ask user to visit yahoo website in case of locked account.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 27028
diff changeset
1752 case 1214:
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1753 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: 26725
diff changeset
1754 /* indicates a lock of some description */
27057
48bf7a893709 yahoo login ver 16: Add another case of error reporting. Ask user to visit yahoo website in case of locked account.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 27028
diff changeset
1755 error_reason = g_strdup(_("Account locked: Unknown reason.\nLogging into the Yahoo! website may fix this."));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1756 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: 26725
diff changeset
1757 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1758 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: 26725
diff changeset
1759 /* 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: 26725
diff changeset
1760 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: 26725
diff changeset
1761 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: 26725
diff changeset
1762 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1763 default:
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1764 /* Unknown error! */
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1765 error_reason = g_strdup(_("Unknown error"));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1766 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: 26725
diff changeset
1767 break;
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1768 }
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1769 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: 26825
diff changeset
1770 error_reason);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1771 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: 26725
diff changeset
1772 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: 26725
diff changeset
1773 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: 26725
diff changeset
1774 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: 26725
diff changeset
1775 }
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1776 else {
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1777 /* OK to login, correct information provided */
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1778 PurpleUtilFetchUrlData *url_data = NULL;
26824
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1779 char *url = NULL;
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1780 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: 26822
diff changeset
1781 "yahoojp", 0);
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1782
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1783 url = g_strdup_printf(yahoojp ? YAHOOJP_LOGIN_URL : YAHOO_LOGIN_URL, token);
26989
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26893
diff changeset
1784 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: 26893
diff changeset
1785 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: 26893
diff changeset
1786 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: 26893
diff changeset
1787 yahoo_auth16_stage2, auth_data);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1788 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: 26725
diff changeset
1789 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: 26725
diff changeset
1790 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1792 }
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1793
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1794 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: 26725
diff changeset
1795 {
26824
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1796 PurpleUtilFetchUrlData *url_data = NULL;
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1797 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: 26725
diff changeset
1798 char *url = NULL;
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1799 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: 26824
diff changeset
1800 char *encoded_password;
26824
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1801 gboolean yahoojp;
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1802
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1803 purple_debug_info("yahoo", "Authentication: In yahoo_auth16_stage1\n");
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1804
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1805 if(!purple_ssl_is_supported()) {
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
1806 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NO_SSL_SUPPORT, _("SSL support unavailable"));
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1807 return;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808 }
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1809
26824
644606f508e6 Support logging into Yahoo! Japan with protocol 16. It seems not to care
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26822
diff changeset
1810 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: 26822
diff changeset
1811 "yahoojp", 0);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1812 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: 26725
diff changeset
1813 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: 26725
diff changeset
1814 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: 26725
diff changeset
1815
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
1816 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: 26824
diff changeset
1817 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: 26824
diff changeset
1818 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: 26824
diff changeset
1819 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: 26824
diff changeset
1820 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: 26824
diff changeset
1821 g_free(encoded_username);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1822
26989
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26893
diff changeset
1823 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: 26893
diff changeset
1824 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: 26893
diff changeset
1825 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: 26893
diff changeset
1826 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: 26893
diff changeset
1827
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1828 g_free(url);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1831 static void yahoo_process_auth(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1832 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1833 char *seed = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 char *sn = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 int m = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837 gchar *buf;
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841 if (pair->key == 94)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 seed = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1843 if (pair->key == 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844 sn = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 m = atoi(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 if (seed) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 switch (m) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 case 0:
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1853 /* used to be for really old auth routine, dont support now */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 case 1:
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1855 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: 26725
diff changeset
1856 yahoo_auth16_stage1(gc, seed);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1858 default:
23402
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1859 {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1860 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: 23399
diff changeset
1861
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1862 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: 23399
diff changeset
1863 "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: 23399
diff changeset
1864 "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: 23399
diff changeset
1865 ((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: 23399
diff changeset
1866 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: 23399
diff changeset
1867 buf);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1868 g_free(buf);
26822
885320258863 Yahoo version 16 login. ---yet to do: prevent password from being displayed in debug logs---
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26725
diff changeset
1869 yahoo_auth16_stage1(gc, seed); /* Can't hurt to try it anyway. */
23402
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1870 break;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
1871 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1872 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1873 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1876 static void ignore_buddy(PurpleBuddy *buddy) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1877 PurpleGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1878 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 gchar *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1880
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881 if (!buddy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1884 group = purple_buddy_get_group(buddy);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1885 name = g_strdup(purple_buddy_get_name(buddy));
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1886 account = purple_buddy_get_account(buddy);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1887
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1888 purple_debug(PURPLE_DEBUG_INFO, "blist",
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1889 "Removing '%s' from buddy list.\n", name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1890 purple_account_remove_buddy(account, buddy, group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1891 purple_blist_remove_buddy(buddy);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1892
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1893 serv_add_deny(purple_account_get_connection(account), name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1895 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1896 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1897
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1898 static void keep_buddy(PurpleBuddy *b)
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1899 {
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1900 purple_privacy_deny_remove(purple_buddy_get_account(b),
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
1901 purple_buddy_get_name(b), 1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1902 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1903
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1904 static void yahoo_process_ignore(PurpleConnection *gc, struct yahoo_packet *pkt) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1905 PurpleBuddy *b;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1907 gchar *who = NULL;
22423
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: 22416
diff changeset
1908 gchar *me = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909 gchar buf[BUF_LONG];
22423
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: 22416
diff changeset
1910 gboolean ignore = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 gint status = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913 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
1914 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 case 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1919 case 1:
22423
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: 22416
diff changeset
1920 me = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922 case 13:
22423
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: 22416
diff changeset
1923 /* 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: 22416
diff changeset
1924 ignore = (strtol(pair->value, NULL, 10) == 1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1926 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1927 status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929 default:
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1932 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1933
22423
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: 22416
diff changeset
1934 /*
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: 22416
diff changeset
1935 * 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: 22416
diff changeset
1936 * 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: 22416
diff changeset
1937 * 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: 22416
diff changeset
1938 * 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: 22416
diff changeset
1939 * 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: 22416
diff changeset
1940 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 switch (status) {
22423
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: 22416
diff changeset
1942 case 12:
22424
35c4a9b4a699 Fix a missing a comma
Mark Doliner <mark@kingant.net>
parents: 22423
diff changeset
1943 purple_debug_info("yahoo", "Server reported \"is a buddy\" for %s while %s",
22423
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: 22416
diff changeset
1944 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: 22416
diff changeset
1945
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: 22416
diff changeset
1946 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: 22416
diff changeset
1947 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: 22416
diff changeset
1948 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: 22416
diff changeset
1949 "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: 22416
diff changeset
1950 "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: 22416
diff changeset
1951 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: 22416
diff changeset
1952 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: 22416
diff changeset
1953 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: 22416
diff changeset
1954 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: 22416
diff changeset
1955 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: 22416
diff changeset
1956 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: 22416
diff changeset
1957 }
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: 22416
diff changeset
1958 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: 22416
diff changeset
1959 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: 22416
diff changeset
1960 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: 22416
diff changeset
1961 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: 22416
diff changeset
1962 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: 22416
diff changeset
1963 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: 22416
diff changeset
1964 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: 22416
diff changeset
1965 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: 22416
diff changeset
1966 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: 22416
diff changeset
1967 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1969 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1970
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1971 static void yahoo_process_authresp(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 {
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
1973 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1974 struct yahoo_data *yd = gc->proto_data;
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
1975 #endif /* TRY_WEBMESSENGER_LOGIN */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1976 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1977 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1978 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979 char *url = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 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
1981 PurpleAccount *account = gc->account;
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
1982 PurpleConnectionError reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1983
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1984 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1985 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1986
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1987 if (pair->key == 66)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988 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
1989 else if (pair->key == 20)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 url = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 switch (err) {
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
1996 case 0:
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
1997 msg = g_strdup(_("Unknown error."));
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
1998 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
1999 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 case 3:
22794
cc8903c59d6b Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents: 22683
diff changeset
2001 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
2002 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 case 13:
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2005 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 if (!yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2007 PurpleUtilFetchUrlData *url_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008 yd->wm = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2012 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2013 url_data = purple_util_fetch_url(WEBMESSENGER_URL, TRUE,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2014 "Purple/" VERSION, FALSE, yahoo_login_page_cb, gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015 if (url_data != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 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
2017 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 }
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2019 #endif /* TRY_WEBMESSENGER_LOGIN */
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
2020 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
2021 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
2022
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 msg = g_strdup(_("Incorrect password."));
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2024 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website."));
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2028 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031 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
2032 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 if (url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 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
2036 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 fullmsg = g_strdup(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038
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
2039 purple_connection_error_reason(gc, reason, fullmsg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 g_free(fullmsg);
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2044 static void yahoo_process_addbuddy(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2045 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2046 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 char *who = NULL;
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2048 char *temp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 char *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050 char *decoded_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053 GSList *l = pkt->hash;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2054 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: 26154
diff changeset
2055 int protocol = 0;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2056 gboolean msn = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2058 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2060
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2061 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 err = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2065 case 7:
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2066 temp = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2067 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 case 65:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 group = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2070 break;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2071 case 241:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2072 protocol = strtol(pair->value, NULL, 10);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2073 if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2074 msn = TRUE;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2075 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2076 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2077
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2078 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2079 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2080
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2081 if (!temp)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084 group = "";
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2085
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2086 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2087 who = g_strconcat("msn/", temp, NULL);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2088 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2089 who = g_strdup(temp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2091 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
2092 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
2093 yahoo_update_status(gc, who, f);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2094 if(protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2095 f->protocol = protocol;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2096
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2097 if( !g_hash_table_lookup(yd->peers, who) ) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2098 /* we are not connected as client, so set friend to not connected */
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2099 if(msn)
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2100 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_DO_NOT_CONNECT);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2101 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2102 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: 26159
diff changeset
2103 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: 26159
diff changeset
2104 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2105 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2106 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: 26154
diff changeset
2107 yahoo_friend_set_p2p_status(f, YAHOO_P2PSTATUS_WE_ARE_CLIENT);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2111 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
2112 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2113 who, decoded_group, purple_connection_get_display_name(gc));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2114 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: 15743
diff changeset
2115 purple_notify_error(gc, NULL, _("Could not add buddy to server list"), buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 g_free(decoded_group);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
2118 g_free(who);
15373
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
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2121 /* 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: 26154
diff changeset
2122 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: 26154
diff changeset
2123 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2124 size_t pkt_len;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2125 guchar *raw_packet;
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2126
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2127 /*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: 26154
diff changeset
2128 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: 26154
diff changeset
2129 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: 26154
diff changeset
2130 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: 26154
diff changeset
2131 g_free(raw_packet);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2132 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2133
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2134 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: 26154
diff changeset
2135 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2136 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: 26154
diff changeset
2137 PurpleConnection *gc = user_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2138 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: 26154
diff changeset
2139 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2140 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: 26154
diff changeset
2141
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2142 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: 26154
diff changeset
2143
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2144 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: 26154
diff changeset
2145 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: 26154
diff changeset
2146 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: 26154
diff changeset
2147 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: 26154
diff changeset
2148 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2149 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2150 13, 7);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2151 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: 26154
diff changeset
2152
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2153 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: 26154
diff changeset
2154 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2155
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2156 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: 26154
diff changeset
2157 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2158 PurpleConnection *gc = data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2159 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: 26154
diff changeset
2160
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2161 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: 26154
diff changeset
2162
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2163 return TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2164 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2165
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2166 /* 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: 26154
diff changeset
2167 * 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: 26154
diff changeset
2168 * 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: 26154
diff changeset
2169 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: 26154
diff changeset
2170 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2171 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: 26154
diff changeset
2172 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2173
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2174 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2175 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2176
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2177 /* 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: 26154
diff changeset
2178 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: 26154
diff changeset
2179 if (f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2180 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: 26154
diff changeset
2181
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2182 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: 26154
diff changeset
2183 close(p2p_data->source);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2184 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: 26154
diff changeset
2185 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: 26154
diff changeset
2186 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: 26154
diff changeset
2187 g_free(p2p_data);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2188 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2189
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2190 /* 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: 26154
diff changeset
2191 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: 26154
diff changeset
2192 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2193 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: 26154
diff changeset
2194 char *who = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2195 GSList *l = pkt->hash;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2196 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: 26154
diff changeset
2197 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2198 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: 26154
diff changeset
2199 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2200 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2201
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2202 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2203 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2204
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2205 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: 26154
diff changeset
2206
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2207 /* 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: 26154
diff changeset
2208 while (l) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2209 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: 26154
diff changeset
2210
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2211 switch (pair->key) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2212 case 4:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2213 who = pair->value;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2214 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: 26154
diff changeset
2215 /* 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: 26154
diff changeset
2216 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: 26154
diff changeset
2217 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2218 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2219 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2220 case 13:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2221 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: 26154
diff changeset
2222 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2223 /* 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: 26154
diff changeset
2224 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2225 l = l->next;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2226 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2227
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2228 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: 26154
diff changeset
2229
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2230 /* 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: 26154
diff changeset
2231 * 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: 26154
diff changeset
2232 * 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: 26154
diff changeset
2233 * 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: 26154
diff changeset
2234 * 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: 26154
diff changeset
2235
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2236 switch(p2p_data->val_13) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2237 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: 26154
diff changeset
2238 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: 26154
diff changeset
2239 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: 26154
diff changeset
2240 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: 26154
diff changeset
2241 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2242 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: 26154
diff changeset
2243 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: 26154
diff changeset
2244 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2245 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2246
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2247 /* Build the yahoo packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2248 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: 26154
diff changeset
2249 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: 26154
diff changeset
2250 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: 26154
diff changeset
2251 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: 26154
diff changeset
2252 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2253 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2254 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: 26154
diff changeset
2255
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2256 /* 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: 26154
diff changeset
2257 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: 26154
diff changeset
2258 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: 26154
diff changeset
2259
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2260 if( val_13_to_send == 7 )
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2261 if( !g_hash_table_lookup(yd->peers, p2p_data->host_username) ) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2262 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: 26154
diff changeset
2263 /* 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: 26154
diff changeset
2264 f = yahoo_friend_find(p2p_data->gc, p2p_data->host_username);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2265 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: 26824
diff changeset
2266 if(p2p_data->connection_type == YAHOO_P2P_WE_ARE_SERVER) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2267 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: 26154
diff changeset
2268 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: 26154
diff changeset
2269 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2270 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2271 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: 26154
diff changeset
2272 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2273 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2274 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2275
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2276 /* 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: 26154
diff changeset
2277 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: 26154
diff changeset
2278 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2279 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: 26154
diff changeset
2280 int len;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2281 int pos = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2282 int pktlen;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2283 struct yahoo_packet *pkt;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2284 guchar *start = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2285 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: 26154
diff changeset
2286 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2287
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2288 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2289 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2290 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: 26154
diff changeset
2291
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2292 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: 26154
diff changeset
2293 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: 26154
diff changeset
2294 return ; /* No Worries*/
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2295 else if (len <= 0)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2296 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2297 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: 26154
diff changeset
2298 /* 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: 26154
diff changeset
2299 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: 26154
diff changeset
2300 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: 26154
diff changeset
2301 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2302 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: 26154
diff changeset
2303 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2304 }
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2305
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2306 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: 26154
diff changeset
2307 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2308
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2309 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: 26154
diff changeset
2310 /* Not a YMSG packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2311 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: 26154
diff changeset
2312
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2313 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: 26154
diff changeset
2314 if(start) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2315 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: 26154
diff changeset
2316 len -= start - buf;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2317 } else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2318 g_free(buf);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2319 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2320 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2321 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2322
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2323 pos += 4; /* YMSG */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2324 pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2325 pos += 2;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2326
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2327 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: 26154
diff changeset
2328 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: 26154
diff changeset
2329
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2330 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: 26154
diff changeset
2331 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: 26154
diff changeset
2332 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: 26154
diff changeset
2333 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: 26154
diff changeset
2334
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2335 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: 26154
diff changeset
2336 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: 26154
diff changeset
2337
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2338 /* packet processing */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2339 switch(pkt->service) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2340 case YAHOO_SERVICE_P2PFILEXFER:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2341 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: 26154
diff changeset
2342 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2343 case YAHOO_SERVICE_MESSAGE:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2344 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: 26154
diff changeset
2345 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2346 case YAHOO_SERVICE_NOTIFY:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2347 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: 26154
diff changeset
2348 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2349 default:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2350 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: 26154
diff changeset
2351 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2352
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2353 yahoo_packet_free(pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2354 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2355
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2356 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: 26154
diff changeset
2357 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2358 int acceptfd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2359 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: 26154
diff changeset
2360 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2361
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2362 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2363 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2364 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: 26154
diff changeset
2365
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2366 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: 26154
diff changeset
2367 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: 26154
diff changeset
2368 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2369 else if(acceptfd == -1) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2370 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: 26154
diff changeset
2371 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: 26154
diff changeset
2372 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2373 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2374
26158
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2375 /* remove timeout */
26720
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
2376 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: 26568
diff changeset
2377 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: 26568
diff changeset
2378 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: 26568
diff changeset
2379 }
26158
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2380
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2381 /* remove watcher and close p2p server */
26720
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
2382 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: 26568
diff changeset
2383 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: 26568
diff changeset
2384 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: 26568
diff changeset
2385 }
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
2386 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: 26568
diff changeset
2387 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: 26568
diff changeset
2388 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: 26568
diff changeset
2389 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2390
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2391 /* 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: 26154
diff changeset
2392 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: 26154
diff changeset
2393 p2p_data->source = acceptfd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2394 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2395
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2396 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: 26154
diff changeset
2397 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2398 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: 26154
diff changeset
2399 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2400
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2401 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2402 return FALSE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2403
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2404 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: 26154
diff changeset
2405
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2406 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: 26154
diff changeset
2407 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: 26154
diff changeset
2408 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: 26154
diff changeset
2409 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: 26154
diff changeset
2410 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: 26154
diff changeset
2411 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: 26154
diff changeset
2412 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: 26154
diff changeset
2413
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2414 return FALSE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2415 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2416
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2417 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: 26154
diff changeset
2418 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2419 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: 26154
diff changeset
2420 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2421
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2422 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2423 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2424
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2425 if(listenfd == -1) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2426 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: 26154
diff changeset
2427 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: 26154
diff changeset
2428 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2429 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2430
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2431 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: 26154
diff changeset
2432
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2433 /* 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: 26154
diff changeset
2434 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: 26154
diff changeset
2435 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: 26154
diff changeset
2436
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2437 /* add timeout */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2438 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: 26154
diff changeset
2439 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2440
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2441 /* 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: 26154
diff changeset
2442 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: 26154
diff changeset
2443 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2444 const char *public_ip;
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2445 guint32 temp[4];
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2446 guint32 ip;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2447 char temp_str[100];
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2448 gchar *base64_ip = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2449 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2450 struct yahoo_packet *pkt;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2451 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2452 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: 26154
diff changeset
2453 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: 26154
diff changeset
2454
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2455 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: 26154
diff changeset
2456 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: 26154
diff changeset
2457
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2458 /* 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: 26154
diff changeset
2459 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: 26154
diff changeset
2460 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2461
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2462 /* 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: 26154
diff changeset
2463 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: 26154
diff changeset
2464 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2465
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2466 /* 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 */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2467 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: 26154
diff changeset
2468 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2469
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2470 /* 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: 26154
diff changeset
2471 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2472 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2473
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2474 /* 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: 26154
diff changeset
2475 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: 26154
diff changeset
2476 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2477
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2478 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: 26154
diff changeset
2479 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: 26154
diff changeset
2480 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2481
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2482 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: 26154
diff changeset
2483 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: 26154
diff changeset
2484 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: 26154
diff changeset
2485
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2486 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: 26154
diff changeset
2487 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: 26154
diff changeset
2488 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: 26154
diff changeset
2489 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: 26154
diff changeset
2490 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: 26154
diff changeset
2491 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: 26154
diff changeset
2492 2, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2493 5, who,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2494 13, val_13,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2495 49, "PEERTOPEER");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2496 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: 26154
diff changeset
2497
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2498 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: 26154
diff changeset
2499
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2500 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: 26154
diff changeset
2501
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2502 p2p_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2503 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: 26154
diff changeset
2504 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: 26154
diff changeset
2505 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: 26154
diff changeset
2506 p2p_data->connection_type = YAHOO_P2P_WE_ARE_SERVER;
26510
d9439f76c118 Initialize file descriptors to -1.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26279
diff changeset
2507 p2p_data->source = -1;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2508
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2509 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: 26154
diff changeset
2510
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2511 g_free(base64_ip);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2512 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2513
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2514 /* 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: 26154
diff changeset
2515 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: 26154
diff changeset
2516 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2517 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: 26154
diff changeset
2518 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: 26154
diff changeset
2519 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2520 struct yahoo_data *yd;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2521
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2522 if(!(p2p_data = data))
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2523 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2524 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: 26154
diff changeset
2525
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2526 if(error_message != NULL) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2527 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: 26154
diff changeset
2528 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
2529
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2530 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: 26154
diff changeset
2531 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2532 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2533
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2534 /* 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: 26154
diff changeset
2535 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: 26154
diff changeset
2536 p2p_data->source = source;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2537
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2538 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: 26154
diff changeset
2539
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2540 /* Build the yahoo packet */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2541 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: 26154
diff changeset
2542 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: 26154
diff changeset
2543 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: 26154
diff changeset
2544 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: 26154
diff changeset
2545 241, 0, /* Protocol identifier */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2546 49, "PEERTOPEER",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2547 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: 26154
diff changeset
2548
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2549 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: 26154
diff changeset
2550 yahoo_packet_free(pkt_to_send);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2551 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2552
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2553 static void yahoo_process_p2p(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2554 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2555 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2556 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2557 char *base64 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2558 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2559 gsize len;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2560 gint val_13 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2561 gint val_11 = 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2562 PurpleAccount *account;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2563 YahooFriend *f;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2564
26159
ffb0d441d0a3 identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26158
diff changeset
2565 /* 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: 26158
diff changeset
2566 if(!(pkt->status == YAHOO_STATUS_BRB))
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2567 return ;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2569 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2570 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2571
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2572 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2573 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2574 /* our identity */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2575 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2576 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2577 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2578 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2579 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2580 /* who again, the master identity this time? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2581 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2582 case 12:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2583 base64 = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2584 /* 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
2585 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
2586 break;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2587 case 13:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2588 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: 26154
diff changeset
2589 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2590 case 11:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2591 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: 26154
diff changeset
2592 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: 26154
diff changeset
2593 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: 26154
diff changeset
2594 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2595 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2596 TODO: figure these out
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2597 yahoo: Key: 61 Value: 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2598 yahoo: Key: 2 Value:
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2599 yahoo: Key: 13 Value: 0 packet count ??
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2600 yahoo: Key: 49 Value: PEERTOPEER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2601 yahoo: Key: 140 Value: 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2602 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2603
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2606 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2607 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2608
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2609 if (base64) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2610 guint32 ip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2611 YahooFriend *f;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2612 char *host_ip;
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2613 struct yahoo_p2p_data *p2p_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2614
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2615 decoded = purple_base64_decode(base64, &len);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2616 if (len) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2617 char *tmp = purple_str_binary_to_ascii(decoded, len);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2618 purple_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2619 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2620 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2621
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2622 ip = strtol((gchar *)decoded, NULL, 10);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2623 g_free(decoded);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2624 host_ip = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2625 (ip >> 24) & 0xff);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2626 f = yahoo_friend_find(gc, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2627 if (f)
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2628 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: 26154
diff changeset
2629 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: 26154
diff changeset
2630
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2631 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: 26154
diff changeset
2632
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
2633 if(val_11==0) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2634 if(!f)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2635 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2636 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2637 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: 26154
diff changeset
2638 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2639
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2640 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: 26510
diff changeset
2641 p2p_data->host_username = g_strdup(who);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2642 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: 26154
diff changeset
2643 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: 26154
diff changeset
2644 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: 26154
diff changeset
2645 p2p_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2646 p2p_data->connection_type = YAHOO_P2P_WE_ARE_CLIENT;
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2647 p2p_data->source = -1;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2648
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2649 /* connect to host */
27117
e6eee2b3417c Pass a handle to purple_proxy_connect() when making this connection.
Mark Doliner <mark@kingant.net>
parents: 27111
diff changeset
2650 if((purple_proxy_connect(gc, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2651 purple_debug_info("yahoo","p2p: Connection to %s failed\n", host_ip);
26568
3712d32363dd Remove a bug where host_ip was accessed after freeing it.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26545
diff changeset
2652 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: 26545
diff changeset
2653 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: 26545
diff changeset
2654 g_free(p2p_data);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2655 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2656 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2657 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2658
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2659 static void yahoo_process_audible(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2660 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2661 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2662 char *who = NULL, *msg = NULL, *id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2663 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2664
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2665 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
2666
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2667 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2668 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2669
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2670 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2671 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2672 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2673 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2674 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2675 /* us */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2676 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2677 case 230:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2678 /* 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
2679 eg: base.tw.smiley.smiley43 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2680 id = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2681 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2682 case 231:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2683 /* the text of the audible */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2684 msg = pair->value;
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 232:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2687 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2688 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2689 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2690
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2691 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2692 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2693
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2694 if (!msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2695 msg = id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2696 if (!who || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2697 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2698 if (!g_utf8_validate(msg, -1, NULL)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2699 purple_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2700 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2701 }
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2702 if (!purple_privacy_check(account, who)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2703 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
2704 purple_account_get_username(account), who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2705 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2706 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2707 if (id) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2708 /* "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
2709 char **audible_locale = g_strsplit(id, ".", 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2710 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
2711 g_strfreev(audible_locale);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2713 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
2714 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2715 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2716 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
2717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2718
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2719 static void yahoo_packet_process(PurpleConnection *gc, struct yahoo_packet *pkt)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2720 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2721 switch (pkt->service) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2722 case YAHOO_SERVICE_LOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2723 case YAHOO_SERVICE_LOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2724 case YAHOO_SERVICE_ISAWAY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2725 case YAHOO_SERVICE_ISBACK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2726 case YAHOO_SERVICE_GAMELOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2727 case YAHOO_SERVICE_GAMELOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2728 case YAHOO_SERVICE_CHATLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2729 case YAHOO_SERVICE_CHATLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2730 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2731 case YAHOO_SERVICE_STATUS_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2732 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2733 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2734 case YAHOO_SERVICE_NOTIFY:
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2735 yahoo_process_notify(gc, pkt, YAHOO_PKT_TYPE_SERVER);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2736 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2737 case YAHOO_SERVICE_MESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2738 case YAHOO_SERVICE_GAMEMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2739 case YAHOO_SERVICE_CHATMSG:
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2740 yahoo_process_message(gc, pkt, YAHOO_PKT_TYPE_SERVER);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2741 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2742 case YAHOO_SERVICE_SYSMESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2743 yahoo_process_sysmessage(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2744 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2745 case YAHOO_SERVICE_NEWMAIL:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2746 yahoo_process_mail(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2747 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2748 case YAHOO_SERVICE_NEWCONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2749 yahoo_process_contact(gc, pkt);
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_AUTHRESP:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2752 yahoo_process_authresp(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_LIST:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2755 yahoo_process_list(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_LIST_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2758 yahoo_process_list_15(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_AUTH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2761 yahoo_process_auth(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2762 break;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
2763 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
2764 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
2765 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2766 case YAHOO_SERVICE_ADDBUDDY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2767 yahoo_process_addbuddy(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_IGNORECONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2770 yahoo_process_ignore(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2771 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2772 case YAHOO_SERVICE_CONFINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2773 case YAHOO_SERVICE_CONFADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2774 yahoo_process_conference_invite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2775 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2776 case YAHOO_SERVICE_CONFDECLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2777 yahoo_process_conference_decline(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2778 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2779 case YAHOO_SERVICE_CONFLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2780 yahoo_process_conference_logon(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2781 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2782 case YAHOO_SERVICE_CONFLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2783 yahoo_process_conference_logoff(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_CONFMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2786 yahoo_process_conference_message(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_CHATONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2789 yahoo_process_chat_online(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_CHATLOGOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2792 yahoo_process_chat_logout(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_CHATGOTO:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2795 yahoo_process_chat_goto(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_CHATJOIN:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2798 yahoo_process_chat_join(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_CHATLEAVE: /* XXX is this right? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2801 case YAHOO_SERVICE_CHATEXIT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2802 yahoo_process_chat_exit(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2803 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2804 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
2805 case YAHOO_SERVICE_CHATADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2806 yahoo_process_chat_addinvite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2807 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2808 case YAHOO_SERVICE_COMMENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2809 yahoo_process_chat_message(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2810 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2811 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2812 case YAHOO_SERVICE_PRESENCE_SESSION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2813 yahoo_process_presence(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2814 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2815 case YAHOO_SERVICE_P2PFILEXFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2816 /* This case had no break and continued; thus keeping it this way.*/
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2817 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: 26154
diff changeset
2818 yahoo_process_p2pfilexfer(gc, pkt); /* redundant ??, need to have a break now */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2819 case YAHOO_SERVICE_FILETRANSFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2820 yahoo_process_filetransfer(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2821 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2822 case YAHOO_SERVICE_PEERTOPEER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2823 yahoo_process_p2p(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2824 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2825 case YAHOO_SERVICE_PICTURE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2826 yahoo_process_picture(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2827 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2828 case YAHOO_SERVICE_PICTURE_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2829 yahoo_process_picture_update(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_PICTURE_CHECKSUM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2832 yahoo_process_picture_checksum(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_UPLOAD:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2835 yahoo_process_picture_upload(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_AVATAR_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2838 yahoo_process_avatar_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_AUDIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2841 yahoo_process_audible(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2842 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2843 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
2844 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
2845 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2846 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
2847 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
2848 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
2849 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
2850 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
2851 break;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2852 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: 26154
diff changeset
2853 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: 26154
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
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2856 default:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2857 purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2858 "Unhandled service 0x%02x\n", pkt->service);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2859 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2860 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2861 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2862
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2863 static void yahoo_pending(gpointer data, gint source, PurpleInputCondition cond)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2864 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2865 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2866 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2867 char buf[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2868 int len;
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 len = read(yd->fd, buf, sizeof(buf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2871
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2872 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2873 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2874
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2875 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877 return;
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 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
2880 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2881 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2885 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: 19719
diff changeset
2886 _("Server closed the connection."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2887 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2888 }
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
2889 gc->last_received = time(NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2890 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
2891 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2892 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2894 while (1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896 int pos = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 int pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2898
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 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
2903 /* 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
2904 * are you trying to pull? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905 guchar *start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
2907 purple_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 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
2910 if (start) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2911 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
2912 yd->rxlen -= start - yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2913 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2914 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2915 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2916 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2917 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2918 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2919 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2920 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922 pos += 4; /* YMSG */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2924 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2925
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2927 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928 "%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
2929
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2932
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2933 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
2934
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 pkt = yahoo_packet_new(0, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2936
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2937 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
2938 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2939 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2940 "Yahoo Service: 0x%02x Status: %d\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2941 pkt->service, pkt->status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2942 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
2943
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2944 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
2945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2946 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2947 if (yd->rxlen) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2948 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
2949 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2950 yd->rxqueue = tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2953 yd->rxqueue = NULL;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2956 yahoo_packet_process(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2958 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2959 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2960 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2961
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2962 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
2963 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2964 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2965 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2966 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2967
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2968 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2969 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2970 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2971 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2972
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2973 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
2974 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
2975 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: 17043
diff changeset
2976 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
2977 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
2978 g_free(tmp);
15373
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 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2983 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2985 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
2986
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2987 yahoo_packet_hash_str(pkt, 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2990 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2991 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2993 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994 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
2995 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2996 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2997 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2998 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2999
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3000 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3001 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3002 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3004
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3005 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3006 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3007 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: 17043
diff changeset
3008 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3009 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3010 g_free(tmp);
15373
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 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3015 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3016
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3017 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
3018
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3019 yahoo_packet_hash(pkt, "sss", 0,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3020 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: 15743
diff changeset
3021 1, purple_normalize(gc->account, purple_account_get_username(purple_connection_get_account(gc))),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022 6, yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3024
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3025 g_free(yd->auth);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3026 gc->inpa = purple_input_add(yd->fd, PURPLE_INPUT_READ, yahoo_pending, gc);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3029 static void yahoo_web_pending(gpointer data, gint source, PurpleInputCondition cond)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3030 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3031 PurpleConnection *gc = data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3032 PurpleAccount *account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3034 char bufread[2048], *i = bufread, *buf = bufread;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3035 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3036 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3038 len = read(source, bufread, sizeof(bufread) - 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3039
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3040 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3041 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3042
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3043 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3044 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3045 return;
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 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
3048 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3049 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3050 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3051 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3053 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: 19719
diff changeset
3054 _("Server closed the connection."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3057
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3058 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
3059 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
3060 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3061 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062 i = buf = (char *)yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3063 len = yd->rxlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3065 buf[len] = '\0';
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 ((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
3068 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
3069 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: 19719
diff changeset
3070 _("Received unexpected HTTP response from server."));
24593
9fb7910c1176 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <mark@kingant.net>
parents: 24590
diff changeset
3071 purple_debug_misc("yahoo", "Unexpected HTTP response: %s\n", buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3072 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075 s = g_string_sized_new(len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077 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
3078
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3079 i += strlen("Set-Cookie: ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3080 for (;*i != ';' && *i != '\0'; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3081 g_string_append_c(s, *i);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
3082
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3083 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
3084 /* 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
3085 * 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
3086 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3087 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3088
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3089 yd->auth = g_string_free(s, FALSE);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3090 purple_input_remove(gc->inpa);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3091 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3092 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3093 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3094 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3095 /* Now we have our cookies to login with. I'll go get the milk. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3096 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: 19719
diff changeset
3097 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
b4ac690a2225 Add disconnection reasons to yahoo
Will Thompson <will.thompson@collabora.co.uk>
parents: 19719
diff changeset
3098 yahoo_got_web_connected, gc) == NULL) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3099 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: 19719
diff changeset
3100 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3101 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3104
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3105 static void yahoo_got_cookies_send_cb(gpointer data, gint source, PurpleInputCondition cond)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3106 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3107 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3108 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3109 int written, remaining;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3110
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3111 gc = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3112 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3114 remaining = strlen(yd->auth) - yd->auth_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3115 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
3116
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3117 if (written < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3118 written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3119 else if (written <= 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3120 gchar *tmp;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3124 purple_input_remove(gc->inpa);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3125 gc->inpa = 0;
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3126 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
3127 "login.yahoo.com:80", g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3128 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3129 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3130 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3131 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3133 if (written < remaining) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 yd->auth_written += written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3135 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3138 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 yd->auth_written = 0;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3141 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3142 gc->inpa = purple_input_add(source, PURPLE_INPUT_READ, yahoo_web_pending, gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3143 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3144
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145 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
3146 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3147 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3148
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3149 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3150 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3151 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: 17043
diff changeset
3152 "login.yahoo.com:80", error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3153 purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3154 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3155 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3156 }
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 (gc->inpa == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3159 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3160 gc->inpa = purple_input_add(source, PURPLE_INPUT_WRITE,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3161 yahoo_got_cookies_send_cb, gc);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3162 yahoo_got_cookies_send_cb(gc, source, PURPLE_INPUT_WRITE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3164 }
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 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
3167 {
24593
9fb7910c1176 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <mark@kingant.net>
parents: 24590
diff changeset
3168 if (!strcmp(key, "passwd") || !strcmp(key, "login"))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3169 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3170 g_string_append_c(url, '&');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3171 g_string_append(url, key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3172 g_string_append_c(url, '=');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3173 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3174 g_string_append_c(url, '1');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3175 else if (!strcmp(key, ".challenge"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3176 g_string_append(url, val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3177 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3178 g_string_append(url, purple_url_encode(val));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3181 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
3182 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3183 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
3184 const char *c = buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3185 char *d;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3186 char name[64], value[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3187 int count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3188 int input_len = strlen("<input ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3189 int name_len = strlen("name=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3190 int value_len = strlen("value=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3191 while ((len > ((c - buf) + input_len))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3192 && (c = strstr(c, "<input "))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3193 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
3194 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3195 c += name_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3196 count = sizeof(name)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3197 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
3198 && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3199 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3200 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3201 count = sizeof(value)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3202 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
3203 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3204 d += value_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3205 if (strchr(c, '>') < d)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3206 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3207 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
3208 && *c!='"' && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3209 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3210 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3211 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
3212 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3213 return hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3214 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3215
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3216 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3217 yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3218 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
3219 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3220 PurpleConnection *gc = (PurpleConnection *)user_data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3221 PurpleAccount *account = purple_connection_get_account(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3222 struct yahoo_data *yd = gc->proto_data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3223 const char *sn = purple_account_get_username(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3224 const char *pass = purple_connection_get_password(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3225 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
3226 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
3227 char md5[33], *hashp = md5, *chal;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3228 int i;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3229 PurpleCipher *cipher;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3230 PurpleCipherContext *context;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3231 guchar digest[16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3232
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3233 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
3234
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3235 if (error_message != NULL)
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3236 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3237 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: 19719
diff changeset
3238 error_message);
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3239 return;
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3240 }
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3241
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3242 url = g_string_append(url, sn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3243 url = g_string_append(url, "&passwd=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3244
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3245 cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3246 context = purple_cipher_context_new(cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3247
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3248 purple_cipher_context_append(context, (const guchar *)pass, strlen(pass));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3249 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3250 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3251 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3252 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3255 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3256 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3257 purple_cipher_context_append(context, (const guchar *)chal, strlen(chal));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3258 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3259 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3262 hashp += 2;
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 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3265 * 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
3266 * I updated it..
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3267
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3268 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3269 purple_cipher_context_append(context, md5, strlen(md5));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3270 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3271 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3272 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3274 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3275 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3277 g_free(chal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3278
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3279 url = g_string_append(url, md5);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3280 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
3281
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3282 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
3283 "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
3284 g_hash_table_destroy(hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3285 yd->auth = g_string_free(url, FALSE);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3286 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
3287 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: 19719
diff changeset
3288 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3289 return;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3292 purple_cipher_context_destroy(context);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3293 }
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
3294 #endif /* TRY_WEBMESSENGER_LOGIN */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3295
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3296 static void yahoo_server_check(PurpleAccount *account)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3297 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3298 const char *server;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3299
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3300 server = purple_account_get_string(account, "server", YAHOO_PAGER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3301
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3302 if (strcmp(server, "scs.yahoo.com") == 0)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3303 purple_account_set_string(account, "server", YAHOO_PAGER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3304 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3305
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3306 static void yahoo_picture_check(PurpleAccount *account)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3307 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3308 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
3309 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
3310
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
3311 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
3312 purple_imgstore_unref(img);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3315 static int get_yahoo_status_from_purple_status(PurpleStatus *status)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3316 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3317 PurplePresence *presence;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3318 const char *status_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3319 const char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3320
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3321 presence = purple_status_get_presence(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3322 status_id = purple_status_get_id(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3323 msg = purple_status_get_attr_string(status, "message");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3325 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
3326 if ((msg != NULL) && (*msg != '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 return YAHOO_STATUS_CUSTOM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3328 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3329 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3330 } 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
3331 return YAHOO_STATUS_BRB;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3332 } 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
3333 return YAHOO_STATUS_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3334 } 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
3335 return YAHOO_STATUS_NOTATHOME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3336 } 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
3337 return YAHOO_STATUS_NOTATDESK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3338 } 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
3339 return YAHOO_STATUS_NOTINOFFICE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 } 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
3341 return YAHOO_STATUS_ONPHONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 } 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
3343 return YAHOO_STATUS_ONVACATION;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 } 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
3345 return YAHOO_STATUS_OUTTOLUNCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3346 } 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
3347 return YAHOO_STATUS_STEPPEDOUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3348 } 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
3349 return YAHOO_STATUS_INVISIBLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3350 } 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
3351 return YAHOO_STATUS_CUSTOM;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3352 } else if (purple_presence_is_idle(presence)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3353 return YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3354 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3355 purple_debug_error("yahoo", "Unexpected PurpleStatus!\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3356 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3358 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3359
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3360 static void yahoo_login(PurpleAccount *account) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3361 PurpleConnection *gc = purple_account_get_connection(account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3362 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3363 PurpleStatus *status = purple_account_get_active_status(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3364 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: 15743
diff changeset
3365
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3366 purple_connection_update_progress(gc, _("Connecting"), 1, 2);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3367
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3368 purple_connection_set_display_name(gc, purple_account_get_username(account));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3369
26157
969b0e6f3f44 set fd to -1 initially, if not done, no p2p connection is initiated ever.
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26156
diff changeset
3370 yd->yahoo_local_p2p_server_fd = -1;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3371 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
3372 yd->txhandler = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3373 /* TODO: Is there a good grow size for the buffer? */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3374 yd->txbuf = purple_circ_buffer_new(0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3375 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
3376 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
3377 yd->xfer_peer_idstring_map = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, NULL);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3378 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: 26154
diff changeset
3379 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: 26154
diff changeset
3380 yd->yahoo_p2p_timer = purple_timeout_add_seconds(YAHOO_P2P_KEEPALIVE_SECS, yahoo_p2p_keepalive, gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3381 yd->confs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3382 yd->conf_id = 2;
24171
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: 24040
diff changeset
3383 yd->last_keepalive = yd->last_ping = time(NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3384
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3385 yd->current_status = get_yahoo_status_from_purple_status(status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3386
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3387 yahoo_server_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3388 yahoo_picture_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3389
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3390 if (purple_account_get_bool(account, "yahoojp", FALSE)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3391 yd->jp = TRUE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3392 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3393 purple_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3394 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3395 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3396 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3397 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: 19719
diff changeset
3398 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3399 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3400 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3401 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3402 yd->jp = FALSE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3403 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3404 purple_account_get_string(account, "server", YAHOO_PAGER_HOST),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3405 purple_account_get_int(account, "port", YAHOO_PAGER_PORT),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3406 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3407 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3408 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: 19719
diff changeset
3409 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3410 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3411 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3412 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3413 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3414
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3415 static void yahoo_close(PurpleConnection *gc) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3416 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
3417 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3418
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3419 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3420 purple_input_remove(gc->inpa);
15373
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 while (yd->url_datas) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3423 purple_util_fetch_url_cancel(yd->url_datas->data);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3424 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
3425 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3426
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3427 for (l = yd->confs; l; l = l->next) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3428 PurpleConversation *conv = l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3429
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3430 yahoo_conf_leave(yd, purple_conversation_get_name(conv),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3431 purple_connection_get_display_name(gc),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3432 purple_conv_chat_get_users(PURPLE_CONV_CHAT(conv)));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3433 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3434 g_slist_free(yd->confs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3435
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3436 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
3437 g_free(l->data);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3438 l->data=NULL;
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3439 }
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3440 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
3441
24171
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: 24040
diff changeset
3442 yd->chat_online = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 if (yd->in_chat)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3444 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
3445
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3446 purple_timeout_remove(yd->yahoo_p2p_timer);
26720
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
3447 if(yd->yahoo_p2p_server_timeout_handle != 0) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3448 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
26720
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
3449 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: 26568
diff changeset
3450 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3451
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3452 /* close p2p server if it is waiting for a peer to connect */
26720
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
3453 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: 26568
diff changeset
3454 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: 26568
diff changeset
3455 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: 26568
diff changeset
3456 }
25e01fe7b732 Fix a couple of runtime-warnings when disconnecting a yahoo account.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26568
diff changeset
3457 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: 26568
diff changeset
3458 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: 26568
diff changeset
3459 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: 26568
diff changeset
3460 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3461
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3462 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: 26154
diff changeset
3463 g_hash_table_destroy(yd->peers);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3464 g_hash_table_destroy(yd->friends);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3465 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
3466 g_hash_table_destroy(yd->xfer_peer_idstring_map);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3467 g_free(yd->chat_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3468
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3469 g_free(yd->cookie_y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3470 g_free(yd->cookie_t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3471
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3472 if (yd->txhandler)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3473 purple_input_remove(yd->txhandler);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3474
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3475 purple_circ_buffer_destroy(yd->txbuf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3476
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3477 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3478 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3479
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3482 g_free(yd->picture_url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3483
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3484 if (yd->buddy_icon_connect_data)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3485 purple_proxy_connect_cancel(yd->buddy_icon_connect_data);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3486 if (yd->picture_upload_todo)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3487 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
3488 if (yd->ycht)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3489 ycht_connection_close(yd->ycht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3490
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
3491 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
3492 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
3493 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
3494 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
3495
22416
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22330
diff changeset
3496 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: 22330
diff changeset
3497
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3498 g_free(yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499 gc->proto_data = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3500 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3501
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3502 static const char *yahoo_list_icon(PurpleAccount *a, PurpleBuddy *b)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3503 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3504 return "yahoo";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3505 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3506
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3507 static const char *yahoo_list_emblem(PurpleBuddy *b)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3508 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3509 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3510 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3511 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3512 YahooFriend *f;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3513 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3514
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3515 if (!b || !(account = purple_buddy_get_account(b)) ||
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3516 !(gc = purple_account_get_connection(account)) ||
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3517 !(yd = gc->proto_data))
15497
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15462
diff changeset
3518 return NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3519
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3520 f = yahoo_friend_find(gc, purple_buddy_get_name(b));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3521 if (!f) {
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3522 return "not-authorized";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3523 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3524
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3525 presence = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3526
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3527 if (purple_presence_is_online(presence)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3528 if (yahoo_friend_get_game(f))
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3529 return "game";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3530 if (f->protocol == 2)
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3531 return "msn";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532 }
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3533 return NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3534 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3535
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3536 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
3537 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3538 switch (a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539 case YAHOO_STATUS_BRB:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3540 return _("Be Right Back");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3541 case YAHOO_STATUS_BUSY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3542 return _("Busy");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3543 case YAHOO_STATUS_NOTATHOME:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3544 return _("Not at Home");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3545 case YAHOO_STATUS_NOTATDESK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3546 return _("Not at Desk");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3547 case YAHOO_STATUS_NOTINOFFICE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3548 return _("Not in Office");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3549 case YAHOO_STATUS_ONPHONE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3550 return _("On the Phone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3551 case YAHOO_STATUS_ONVACATION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3552 return _("On Vacation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3553 case YAHOO_STATUS_OUTTOLUNCH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3554 return _("Out to Lunch");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3555 case YAHOO_STATUS_STEPPEDOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556 return _("Stepped Out");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557 case YAHOO_STATUS_INVISIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3558 return _("Invisible");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3559 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3560 return _("Idle");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3561 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3562 return _("Offline");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3563 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3564 return _("Available");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3565 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3566 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3567
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3568 static void yahoo_initiate_conference(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3569
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3570 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3571 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3572
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3573 GHashTable *components;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3574 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3575 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3577 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3578
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3579 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3580 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3581 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3582 id = yd->conf_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3584 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
3585 g_hash_table_replace(components, g_strdup("room"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3586 g_strdup_printf("%s-%d", purple_connection_get_display_name(gc), id));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3587 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
3588 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
3589 yahoo_c_join(gc, components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3590 g_hash_table_destroy(components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3591
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3592 yahoo_c_invite(gc, id, "Join my conference...", purple_buddy_get_name(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3593 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3594
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3595 static void yahoo_presence_settings(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3596 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3597 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3598 int presence_val = GPOINTER_TO_INT(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3599
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3600 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3601 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: 24171
diff changeset
3602
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3603 yahoo_friend_update_presence(gc, purple_buddy_get_name(buddy), presence_val);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3604 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3605
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3606 static void yahoo_game(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3607
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3608 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3609 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3610
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3611 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3612 const char *game;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3613 char *game2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3614 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3615 char url[256];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3616 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3617
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3618 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3619
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3620 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3621 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3622 yd = (struct yahoo_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3623
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3624 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3625 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3626 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3627
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3628 game = yahoo_friend_get_game(f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3629 if (!game)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3630 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3631
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3632 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
3633 while (*t && *t != '\t')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3634 t++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3635 *t = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3636 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3637 purple_notify_uri(gc, url);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3638 g_free(game2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3639 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3640
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3641 static char *yahoo_status_text(PurpleBuddy *b)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3642 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3643 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3644 const char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3645 char *msg2;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3646 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3647
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3648 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3649 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3650 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3651 return g_strdup(_("Not on server list"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3652
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3653 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3654 case YAHOO_STATUS_AVAILABLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3655 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3656 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3657 if (f->idle == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3658 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
3659 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3660 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661 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
3662 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3663 msg2 = g_markup_escape_text(msg, strlen(msg));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3664 purple_util_chrreplace(msg2, '\n', ' ');
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3665 return msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3667 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3668 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
3669 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3670 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3671
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3672 void yahoo_tooltip_text(PurpleBuddy *b, PurpleNotifyUserInfo *user_info, gboolean full)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3673 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3674 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3675 char *escaped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3676 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3677 const char *presence = NULL;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3678 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3679
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3680 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3681 f = yahoo_friend_find(purple_account_get_connection(account), purple_buddy_get_name(b));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3682 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683 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
3684 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3685 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3686 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3687 if (!yahoo_friend_get_status_message(f))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3688 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3689 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
3690 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3691 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3692 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3693 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3694 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
3695 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3696 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3697
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3698 switch (f->presence) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3699 case YAHOO_PRESENCE_ONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3700 presence = _("Appear Online");
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 case YAHOO_PRESENCE_PERM_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3703 presence = _("Appear Permanently Offline");
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 case YAHOO_PRESENCE_DEFAULT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3706 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 default:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3708 purple_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3709 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3710 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3711 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3712
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713 if (status != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3714 escaped = g_markup_escape_text(status, strlen(status));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3715 purple_notify_user_info_add_pair(user_info, _("Status"), escaped);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3716 g_free(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3717 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3718 }
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 if (presence != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3721 purple_notify_user_info_add_pair(user_info, _("Presence"), presence);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3722 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3723
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3724 static void yahoo_addbuddyfrommenu_cb(PurpleBlistNode *node, gpointer data)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3726 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3727 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3728
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3729 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3730
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3731 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3732 gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3734 yahoo_add_buddy(gc, buddy, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3736
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3737
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3738 static void yahoo_chat_goto_menu(PurpleBlistNode *node, gpointer data)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3739 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3740 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3741 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3742
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3743 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3744
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3745 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3746 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: 24171
diff changeset
3747
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3748 yahoo_chat_goto(gc, purple_buddy_get_name(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3749 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3750
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3751 static GList *build_presence_submenu(YahooFriend *f, PurpleConnection *gc) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3752 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3753 PurpleMenuAction *act;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3754 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
3755
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3756 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3757 if (f->presence != YAHOO_PRESENCE_ONLINE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3758 act = purple_menu_action_new(_("Appear Online"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3759 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3760 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3761 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3762 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3763 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3764 act = purple_menu_action_new(_("Appear Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3765 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3766 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3767 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3768 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3769 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3770 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3772 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3773 act = purple_menu_action_new(_("Don't Appear Permanently Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3774 PURPLE_CALLBACK(yahoo_presence_settings),
15373
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 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3779 act = purple_menu_action_new(_("Appear Permanently Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3780 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3781 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3782 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3783 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3784 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3786 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3787 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3788
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3789 static void yahoo_doodle_blist_node(PurpleBlistNode *node, gpointer data)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3790 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3791 PurpleBuddy *b = (PurpleBuddy *)node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3792 PurpleAccount *account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3793 PurpleConnection *gc = purple_account_get_connection(account);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3794
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3795 yahoo_doodle_initiate(gc, purple_buddy_get_name(b));
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3798 static GList *yahoo_buddy_menu(PurpleBuddy *buddy)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3799 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3800 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3801 PurpleMenuAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3802
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3803 PurpleConnection *gc = purple_account_get_connection(purple_buddy_get_account(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3804 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3805 static char buf2[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3806 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3807
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3808 f = yahoo_friend_find(gc, purple_buddy_get_name(buddy));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3810 if (!f && !yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3811 act = purple_menu_action_new(_("Add Buddy"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3812 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3813 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3814 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3815
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3816 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3817
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3820 if (f && f->status != YAHOO_STATUS_OFFLINE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3821 if (!yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3822 act = purple_menu_action_new(_("Join in Chat"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3823 PURPLE_CALLBACK(yahoo_chat_goto_menu),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3824 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3825 m = g_list_append(m, act);
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3828 act = purple_menu_action_new(_("Initiate Conference"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3829 PURPLE_CALLBACK(yahoo_initiate_conference),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3831 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3832
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3833 if (yahoo_friend_get_game(f)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3834 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
3835 char *room;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3836 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3837
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3838 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
3839 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
3840 room++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3841 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
3842 while (*t != '\n')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3843 t++; /* replace the \n with a space */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3844 *t = ' ';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3845 g_snprintf(buf2, sizeof buf2, "%s", room);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3846
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3847 act = purple_menu_action_new(buf2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3848 PURPLE_CALLBACK(yahoo_game),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3849 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3851 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3852 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3853 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3854
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3855 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3856 act = purple_menu_action_new(_("Presence Settings"), NULL, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3857 build_presence_submenu(f, gc));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 }
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 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3862 act = purple_menu_action_new(_("Start Doodling"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3863 PURPLE_CALLBACK(yahoo_doodle_blist_node),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3864 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3865 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3866 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 return m;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3871 static GList *yahoo_blist_node_menu(PurpleBlistNode *node)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3872 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3873 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3874 return yahoo_buddy_menu((PurpleBuddy *) node);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3875 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3876 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3877 }
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3880 static void yahoo_act_id(PurpleConnection *gc, const char *entry)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3882 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3883
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3884 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
3885 yahoo_packet_hash_str(pkt, 3, entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3886 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3887
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3888 purple_connection_set_display_name(gc, entry);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3889 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890
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
3891 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
3892 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
3893 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
3894 {
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
3895 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
3896 gboolean set_cookie = FALSE;
22831
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
3897 gchar *url;
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
3898 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
3899
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 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
3901
22831
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
3902 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
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 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
3905 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
3906 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
3907 /* 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
3908 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
3909 "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
3910 ".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
3911 "&.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
3912 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
3913 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
3914 }
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
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 if (!set_cookie) {
19654
941965d6fd88 Patch from QuLogic. Fixes #2903 ('Missing newlines in debug messages.')
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 19554
diff changeset
3917 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
3918 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
3919 }
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
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 /* 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
3922 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
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 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
3925 }
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
3926
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
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 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
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 /* 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
3931 /* 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
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 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
3934 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
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 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
3937 const char* base_url = "http://login.yahoo.com";
23986
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23693
diff changeset
3938 /* 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: 23693
diff changeset
3939 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: 23693
diff changeset
3940 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: 23693
diff changeset
3941 "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
3942 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\r\n"
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
3943 "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
3944 "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
3945 "Content-Length: 0\r\n\r\n",
23986
18a1f0fe5f40 Do a better job of detecting if the yahoo account is connecting through a HTTP
Daniel Atallah <daniel.atallah@gmail.com>
parents: 23693
diff changeset
3946 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
3947 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
3948
26989
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26893
diff changeset
3949 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: 26893
diff changeset
3950 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: 26893
diff changeset
3951 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
3952 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
3953
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 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
3955
22831
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
3956 if (url_data != NULL)
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
3957 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: 22794
diff changeset
3958 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
3959 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
3960 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
3961 "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
3962 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
3963 }
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
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
3965 }
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
3966
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
3967
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3968 static void yahoo_show_act_id(PurplePluginAction *action)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3969 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3970 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3971 purple_request_input(gc, NULL, _("Activate which ID?"), NULL,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3972 purple_connection_get_display_name(gc), FALSE, FALSE, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3973 _("OK"), G_CALLBACK(yahoo_act_id),
16439
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
3974 _("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
3975 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3976 gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3977 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3979 static void yahoo_show_chat_goto(PurplePluginAction *action)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3980 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3981 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3982 purple_request_input(gc, NULL, _("Join whom in chat?"), NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3983 "", FALSE, FALSE, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3984 _("OK"), G_CALLBACK(yahoo_chat_goto),
16439
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
3985 _("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
3986 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
3987 gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3988 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3989
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3990 static GList *yahoo_actions(PurplePlugin *plugin, gpointer context) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3991 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3992 PurplePluginAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3993
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3994 act = purple_plugin_action_new(_("Activate ID..."),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3995 yahoo_show_act_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3996 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3997
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3998 act = purple_plugin_action_new(_("Join User in Chat..."),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3999 yahoo_show_chat_goto);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4000 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4001
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
4002 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
4003 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
4004 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
4005 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
4006
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4008 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4010 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: 26154
diff changeset
4011 PurpleConnection *gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4012 char *who;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4013 char *what;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4014 };
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4015
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4016 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: 26154
diff changeset
4017
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4018 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: 26154
diff changeset
4019 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: 26154
diff changeset
4020 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4021 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: 26154
diff changeset
4022 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: 26154
diff changeset
4023 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: 26154
diff changeset
4024 char *mobile_no = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4025 char *status = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4026 char *carrier = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4027 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: 26154
diff changeset
4028 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: 26154
diff changeset
4029
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4030 if (error_message != NULL) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4031 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: 26154
diff changeset
4032
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4033 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: 26154
diff changeset
4034 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: 26154
diff changeset
4035 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: 26154
diff changeset
4036 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4037 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4038 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: 26154
diff changeset
4039 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: 26154
diff changeset
4040 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: 26154
diff changeset
4041 mobile_no = (char *)xmlnode_get_attrib(validate_data_child, "msisdn");
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
4042
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4043 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: 26154
diff changeset
4044 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: 26154
diff changeset
4045 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: 26154
diff changeset
4046
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4047 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: 26154
diff changeset
4048 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: 26154
diff changeset
4049
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4050 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: 26154
diff changeset
4051
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4052 if( strcmp(status, "Valid") == 0) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4053 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: 26154
diff changeset
4054 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: 26154
diff changeset
4055 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4056 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4057 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: 26154
diff changeset
4058 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: 26154
diff changeset
4059 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4060
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4061 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: 26154
diff changeset
4062 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: 26154
diff changeset
4063 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: 26154
diff changeset
4064 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: 26154
diff changeset
4065 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: 26154
diff changeset
4066 g_free(mobile_no);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4067 g_free(status);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4068 g_free(carrier);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4069 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4070 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4071
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4072 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: 26154
diff changeset
4073 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4074 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: 26154
diff changeset
4075 PurpleUtilFetchUrlData *url_data;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4076 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: 26154
diff changeset
4077 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: 26154
diff changeset
4078 char *request = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4079 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: 26154
diff changeset
4080 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: 26154
diff changeset
4081 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: 26154
diff changeset
4082
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4083 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: 26154
diff changeset
4084 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4085
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4086 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: 26154
diff changeset
4087 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: 26154
diff changeset
4088 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: 26154
diff changeset
4089 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: 26154
diff changeset
4090
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4091 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: 26154
diff changeset
4092 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: 26154
diff changeset
4093
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4094 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: 26154
diff changeset
4095
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4096 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: 26154
diff changeset
4097 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: 26154
diff changeset
4098
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4099 request = g_strdup_printf(
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4100 "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: 26154
diff changeset
4101 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\r\n"
26827
fac90dbe196d Various minor cleanups. The majority of this is the #define for the useragent.
Paul Aurich <paul@darkrain42.org>
parents: 26825
diff changeset
4102 "User-Agent: " YAHOO_CLIENT_USERAGENT "\r\n"
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4103 "Host: validate.msg.yahoo.com\r\n"
26545
98d8c336234d Fix two int/size_t format build warnings on 64-bit
Paul Aurich <paul@darkrain42.org>
parents: 26511
diff changeset
4104 "Content-Length: %" G_GSIZE_FORMAT "\r\n"
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4105 "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: 26154
diff changeset
4106 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: 26154
diff changeset
4107
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4108 /* 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: 26154
diff changeset
4109 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: 26154
diff changeset
4110 use_whole_url = TRUE;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4111
26989
077eae6f3d84 Update the yahoo prpl to use the new function I added. This should fix the
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 26893
diff changeset
4112 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: 26893
diff changeset
4113 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: 26893
diff changeset
4114 YAHOO_CLIENT_USERAGENT, TRUE, request, FALSE, -1,
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4115 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: 26154
diff changeset
4116
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4117 g_free(request);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4118 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: 26154
diff changeset
4119
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4120 if (!url_data) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4121 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: 26154
diff changeset
4122 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: 26154
diff changeset
4123 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: 26154
diff changeset
4124 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: 26154
diff changeset
4125 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: 26154
diff changeset
4126 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: 26154
diff changeset
4127 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4128 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4129
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4130 static int yahoo_send_im(PurpleConnection *gc, const char *who, const char *what, PurpleMessageFlags flags)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4131 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132 struct yahoo_data *yd = gc->proto_data;
26163
2cc85ecc27ef initialize *pkt to NULL, remove a warning from the compiler
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26162
diff changeset
4133 struct yahoo_packet *pkt = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4134 char *msg = yahoo_html_to_codes(what);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135 char *msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4136 gboolean utf8 = TRUE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4137 PurpleWhiteboard *wb;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4138 int ret = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4139 YahooFriend *f = NULL;
24400
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4140 gsize lenb = 0;
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4141 glong lenc = 0;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4142 struct yahoo_p2p_data *p2p_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4143 gboolean msn = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4144 msg2 = yahoo_string_encode(gc, msg, &utf8);
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
4145
24400
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4146 if(msg2) {
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4147 lenb = strlen(msg2);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4148 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: 24171
diff changeset
4149
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4150 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: 24171
diff changeset
4151 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: 24171
diff changeset
4152 " 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: 24171
diff changeset
4153 " 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: 24171
diff changeset
4154 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: 24171
diff changeset
4155 g_free(msg);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4156 g_free(msg2);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4157 return -E2BIG;
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4158 }
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4159 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4160
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4161 msn = g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/");
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4162
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4163 if( strncmp(who, "+", 1) == 0 ) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4164 /* 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: 26154
diff changeset
4165 gchar *carrier = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4166 const char *alias = NULL;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4167 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: 26154
diff changeset
4168 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: 26154
diff changeset
4169
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4170 carrier = g_hash_table_lookup(yd->sms_carrier, who);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4171 if (!carrier) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4172 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: 26154
diff changeset
4173 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: 26154
diff changeset
4174 sms_cb_data->gc = gc;
27107
55811a205c71 NULL terminate some strings. Hopefully stop Yahoo texting crashes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27057
diff changeset
4175 sms_cb_data->who = g_strdup(who);
55811a205c71 NULL terminate some strings. Hopefully stop Yahoo texting crashes.
Mike Ruprecht <maiku@soc.pidgin.im>
parents: 27057
diff changeset
4176 sms_cb_data->what = g_strdup(what);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4177
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4178 purple_conversation_write(conv, NULL, "Getting mobile carrier to send the sms", PURPLE_MESSAGE_SYSTEM, time(NULL));
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
4179
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4180 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: 26154
diff changeset
4181
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4182 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4183 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4184 return ret;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4185 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4186 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: 26154
diff changeset
4187 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: 26154
diff changeset
4188
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4189 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4190 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4191 return -1;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4192 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4193
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4194 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: 26154
diff changeset
4195 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: 26154
diff changeset
4196 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: 26154
diff changeset
4197 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: 26154
diff changeset
4198 69, alias,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4199 5, who + 1,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4200 68, carrier,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4201 14, msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4202 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: 26154
diff changeset
4203
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4204 g_free(msg);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4205 g_free(msg2);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4206
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4207 return ret;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4208 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4209
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4210 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4211 if(msn) {
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4212 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: 26159
diff changeset
4213 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: 26159
diff changeset
4214 }
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4215 else {
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4216 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: 26159
diff changeset
4217 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: 26159
diff changeset
4218 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: 26159
diff changeset
4219 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4220
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4221 if (utf8)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4222 yahoo_packet_hash_str(pkt, 97, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4223 yahoo_packet_hash_str(pkt, 14, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4224
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4225 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4226 * IMVironment.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4227 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4228 * 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
4229 * 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
4230 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4231 * 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
4232 * 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
4233 * to nothing.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4234 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4235 * 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
4236 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4237 wb = purple_whiteboard_get_session(gc->account, who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4238 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
4239 yahoo_packet_hash_str(pkt, 63, DOODLE_IMV_KEY);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4240 else
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 const char *imv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4243 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
4244 if (imv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4245 yahoo_packet_hash_str(pkt, 63, imv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4246 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4247 yahoo_packet_hash_str(pkt, 63, ";0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4248 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4249
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4250 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
4251 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
4252 if (!yd->picture_url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4253 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
4254 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4255 yahoo_packet_hash_str(pkt, 206, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4256
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4257 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4258 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4259 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4260 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4261 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: 26154
diff changeset
4262 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: 26154
diff changeset
4263 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4264 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4265 yahoo_packet_send(pkt, yd);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4266 if(!msn)
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4267 yahoo_send_p2p_pkt(gc, who, 0); /* send p2p packet, with val_13=0 */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4268 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4269 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4270 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4271 ret = -E2BIG;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4272
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4273 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4275 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4276 g_free(msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4277
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4278 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4280
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4281 static unsigned int yahoo_send_typing(PurpleConnection *gc, const char *who, PurpleTypingState state)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4282 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4283 struct yahoo_data *yd = gc->proto_data;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4284 struct yahoo_p2p_data *p2p_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4285 gboolean msn = (g_str_has_prefix(who, "msn/") || g_str_has_prefix(who, "MSN/"));
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4286 struct yahoo_packet *pkt = NULL;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4287
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4288 /* 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: 26154
diff changeset
4289 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: 26154
diff changeset
4290 return 0;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4291
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4292 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: 26159
diff changeset
4293
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4294 /* check to see if p2p link exists, send through it */
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4295 if( (p2p_data = g_hash_table_lookup(yd->peers, who)) && !msn ) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4296 yahoo_packet_hash(pkt, "sssssis", 49, "TYPING", 1, purple_connection_get_display_name(gc),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4297 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
27111
510f07e1f5c1 Strip trailing whitespace and comment #endif marcos that close #ifdef macros
Mark Doliner <mark@kingant.net>
parents: 27107
diff changeset
4298 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4299 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: 26154
diff changeset
4300 yahoo_packet_free(pkt);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4301 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4302 else { /* send through yahoo server */
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4303 if(msn)
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4304 yahoo_packet_hash(pkt, "sssssss", 49, "TYPING", 1, purple_connection_get_display_name(gc),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4305 14, " ", 13, state == PURPLE_TYPING ? "1" : "0",
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4306 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: 26159
diff changeset
4307 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4308 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: 26159
diff changeset
4309 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: 26159
diff changeset
4310 5, who+4, 1002, "1");
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4311 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: 26154
diff changeset
4312 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4313
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4314 return 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4315 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4316
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4317 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
4318 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4319 YahooFriend *f = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4320 if (f && f->presence == YAHOO_PRESENCE_ONLINE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4321 f->presence = YAHOO_PRESENCE_DEFAULT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4322 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4323
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4324 static void yahoo_set_status(PurpleAccount *account, PurpleStatus *status)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4325 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4326 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4327 PurplePresence *presence;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4328 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4329 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4330 int old_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4331 const char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4332 char *tmp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4333 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
4334 gboolean utf8 = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4335
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4336 if (!purple_status_is_active(status))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4337 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4338
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4339 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4340 presence = purple_status_get_presence(status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4341 yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4342 old_status = yd->current_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4343
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4344 yd->current_status = get_yahoo_status_from_purple_status(status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4345
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4346 if (yd->current_status == YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4347 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4348 msg = purple_status_get_attr_string(status, "message");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4349
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4350 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
4351 tmp = yahoo_string_encode(gc, msg, &utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4352 conv_msg = purple_markup_strip_html(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4353 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4354 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4355 if ((msg == NULL) || (*msg == '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4356 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
4357 tmp = yahoo_string_encode(gc, msg, &utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4358 conv_msg = purple_markup_strip_html(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4359 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4360 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4361 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4363 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4364 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
4365 yahoo_packet_hash_str(pkt, 13, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4366 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4368 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4369 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4370
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4371 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
4372 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
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_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
4375 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4376 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
4377 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4378 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4379 }
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 g_free(conv_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4382
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4383 if (purple_presence_is_idle(presence))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4384 yahoo_packet_hash_str(pkt, 47, "2");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4385 else if (!purple_status_is_available(status))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4386 yahoo_packet_hash_str(pkt, 47, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4387
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4388 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4390 if (old_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4391 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
4392 yahoo_packet_hash_str(pkt, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4393 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4395 /* Any per-session presence settings are removed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4396 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
4397
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4400
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4401 static void yahoo_set_idle(PurpleConnection *gc, int idle)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4402 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4403 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4404 struct yahoo_packet *pkt = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4405 char *msg = NULL, *msg2 = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4406 PurpleStatus *status = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4407
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4408 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
4409 yd->current_status = YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4410 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4411 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: 15743
diff changeset
4412 yd->current_status = get_yahoo_status_from_purple_status(status);
15373
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4415 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
4416
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4417 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
4418 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4419 const char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4420 if (status == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4421 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: 15743
diff changeset
4422 tmp = purple_status_get_attr_string(status, "message");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4423 if (tmp != NULL) {
26871
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26852
diff changeset
4424 gboolean utf8 = TRUE;
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26852
diff changeset
4425 msg = yahoo_string_encode(gc, tmp, &utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4426 msg2 = purple_markup_strip_html(msg);
26871
f47f6f6ba439 Preserve utf-8 status messages when going idle.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26852
diff changeset
4427 yahoo_packet_hash_str(pkt, 97, utf8 ? "1" : 0);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4428 yahoo_packet_hash_str(pkt, 19, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4429 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4430 /* get_yahoo_status_from_purple_status() returns YAHOO_STATUS_CUSTOM for
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4431 * 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
4432 yahoo_packet_hash_str(pkt, 19, _("Away"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4433 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4434 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4435 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4436 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4437
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4438 if (idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4439 yahoo_packet_hash_str(pkt, 47, "2");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4440 else if (!purple_presence_is_available(purple_account_get_presence(purple_connection_get_account(gc))))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4441 yahoo_packet_hash_str(pkt, 47, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4443 yahoo_packet_send_and_free(pkt, yd);
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 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4446 g_free(msg2);
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4449 static GList *yahoo_status_types(PurpleAccount *account)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4450 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4451 PurpleStatusType *type;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4452 GList *types = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4453
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4454 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4455 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4456 "message", _("Message"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4457 purple_value_new(PURPLE_TYPE_STRING), NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4458 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4459
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4460 type = purple_status_type_new_with_attrs(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4461 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4462 "message", _("Message"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4463 purple_value_new(PURPLE_TYPE_STRING), NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4464 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4465
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4466 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4467 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4468
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4469 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4470 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4471
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4472 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4473 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4474
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4475 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4476 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4477
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4478 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4479 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4480
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4481 type = purple_status_type_new(PURPLE_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4482 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4483
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4484 type = purple_status_type_new(PURPLE_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4485 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4486
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4487 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4488 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4489
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4490 type = purple_status_type_new(PURPLE_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4491 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4493
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4494 type = purple_status_type_new(PURPLE_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4495 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4496
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4497 type = purple_status_type_new(PURPLE_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4498 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4499
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4500 type = purple_status_type_new_full(PURPLE_STATUS_MOBILE, YAHOO_STATUS_TYPE_MOBILE, NULL, FALSE, FALSE, TRUE);
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
4501 types = g_list_append(types, type);
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
4502
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4503 return types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4504 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4505
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4506 static void yahoo_keepalive(PurpleConnection *gc)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4507 {
24171
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: 24040
diff changeset
4508 struct yahoo_packet *pkt;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4509 struct yahoo_data *yd = gc->proto_data;
24171
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: 24040
diff changeset
4510 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: 24040
diff changeset
4511
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: 24040
diff changeset
4512 /* 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: 24040
diff changeset
4513 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: 24040
diff changeset
4514 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: 24040
diff changeset
4515
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: 24040
diff changeset
4516 /* 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: 24040
diff changeset
4517 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: 24040
diff changeset
4518 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: 24040
diff changeset
4519 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: 24040
diff changeset
4520 } 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: 24040
diff changeset
4521 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: 24040
diff changeset
4522 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: 24040
diff changeset
4523 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: 24040
diff changeset
4524 }
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: 24040
diff changeset
4525 } 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: 24040
diff changeset
4526 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: 24040
diff changeset
4527 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: 24040
diff changeset
4528 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4529 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4530
24171
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: 24040
diff changeset
4531 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: 24040
diff changeset
4532 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: 24040
diff changeset
4533 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: 24040
diff changeset
4534 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: 24040
diff changeset
4535 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: 24040
diff changeset
4536 }
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: 24040
diff changeset
4537
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4538 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4539
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4540 static void yahoo_add_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *g)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4541 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4542 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
4543 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
4544 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
4545 char *group2;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
4546 YahooFriend *f;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4547 const char *bname;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4548 gboolean msn = FALSE;
15373
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 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4551 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4552
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4553 bname = purple_buddy_get_name(buddy);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4554 if (!purple_privacy_check(purple_connection_get_account(gc), bname))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4555 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4556
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4557 f = yahoo_friend_find(gc, bname);
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4558 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
4559
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4560 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
4561 if (g)
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4562 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
4563 else
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4564 group = "Buddies";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4565
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4566 group2 = yahoo_string_encode(gc, group, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4567 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4568 if(msn) {
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4569 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: 26154
diff changeset
4570 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4571 65, group2,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4572 97, "1",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4573 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: 26154
diff changeset
4574 302, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4575 300, "319",
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4576 7, bname + 4,
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4577 241, "2",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4578 334, "0",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4579 301, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4580 303, "319"
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4581 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4582 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4583 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4584 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: 26154
diff changeset
4585 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4586 65, group2,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4587 97, "1",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4588 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: 26154
diff changeset
4589 302, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4590 300, "319",
26172
7114d475a9e7 propagate from branch 'im.pidgin.pidgin' (head aa9e255d8e32921a2fe4e6bd74fe36d1ffdc9ec1)
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26171 25925
diff changeset
4591 7, bname,
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4592 334, "0",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4593 301, "319",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4594 303, "319"
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4595 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4596 }
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4597 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
4598 yahoo_packet_hash_int(pkt, 241, f->protocol);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4599
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4600 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4601 g_free(group2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4602 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4603
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4604 static void yahoo_remove_buddy(PurpleConnection *gc, PurpleBuddy *buddy, PurpleGroup *group)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4605 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4606 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4607 struct yahoo_packet *pkt;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4608 GSList *buddies, *l;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4609 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4610 gboolean remove = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4611 char *cg;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4612 const char *bname, *gname;
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4613 YahooFriend *f = NULL;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4614 gboolean msn = FALSE;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4615
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4616 bname = purple_buddy_get_name(buddy);
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4617 f = yahoo_friend_find(gc, bname);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4618 if (!f)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4619 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4620
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4621 gname = purple_group_get_name(group);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4622 buddies = purple_find_buddies(purple_connection_get_account(gc), bname);
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4623 if(f->protocol == 2)
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4624 msn = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4625 for (l = buddies; l; l = l->next) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4626 g = purple_buddy_get_group(l->data);
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4627 if (purple_utf8_strcasecmp(gname, purple_group_get_name(g))) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4628 remove = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4629 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4630 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4631 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4632
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4633 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4634
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4635 if (remove)
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4636 g_hash_table_remove(yd->friends, bname);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4637
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4638 cg = yahoo_string_encode(gc, gname, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4639 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4640
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4641 if(msn)
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4642 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4643 7, bname+4, 65, cg);
26160
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4644 else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
4645 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4646 7, bname, 65, cg);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4647 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4648 yahoo_packet_hash_int(pkt, 241, f->protocol);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4649 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4650 g_free(cg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4651 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4652
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4653 static void yahoo_add_deny(PurpleConnection *gc, const char *who) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4654 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
4655 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4656
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4657 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4658 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4659
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4660 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4661 return;
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 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4664 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4665 7, who, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4666 yahoo_packet_send_and_free(pkt, yd);
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4669 static void yahoo_rem_deny(PurpleConnection *gc, const char *who) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4670 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
4671 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4672
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4673 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4674 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4675
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4676 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4677 return;
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 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4680 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc), 7, who, 13, "2");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4681 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4683
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4684 static void yahoo_set_permit_deny(PurpleConnection *gc)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4685 {
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4686 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4687 GSList *deny;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4688
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4689 account = purple_connection_get_account(gc);
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4690
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4691 switch (account->perm_deny)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4692 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4693 case PURPLE_PRIVACY_ALLOW_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4694 for (deny = account->deny; deny; deny = deny->next)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4695 yahoo_rem_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4696 break;
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4697
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4698 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
4699 case PURPLE_PRIVACY_ALLOW_USERS:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4700 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
4701 case PURPLE_PRIVACY_DENY_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
4702 for (deny = account->deny; deny; deny = deny->next)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4703 yahoo_add_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4704 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4705 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4706 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4707
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4708 static gboolean yahoo_unload_plugin(PurplePlugin *plugin)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4709 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4710 yahoo_dest_colorht();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4712 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4713 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4714
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4715 static void yahoo_change_buddys_group(PurpleConnection *gc, const char *who,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4716 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
4717 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4718 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4719 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4720 char *gpn, *gpo;
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4721 YahooFriend *f = yahoo_friend_find(gc, who);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4722 gboolean msn = FALSE;
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4723 const char *temp = NULL;
15373
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 /* 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
4726 * don't bother letting the server know.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4727 */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4728 if (!f)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4729 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4730
26825
53d4b3a1c80f Whitespace, syntatic sugar, move the URLs to yahoo.h, and escape the token-fetching URL parameters.
Paul Aurich <paul@darkrain42.org>
parents: 26824
diff changeset
4731 if(f->protocol == 2) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4732 msn = TRUE;
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4733 temp = who+4;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4734 } else
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4735 temp = who;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4736
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4737 /* 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
4738 * 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
4739 * 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
4740 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4741 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
4742 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
4743 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4744 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4745 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4746 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4747 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4748
19189
07413ddcd49c Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents: 18769
diff changeset
4749 pkt = yahoo_packet_new(YAHOO_SERVICE_CHGRP_15, YAHOO_STATUS_AVAILABLE, 0);
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4750 if(f->protocol)
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4751 yahoo_packet_hash(pkt, "ssssissss", 1, purple_connection_get_display_name(gc),
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4752 302, "240", 300, "240", 7, temp, 241, f->protocol, 224, gpo, 264, gpn, 301,
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4753 "240", 303, "240");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4754 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4755 yahoo_packet_hash(pkt, "ssssssss", 1, purple_connection_get_display_name(gc),
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
4756 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
4757 "240", 303, "240");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4758 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4759
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4760 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4761 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4762 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4763
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4764 static void yahoo_rename_group(PurpleConnection *gc, const char *old_name,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4765 PurpleGroup *group, GList *moved_buddies)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4766 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4767 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4768 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4769 char *gpn, *gpo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4770
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4771 gpn = yahoo_string_encode(gc, purple_group_get_name(group), NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4772 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
4773 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4774 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4775 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4776 return;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4779 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4780 yahoo_packet_hash(pkt, "sss", 1, purple_connection_get_display_name(gc),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4781 65, gpo, 67, gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4782 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4783 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4784 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4785 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4787 /********************************* Commands **********************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4788
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4789 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4790 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: 15743
diff changeset
4791 PurpleAccount *account = purple_conversation_get_account(c);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4792
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4793 if (*args && args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4794 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4795
23693
797377cbd5bf Change the other prpls to use new purple_prpl_{send,got}_attention API.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 23402
diff changeset
4796 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
4797
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4798 return PURPLE_CMD_RET_OK;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4799 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4800
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4801 static PurplePlugin *my_protocol = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4802
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4803 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4804 yahoopurple_cmd_chat_join(PurpleConversation *conv, const char *cmd,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4805 char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4806 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4807 GHashTable *comp;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4808 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4809 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4810 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4811
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4812 if (!args || !args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4813 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4814
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4815 gc = purple_conversation_get_gc(conv);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4816 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4817 id = yd->conf_id;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4818 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4819 "Trying to join %s \n", args[0]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4820
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4821 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
24897
b26e8a41a937 Plug a small leak
Daniel Atallah <daniel.atallah@gmail.com>
parents: 24593
diff changeset
4822 g_hash_table_replace(comp, g_strdup("room"), g_ascii_strdown(args[0], -1));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4823 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
4824
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4825 yahoo_c_join(gc, comp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4826
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4827 g_hash_table_destroy(comp);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4828 return PURPLE_CMD_RET_OK;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4829 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4830
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4831 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4832 yahoopurple_cmd_chat_list(PurpleConversation *conv, const char *cmd,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4833 char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4834 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4835 PurpleAccount *account = purple_conversation_get_account(conv);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4836 if (*args && args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4837 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4838 purple_roomlist_show_with_account(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4839 return PURPLE_CMD_RET_OK;
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4842 static gboolean yahoo_offline_message(const PurpleBuddy *buddy)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4843 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4844 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4845 }
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: 19719
diff changeset
4846
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4847 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
4848 {
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4849 PurpleConversation *c;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4850
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: 19719
diff changeset
4851 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
4852 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
4853
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4854 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
4855
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4856 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
4857 "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
4858 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
4859
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4860 return TRUE;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4861 }
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4862
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4863 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
4864 {
19465
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
4865 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
4866
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
4867 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
4868 /* 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
4869 /* 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
4870 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
4871 _("%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: 19719
diff changeset
4872 }
19464
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 return list;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
4875 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4876
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4877 /************************** Plugin Initialization ****************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4878 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4879 yahoopurple_register_commands(void)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4880 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4881 purple_cmd_register("join", "s", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4882 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4883 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4884 "prpl-yahoo", yahoopurple_cmd_chat_join,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4885 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4886 purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4887 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4888 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4889 "prpl-yahoo", yahoopurple_cmd_chat_list,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4890 _("list: List rooms on the Yahoo network"), NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4891 purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4892 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4893 "prpl-yahoo", yahoopurple_cmd_buzz,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4894 _("buzz: Buzz a user to get their attention"), NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4895 purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4896 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4897 "prpl-yahoo", yahoo_doodle_purple_cmd_start,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4898 _("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
4899 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4900
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4901 static PurpleAccount *find_acct(const char *prpl, const char *acct_id)
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4902 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4903 PurpleAccount *acct = NULL;
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4904
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4905 /* 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: 15524
diff changeset
4906 if (acct_id) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4907 acct = purple_accounts_find(acct_id, prpl);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4908 if (acct && !purple_account_is_connected(acct))
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4909 acct = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4910 } else { /* Otherwise find an active account for the protocol */
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
4911 GList *l = purple_accounts_get_all();
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4912 while (l) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4913 if (!strcmp(prpl, purple_account_get_protocol_id(l->data))
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4914 && purple_account_is_connected(l->data)) {
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4915 acct = l->data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4916 break;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4917 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4918 l = l->next;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4919 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4920 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4921
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4922 return acct;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4923 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4924
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4925 /* This may not be the best way to do this, but we find the first key w/o a value
25925
6e1967b0f90b Change "screen name" to "username" or "buddy name" in a whole bunch of
Mark Doliner <mark@kingant.net>
parents: 25891
diff changeset
4926 * and assume it is the buddy name */
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4927 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: 15524
diff changeset
4928 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4929 char **retval = user_data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4930
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4931 if (value == NULL && *retval == NULL) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4932 *retval = key;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4933 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4934 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4935
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4936 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: 15524
diff changeset
4937 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4938 char *acct_id = g_hash_table_lookup(params, "account");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4939 PurpleAccount *acct;
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4940
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4941 if (g_ascii_strcasecmp(proto, "ymsgr"))
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4942 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4943
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4944 acct = find_acct(purple_plugin_get_id(my_protocol), acct_id);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4945
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4946 if (!acct)
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4947 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4948
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4949 /* ymsgr:SendIM?screename&m=The+Message */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4950 if (!g_ascii_strcasecmp(cmd, "SendIM")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4951 char *sname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4952 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: 15524
diff changeset
4953 if (sname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4954 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: 15524
diff changeset
4955
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4956 PurpleConversation *conv = purple_find_conversation_with_account(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4957 PURPLE_CONV_TYPE_IM, sname, acct);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4958 if (conv == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4959 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, acct, sname);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4960 purple_conversation_present(conv);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4961
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4962 if (message) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4963 /* Spaces are encoded as '+' */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4964 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
4965 purple_conv_send_confirm(conv, message);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4966 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4967 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4968 /* else
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4969 **If pidgindialogs_im() was in the core, we could use it here.
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4970 * It is all purple_request_* based, but I'm not sure it really belongs in the core
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4971 pidgindialogs_im(); */
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4972
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4973 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4974 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4975 /* ymsgr:Chat?roomname */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4976 else if (!g_ascii_strcasecmp(cmd, "Chat")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4977 char *rname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4978 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: 15524
diff changeset
4979 if (rname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4980 /* 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: 15524
diff changeset
4981 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: 15524
diff changeset
4982 g_hash_table_insert(params, g_strdup("type"), g_strdup("Chat"));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4983 serv_join_chat(purple_account_get_connection(acct), params);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4984 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4985 /* else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4986 ** Same as above (except that this would have to be re-written using purple_request_*)
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4987 pidgin_blist_joinchat_show(); */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4988
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4989 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4990 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4991 /* ymsgr:AddFriend?name */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4992 else if (!g_ascii_strcasecmp(cmd, "AddFriend")) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4993 char *name = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4994 g_hash_table_foreach(params, yahoo_find_uri_novalue_param, &name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4995 purple_blist_request_add_buddy(acct, name, NULL, NULL);
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4996 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4997 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4998
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
4999 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5000 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5001
24040
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5002 static GHashTable *
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5003 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: 23986
diff changeset
5004 {
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5005 GHashTable *table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5006 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: 23986
diff changeset
5007 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: 23986
diff changeset
5008 return table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5009 }
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5010
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5011 static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5012 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5013 yahoo_doodle_start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5014 yahoo_doodle_end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5015 yahoo_doodle_get_dimensions,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5016 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5017 yahoo_doodle_get_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5018 yahoo_doodle_set_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5019 yahoo_doodle_send_draw_list,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5020 yahoo_doodle_clear,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5021
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5022 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5023 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5024 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5025 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5026 NULL
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5029 static PurplePluginProtocolInfo prpl_info =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5030 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5031 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
5032 NULL, /* user_splits */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5033 NULL, /* protocol_options */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5034 {"png,gif,jpeg", 96, 96, 96, 96, 0, PURPLE_ICON_SCALE_SEND},
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5035 yahoo_list_icon,
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
5036 yahoo_list_emblem,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5037 yahoo_status_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5038 yahoo_tooltip_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5039 yahoo_status_types,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5040 yahoo_blist_node_menu,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041 yahoo_c_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5042 yahoo_c_info_defaults,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5043 yahoo_login,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5044 yahoo_close,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5045 yahoo_send_im,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5046 NULL, /* set info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5047 yahoo_send_typing,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5048 yahoo_get_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5049 yahoo_set_status,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5050 yahoo_set_idle,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5051 NULL, /* change_passwd*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5052 yahoo_add_buddy,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5053 NULL, /* add_buddies */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5054 yahoo_remove_buddy,
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
5055 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
5056 NULL, /* add_permit */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5057 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
5058 NULL, /* rem_permit */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5059 yahoo_rem_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5060 yahoo_set_permit_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5061 yahoo_c_join,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5062 NULL, /* reject chat invite */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5063 yahoo_get_chat_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5064 yahoo_c_invite,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5065 yahoo_c_leave,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5066 NULL, /* chat whisper */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5067 yahoo_c_send,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5068 yahoo_keepalive,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5069 NULL, /* register_user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5070 NULL, /* get_cb_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5071 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
5072 yahoo_update_alias, /* alias_buddy */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5073 yahoo_change_buddys_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5074 yahoo_rename_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5075 NULL, /* buddy_free */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5076 NULL, /* convo_closed */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5077 purple_normalize_nocase, /* normalize */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5078 yahoo_set_buddy_icon,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5079 NULL, /* void (*remove_group)(PurpleConnection *gc, const char *group);*/
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5080 NULL, /* char *(*get_cb_real_name)(PurpleConnection *gc, int id, const char *who); */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5081 NULL, /* set_chat_topic */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5082 NULL, /* find_blist_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5083 yahoo_roomlist_get_list,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5084 yahoo_roomlist_cancel,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5085 yahoo_roomlist_expand_category,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5086 NULL, /* can_receive_file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5087 yahoo_send_file,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5088 yahoo_new_xfer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5089 yahoo_offline_message, /* offline_message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5090 &yahoo_whiteboard_prpl_ops,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5091 NULL, /* send_raw */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5092 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
5093 NULL, /* unregister_user */
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5094
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5095 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
5096 yahoo_attention_types,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5097
23109
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22683
diff changeset
5098 sizeof(PurplePluginProtocolInfo), /* struct_size */
24040
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5099 yahoo_get_account_text_table, /* get_account_text_table */
23807
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111 23787
diff changeset
5100 NULL, /* initiate_media */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111 23787
diff changeset
5101 NULL /* can_do_media */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5102 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5103
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5104 static PurplePluginInfo info =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5105 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5106 PURPLE_PLUGIN_MAGIC,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5107 PURPLE_MAJOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5108 PURPLE_MINOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5109 PURPLE_PLUGIN_PROTOCOL, /**< type */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 NULL, /**< ui_requirement */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5111 0, /**< flags */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5112 NULL, /**< dependencies */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5113 PURPLE_PRIORITY_DEFAULT, /**< priority */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5114 "prpl-yahoo", /**< id */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5115 "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
5116 DISPLAY_VERSION, /**< version */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5117 /** summary */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5118 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5119 /** description */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5120 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5121 NULL, /**< author */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5122 PURPLE_WEBSITE, /**< homepage */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5123 NULL, /**< load */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5124 yahoo_unload_plugin, /**< unload */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5125 NULL, /**< destroy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126 NULL, /**< ui_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5127 &prpl_info, /**< extra_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5128 NULL,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5129 yahoo_actions,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5130
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5131 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5132 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5133 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5134 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5135 NULL
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5136 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5138 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5139 init_plugin(PurplePlugin *plugin)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5140 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5141 PurpleAccountOption *option;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5142
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5143 option = purple_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5144 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
5145
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5146 option = purple_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147 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
5148
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5149 option = purple_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5150 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
5151
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5152 option = purple_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5153 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
5154
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5155 option = purple_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5156 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
5157
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5158 option = purple_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5159 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
5160
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5161 option = purple_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 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
5163
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5164 option = purple_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5165 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
5166
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5167 option = purple_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5168 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
5169
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5170 option = purple_account_option_string_new(_("Encoding"), "local_charset", "ISO-8859-1");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5171 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
5172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5173
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5174 #if 0
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5175 option = purple_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5178 option = purple_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5181 option = purple_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT);
15373
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 #endif
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 my_protocol = plugin;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5186 yahoopurple_register_commands();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5187 yahoo_init_colorht();
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5188
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5189 purple_signal_connect(purple_get_core(), "uri-handler", plugin,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5190 PURPLE_CALLBACK(yahoo_uri_handler), NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5191 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5192
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5193 PURPLE_INIT_PLUGIN(yahoo, init_plugin, info);