annotate libpurple/protocols/yahoo/yahoo.c @ 26568:3712d32363dd

Remove a bug where host_ip was accessed after freeing it. This should prevent yahoo prpl crashes. I wonder how such a simple mistake escaped me for so long.
author Sulabh Mahajan <sulabh@soc.pidgin.im>
date Wed, 15 Apr 2009 15:46:31 +0000
parents 98d8c336234d
children 25e01fe7b732 ce876e58cf6a
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_auth.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
48 #include "yahoo_crypt.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
49 #include "yahoo_doodle.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
50 #include "yahoo_filexfer.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
51 #include "yahoo_friend.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
52 #include "yahoo_packet.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
53 #include "yahoo_picture.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
54 #include "ycht.h"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
55
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
56 /* #define YAHOO_DEBUG */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
57
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
58 /* #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
59
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
60 /* 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
61 #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
62
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 /* 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
64 #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
65
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
66 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
67 #ifdef TRY_WEBMESSENGER_LOGIN
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
68 static void yahoo_login_page_cb(PurpleUtilFetchUrlData *url_data, gpointer user_data, const gchar *url_text, size_t len, const gchar *error_message);
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
69 #endif
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
70 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
71
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
72 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
73 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
74 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
75
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
76 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
77 return;
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 if (f->status == YAHOO_STATUS_OFFLINE)
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 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
82 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
83
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
84 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
85 case YAHOO_STATUS_AVAILABLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
86 status = YAHOO_STATUS_TYPE_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
87 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
88 case YAHOO_STATUS_BRB:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
89 status = YAHOO_STATUS_TYPE_BRB;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
90 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
91 case YAHOO_STATUS_BUSY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
92 status = YAHOO_STATUS_TYPE_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
93 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
94 case YAHOO_STATUS_NOTATHOME:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
95 status = YAHOO_STATUS_TYPE_NOTATHOME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
96 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
97 case YAHOO_STATUS_NOTATDESK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
98 status = YAHOO_STATUS_TYPE_NOTATDESK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
99 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
100 case YAHOO_STATUS_NOTINOFFICE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
101 status = YAHOO_STATUS_TYPE_NOTINOFFICE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
102 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
103 case YAHOO_STATUS_ONPHONE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
104 status = YAHOO_STATUS_TYPE_ONPHONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
105 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
106 case YAHOO_STATUS_ONVACATION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
107 status = YAHOO_STATUS_TYPE_ONVACATION;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
108 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
109 case YAHOO_STATUS_OUTTOLUNCH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
110 status = YAHOO_STATUS_TYPE_OUTTOLUNCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
111 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
112 case YAHOO_STATUS_STEPPEDOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
113 status = YAHOO_STATUS_TYPE_STEPPEDOUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
114 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
115 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
116 status = YAHOO_STATUS_TYPE_INVISIBLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
117 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
118 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
119 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
120 if (!f->away)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
121 status = YAHOO_STATUS_TYPE_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
122 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
123 status = YAHOO_STATUS_TYPE_AWAY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
124 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
125 default:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
126 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
127 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
128 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
129
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
130 if (status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
131 if (f->status == YAHOO_STATUS_CUSTOM)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
132 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
133 yahoo_friend_get_status_message(f), NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
134 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
135 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
136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
138 if (f->idle != 0)
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, TRUE, f->idle);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
140 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
141 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
142
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
143 if (f->sms)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
144 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
145 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
146 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
147 }
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 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
150 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
151 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
152 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
153 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
154 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
155 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
156 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
157 char *message = NULL;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
158 char *msn_name = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
159
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
160 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
161 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
162 purple_account_set_password(account, NULL);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
163 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
164 _("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
165 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
166 }
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
169 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
170
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
171 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
172 case 0: /* we won't actually do anything with this */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
173 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
174 case 1: /* we don't get the full buddy list here. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
175 if (!yd->logged_in) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
176 purple_connection_set_display_name(gc, pair->value);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
177 purple_connection_set_state(gc, PURPLE_CONNECTED);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
178 yd->logged_in = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
179 if (yd->picture_upload_todo) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
180 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
181 yd->picture_upload_todo = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
182 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
183 yahoo_set_status(account, purple_account_get_active_status(account));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
184
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
185 /* this requests the list. i have a feeling that this is very evil
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
186 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
187 * scs.yahoo.com sends you the list before this packet without it being
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
188 * requested
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
189 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
190 * do_import(gc, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
191 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
192 * yahoo_packet_send_and_free(newpkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
193 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
196 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
197 case 8: /* how many online buddies we have */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
198 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
199 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
200 /* 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
201 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
202 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
203 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
204 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
205 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
206 }
a1cf5440d945 Set the custom status message for yahoo buddies correctly at login time. Fixes #2754.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19393
diff changeset
207 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
208 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
209 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
210 name = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
211 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
212 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
213 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
214 case 10: /* state */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
215 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
216 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
217
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
218 f->status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
219 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
220 f->away = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
221 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
222 f->away = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
224 if (f->status == YAHOO_STATUS_IDLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
225 /* 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
226 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
227 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
228 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
229 f->idle = 0;
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 if (f->status != YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
232 yahoo_friend_set_status_message(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
234 f->sms = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
235 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
236 case 19: /* custom message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
237 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
238 message = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
239 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
240 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
241 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
242 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
243 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
244 case 17: /* in chat? */
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 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
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 /* 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
251 * 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
252 * mean idle. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
253 if (f->status == YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
254 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
255
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
256 f->away = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
257 if (f->away == 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
258 /* 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
259 if (f->idle == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
260 f->idle = time(NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
261 }
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 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
265 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
266 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
267
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
268 if (f->idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
269 f->idle = -1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
270 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
271 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
272 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
273 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
274
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
275 if (f->status != YAHOO_STATUS_AVAILABLE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
276 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
277 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
278 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
279 if (strtol(pair->value, NULL, 10) == 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
280 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
281 f->status = YAHOO_STATUS_OFFLINE;
15524
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
282 if (name) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
283 purple_prpl_got_user_status(account, name, "offline", NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
284 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
285 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
286 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
287 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
288 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
289 case 60: /* SMS */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
290 if (f) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
291 f->sms = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
292 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
293 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
294 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
295 case 197: /* Avatars */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
296 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
297 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
298 char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
299 gsize len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
300
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
301 if (pair->value) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
302 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
303 if (len) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
304 tmp = purple_str_binary_to_ascii(decoded, len);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
305 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
306 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
307 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
308 g_free(decoded);
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 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
311 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
312 case 192: /* Pictures, aka Buddy Icons, checksum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
313 {
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
314 /* 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
315 * 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
316 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
317 const char *locksum = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
318 PurpleBuddy *b;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
319
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
320 if (!name)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
321 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
322
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
323 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
324
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
325 if (!cksum || (cksum == -1)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
326 if (f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
327 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
328 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
329 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
330 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
331
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
332 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
333 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
334
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
335 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
336 if (b) {
6ec8bae7d98a Patch #1038. Fix receiving of Yahoo buddy icons. Thanks, vampire!
Sean Egan <seanegan@gmail.com>
parents: 16987
diff changeset
337 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
338 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
339 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
340 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
342 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 case 16: /* Custom error message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
345 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
346 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
347 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
348 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
349 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
350 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
351 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
352 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
353 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
354 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
355 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
356 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
357 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
358 case 241: /* protocol buddy belongs to */
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
359 if(strtol(pair->value, NULL, 10) == 2) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
360 msn_name = g_strconcat("msn/", name, NULL);
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
361 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
362 }
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
363 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
364 default:
22668
3378d2701c2b I don't consider this an error.
Mark Doliner <mark@kingant.net>
parents: 22424
diff changeset
365 purple_debug_warning("yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
366 "Unknown status key %d\n", pair->key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
367 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
368 }
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 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
371 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
372
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
373 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
374 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
375
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
376 if (name && f) /* update the last buddy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
377 yahoo_update_status(gc, name, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
378 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
379
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
380 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
381 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
382 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
383 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
384 GSList *list, *i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
385 gboolean onlist = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
386 char *oname = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
387 char **oname_p = &oname;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
388 GSList **list_p = &list;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
389
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
390 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
391 list = purple_find_buddies(account, name);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
392 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
393 g_hash_table_steal(ht, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
394
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
395 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
396 b = i->data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
397 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
398 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
399 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
400 "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
401 list = g_slist_delete_link(list, i);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
402 onlist = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
403 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
404 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
405 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
406
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
407 if (!onlist) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
408 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
409 "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
410 if (!(g = purple_find_group(group))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
411 g = purple_group_new(group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
412 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
413 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
414 b = purple_buddy_new(account, name, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
415 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
416 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
417
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
418 if (list) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
419 if (!oname)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
420 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
421 g_hash_table_insert(ht, oname, list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
422 } else if (oname)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
423 g_free(oname);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
424 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
425
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
426 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
427 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
428 char *name = key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
429 GSList *list = value, *i;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
430 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
431 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
433 for (i = list; i; i = i->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
434 b = i->data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
435 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
436 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
437 purple_group_get_name(g));
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
438 purple_blist_remove_buddy(b);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
439 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
440 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
442 static char *_getcookie(char *rawcookie)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
443 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
444 char *cookie = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
445 char *tmpcookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
446 char *cookieend;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
447
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
448 if (strlen(rawcookie) < 2)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
449 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
450 tmpcookie = g_strdup(rawcookie+2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
451 cookieend = strchr(tmpcookie, ';');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
452
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
453 if (cookieend)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
454 *cookieend = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
455
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
456 cookie = g_strdup(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
457 g_free(tmpcookie);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
458
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
459 return cookie;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
460 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
461
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
462 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
463 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
464 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
465 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
466 g_free(yd->cookie_y);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
467 yd->cookie_y = _getcookie(c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
468 } 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
469 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
470 g_free(yd->cookie_t);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
471 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
472 } else
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
473 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
474 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
475 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
476
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
477 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
478 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
479 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
480
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
481 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
482 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
483 GHashTable *ht;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
484 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
485 char *temp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
486 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
487 /* But what if you had no friends? */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
488 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
489 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
490 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
491 int stealth = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
492
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
493
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
494 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
495
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
496 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
497 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
498 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
499
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
500 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
501 case 302:
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
502 /* 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
503 * 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
504 * 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
505 * 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
506 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
507 if (pair->value && !strcmp(pair->value, "320")) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
508 /* 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
509 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
510 yd->current_list15_grp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
511 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
512
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
513 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
514 case 301: /* This is 319 before all s/n's in a group after the first. It is followed by an identical 300. */
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
515 if(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
516 if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
517 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
518 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
519 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
520
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 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
522 /* 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
523 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
524 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
525 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
526 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
527 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
528 }
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 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
530 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
531 }
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
532 yahoo_do_group_check(account, ht, norm_bud, 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
533 if(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
534 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
535 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
536 }
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
537 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
538 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
539
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 /* set p2p status not connected and no p2p packet sent */
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
541 if(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
542 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
543 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
544 } else
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
545 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
546 } 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
547 /* 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
548 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
549 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
550 }
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
551
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
552 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
553 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
554 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
555 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
556 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
557 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
558 case 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
559 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
560 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
561 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
562 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
563 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
564 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
565 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
566 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
567 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
568 protocol = strtol(pair->value, NULL, 10);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
569 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
570 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
571 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
572 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
573 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
574 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
575 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
576 /* case 242: */ /* this seems related to 241 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
577 /* break; */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
579 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
580
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
581 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
582 g_hash_table_destroy(ht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
583 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
584 g_free(temp);
15373
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
587 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
588 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
589 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
590 gboolean export = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
591 gboolean got_serv_list = FALSE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
592 PurpleBuddy *b;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
593 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
594 YahooFriend *f = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
595 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
596 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
597 GHashTable *ht;
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 char **lines;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
600 char **split;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
601 char **buddies;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
602 char **tmp, **bud, *norm_bud;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
603 char *grp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
604
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
605 if (pkt->id)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
606 yd->session_id = pkt->id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
608 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
609 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
610 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
611
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
612 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
613 case 87:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
614 if (!yd->tmp_serv_blist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
615 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
616 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
617 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
618 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
619 case 88:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
620 if (!yd->tmp_serv_ilist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
621 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
622 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
623 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
624 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
625 case 59: /* cookies, yum */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
626 yahoo_process_cookie(yd, pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
627 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
628 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
629 if (!yd->tmp_serv_plist)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
630 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
631 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
632 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
633 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
634 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
635 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
636
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
637 if (pkt->status != 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
638 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
639
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
640 if (yd->tmp_serv_blist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
641 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
642
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
643 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
644 for (tmp = lines; *tmp; tmp++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
645 split = g_strsplit(*tmp, ":", 2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
646 if (!split)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
647 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
648 if (!split[0] || !split[1]) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
649 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
650 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
651 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
652 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
653 buddies = g_strsplit(split[1], ",", -1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
654 for (bud = buddies; bud && *bud; bud++) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
655 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
656 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
657
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
658 if (!(b = purple_find_buddy(account, norm_bud))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
659 if (!(g = purple_find_group(grp))) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
660 g = purple_group_new(grp);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
661 purple_blist_add_group(g, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
662 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
663 b = purple_buddy_new(account, norm_bud, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
664 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
665 export = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
666 }
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 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
669 /* 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
670 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
671 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
672
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
673 g_free(norm_bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
674 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
675 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
676 g_strfreev(split);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
677 g_free(grp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
678 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
679 g_strfreev(lines);
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_string_free(yd->tmp_serv_blist, TRUE);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
682 yd->tmp_serv_blist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
683 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
684 g_hash_table_destroy(ht);
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 (yd->tmp_serv_ilist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
688 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
689 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
690 /* The server is already ignoring the user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
691 got_serv_list = TRUE;
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
692 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
693 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
694 g_strfreev(buddies);
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 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
697 yd->tmp_serv_ilist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
698 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
700 if (got_serv_list &&
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
701 ((account->perm_deny != PURPLE_PRIVACY_ALLOW_BUDDYLIST) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
702 (account->perm_deny != PURPLE_PRIVACY_DENY_ALL) &&
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
703 (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
704 {
22236
2bd5411b49db Some very minor cleanup
Mark Doliner <mark@kingant.net>
parents: 22230
diff changeset
705 account->perm_deny = PURPLE_PRIVACY_DENY_USERS;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
706 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
707 account->username);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
708 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
709
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
710 if (yd->tmp_serv_plist) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
711 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
712 for (bud = buddies; bud && *bud; bud++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
713 f = yahoo_friend_find(gc, *bud);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
714 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
715 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
716 account->username, *bud);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
717 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
719 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
720 g_strfreev(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
721 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
722 yd->tmp_serv_plist = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
723
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
724 }
18763
08a6a01b7ebe Yahoo server-side aliases patch from John Moody. Fixes #1653 Thanks!
Sean Egan <seanegan@gmail.com>
parents: 18758
diff changeset
725 /* 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
726 yahoo_fetch_aliases(gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
727 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
728
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
729 /* 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
730 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
731 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
732 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
733 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
734 char *from = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
735 char *stat = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
736 char *game = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
737 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
738 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
739 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
740 struct yahoo_data *yd = gc->proto_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
741 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
742 char *msn_from = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
743
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
744 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
745
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
746 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
747 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
748 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
749 from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
750 if (pair->key == 49)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
751 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
752 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
753 stat = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
754 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
755 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
756 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
757 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
758 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
759 if(strtol(pair->value, NULL, 10) == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
760 msn = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
761 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
762 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
763
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
764 if (!from || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
765 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
766
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
767 /* 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
768 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
769 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
770 /* 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
771 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
772 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
773 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
774
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
775 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
776 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
777
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
778 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
779 && (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
780 {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
781 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
782 if (*stat == '1')
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
783 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
784 else
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
785 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
786 }
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
787 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
788 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
789 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
790 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
791 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
792 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
793 } 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
794 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
795
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
796 if (!bud) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
797 purple_debug(PURPLE_DEBUG_WARNING, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
798 "%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
799 "you to know.\n", from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
800 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
802 f = yahoo_friend_find(gc, from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
803 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
804 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
805
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
806 yahoo_friend_set_game(f, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
807
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
808 if (*stat == '1') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
809 yahoo_friend_set_game(f, game);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
810 if (bud)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
811 yahoo_update_status(gc, from, f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
812 }
19365
756dad225d90 Show a system notification in the conv window when receiving Yahoo webcam invites. Fixes #1298
Sean Egan <seanegan@gmail.com>
parents: 19360
diff changeset
813 } 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
814 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
815 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
816 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
817 g_free(buf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
818 }
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
819
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
820 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
821 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
823
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
824 struct _yahoo_im {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
825 char *from;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
826 int time;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
827 int utf8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
828 int buddy_icon;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
829 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
830 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
831
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
832 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
833 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
834 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
835 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
836 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
837 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
838 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
839 char *m;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
840
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
841 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
842 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
843
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
844 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
845 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
846 if (pair->key == 4) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
847 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
848 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
849 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
850 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
851 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
852 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
853 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
854 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
855 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
856 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
857 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
858 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
859 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
860 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
861 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
862 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
863
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
864 if( (pkt->status == -1) || (pkt->status == YAHOO_STATUS_DISCONNECTED) ) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
865 if (server_msg) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
866 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
867 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
868 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
869 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
870 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
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 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
873 purple_notify_error(gc, NULL, _("Your SMS was not delivered"), NULL);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
874
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(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
876 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
877 return ;
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 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
881 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
882 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
883 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
884
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
885 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
886 serv_got_im(gc, sms->from, m, 0, sms->time);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
887
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
888 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
889 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
890 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
891 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
892
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
893 /* 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
894 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
895 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
896 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
897 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
898 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
899 GSList *list = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
900 struct _yahoo_im *im = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
901 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
902 gint val_11 = 0;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
903 gboolean msn = FALSE;
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
904 char *msn_from = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
905
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
906 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
907
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
908 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
909 /* 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
910 while (l != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
911 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
912 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
913 im = g_new0(struct _yahoo_im, 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
914 list = g_slist_append(list, im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
915 im->from = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
916 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
917 im->utf8 = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
918 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
919 if (pair->key == 97)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
920 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
921 im->utf8 = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
922 if (pair->key == 15)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
923 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
924 im->time = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
925 if (pair->key == 206)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
926 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
927 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
928 if (pair->key == 14) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
929 if (im)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
930 im->msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
931 }
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
932 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
933 if(strtol(pair->value, NULL, 10) == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
934 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
935 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
936 /* 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
937 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
938 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
939 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
940 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
941 /* IMV key */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
942 if (pair->key == 63)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
943 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
944 imv = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
945 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
946 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
948 } else if (pkt->status == 2) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
949 purple_notify_error(gc, NULL,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
950 _("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
951 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
952
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
953 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
954 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
955
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
956 /* 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
957 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
958 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
959 /* 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
960 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
961 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
962 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
963
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
964 /** 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
965 /* Check for the Doodle IMV */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
966 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
967 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
968 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
969
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
970 if (strstr(imv, "doodle;") != NULL)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
971 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
972 PurpleWhiteboard *wb;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
973
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
974 if (!purple_privacy_check(account, im->from)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
975 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
976 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
977 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
978
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
979 /* 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
980
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
981 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
982
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
983 /* 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
984 if(wb == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
985 {
20254
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
986 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
987 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
988 ds = wb->proto_data;
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
989 ds->imv_key = g_strdup(imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
990
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
991 yahoo_doodle_command_send_request(gc, im->from, imv);
f379a2e9e939 applied changes from 80e3a515775c28b61c4c155c4a524374ef3360ff
Richard Laager <rlaager@wiktel.com>
parents: 19719
diff changeset
992 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
993 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
994 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
995 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
996
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
997 for (l = list; l; l = l->next) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
998 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
999 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
1000 PurpleConversation *c;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1001 im = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1002
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1003 if (!im->from || !im->msg) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1004 g_free(im);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1005 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1006 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1007
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1008 if (!purple_privacy_check(account, im->from)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1009 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
1010 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1011 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1012
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1013 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
1014 /* 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
1015 * 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
1016 * "\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
1017 * lines. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1018 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
1019 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1020 m = m2;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1021 purple_util_chrreplace(m, '\r', '\n');
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1022
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
1023 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
1024 if ((c == NULL) && msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1025 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
1026
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1027 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
1028 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
1029
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
1030 if(c == NULL) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1031 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1032 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
1033 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
1034 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
1035 }
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1036 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1037 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
1038 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
1039 username = g_markup_escape_text(im->from, -1);
97c420d62381 implement wlm interoperability, add/message friends using wlm/<wlm id> as id, note prefix "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26159
diff changeset
1040
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
1041 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
1042 g_free(username);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1043 g_free(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1044 g_free(im);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1045 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1046 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1047 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1049 m2 = yahoo_codes_to_html(m);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1050 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
1051
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1052 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1053 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
1054 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
1055 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
1056
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1057 g_free(m2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1058
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1059 /* laters : implement buddy icon for msn friends */
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1060 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
1061 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
1062 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
1063 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
1064 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
1065 }
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1068
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1069 g_free(im);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1070 g_free(msn_from);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1071 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1072 g_slist_free(list);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1073 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1074
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1075 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
1076 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1077 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
1078 char *prim, *me = NULL, *msg = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1079
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1080 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1081 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1082
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1083 if (pair->key == 5)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1084 me = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1085 if (pair->key == 14)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1086 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1087
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1088 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1089 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1090
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1091 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
1092 return;
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 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
1095 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
1096 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
1097 g_free(prim);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1098 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1099
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1100 struct yahoo_add_request {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1101 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1102 char *id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1103 char *who;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1104 int protocol;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1105 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1106
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1107 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1108 yahoo_buddy_add_authorize_cb(gpointer data)
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1109 {
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
1110 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
1111 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
1112 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
1113
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1114 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
1115 yahoo_packet_hash(pkt, "ssiii",
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1116 1, add_req->id,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1117 5, add_req->who,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1118 241, add_req->protocol,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1119 13, 1,
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1120 334, 0);
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1121 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
1122
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1123 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1124 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1125 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1126 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1128 static void
22230
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1129 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
1130 {
0f654f866de0 Revert bfc4df11256d088d75b0512bb0c4790967b68b19 because the code is
Mark Doliner <mark@kingant.net>
parents: 22149
diff changeset
1131 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
1132 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1133 char *encoded_msg = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1134 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
1135
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1136 if (msg && *msg)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1137 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
1138
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1139 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
1140 YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1141
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1142 yahoo_packet_hash(pkt, "ssiiis",
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1143 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
1144 5, add_req->who,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1145 13, 2,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1146 334, 0,
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1147 97, 1,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1148 14, encoded_msg ? encoded_msg : "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1149
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1150 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1152 g_free(encoded_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1153
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1154 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1155 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1156 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1158
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1159 static void
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1160 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
1161 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1162 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
1163 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1164
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1165 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
1166 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
1167 struct yahoo_add_request *add_req = data;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
1168 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
1169 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
1170 _("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
1171 _("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
1172 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
1173 add_req);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1174 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1175
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1176 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
1177 {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1178 char *notify_msg;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1179 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
1180
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1181 if (who == NULL)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1182 return;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1183
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1184 if (reason != NULL) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1185 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
1186 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
1187 g_free(msg2);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1188 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1189 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
1190
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1191 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
1192 g_free(notify_msg);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1193
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1194 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
1195 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
1196 /* 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
1197 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1198
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1199 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
1200 PurpleAccount *account;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1201 GSList *l = pkt->hash;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1202 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
1203 int protocol = 0;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1204
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1205 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
1206
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1207 /* Buddy authorized/declined our addition */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1208 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
1209 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
1210 char *who = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1211 int response = 0;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1212
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1213 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1214 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
1215
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1216 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1217 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
1218 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1219 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1220 case 13:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1221 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
1222 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1223 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1224 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1225 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
1226 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
1227 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
1228 break;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1229 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1230 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
1231 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1232
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
1233 if(protocol == 0)
26170
94ffdbdd16fb clear a double free bug
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26166
diff changeset
1234 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
1235 else if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1236 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
1237
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1238 if (response == 1) /* Authorized */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1239 purple_debug_info("yahoo", "Received authorization from buddy '%s'.\n", who ? who : "(Unknown Buddy)");
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1240 else if (response == 2) { /* Declined */
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1241 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
1242 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
1243 } else
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1244 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
1245 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
1246 }
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1247 /* 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
1248 else if (pkt->status == 3) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1249 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
1250 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
1251 char *temp = NULL;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1252
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1253 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
1254 add_req->gc = gc;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1255
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1256 while (l) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1257 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
1258
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1259 switch (pair->key) {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1260 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
1261 temp = pair->value;
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1262 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
1263 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1264 case 5:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1265 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
1266 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1267 case 14:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1268 msg = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1269 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1270 case 216:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1271 firstname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1272 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1273 case 241:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1274 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
1275 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1276 case 254:
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1277 lastname = pair->value;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1278 break;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1279
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1280 }
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1281 l = l->next;
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1282 }
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
1283 if(add_req->protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
1284 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
1285 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
1286 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
1287
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
1288 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
1289 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
1290
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1291 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
1292 {
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
1293 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
1294 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
1295 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
1296 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
1297 }
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1298
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1299 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
1300 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
1301
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1302 if (firstname && lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1303 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
1304 else if (firstname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1305 alias = g_strdup(firstname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1306 else if (lastname)
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1307 alias = g_strdup(lastname);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1308
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1309 /* 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
1310 * 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
1311 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1312 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
1313 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
1314 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
1315 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
1316 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
1317 add_req);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1318 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
1319 g_free(dec_msg);
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1320 } else {
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1321 g_free(add_req->id);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1322 g_free(add_req->who);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1323 g_free(add_req);
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1324 }
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1325 } else {
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1326 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
1327 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1328 }
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
1329
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
1330 /* 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
1331 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
1332 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1333 struct yahoo_add_request *add_req;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1334 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1335 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1336
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1337 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
1338
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1339 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
1340 add_req->gc = gc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1342 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1343 struct yahoo_pair *pair = l->data;
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 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1346 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1347 add_req->id = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1348 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1349 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1350 add_req->who = g_strdup(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1351 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1352 case 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
1353 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1354 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1355 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1356 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1357 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1358 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1359 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1360
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
1361 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
1362 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
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 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
1365 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
1366 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
1367 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
1368 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
1369 }
fa29de8d18bc Apply local privacy filtering to yahoo auth. requests. Drop and automatically deny any requests that should be filtered. Fixes #2857.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19511
diff changeset
1370
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1371 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
1372 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
1373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1374 /* 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
1375 * 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
1376 */
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
1377 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
1378 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
1379 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
1380 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
1381 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
1382 g_free(dec_msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1383 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1384 g_free(add_req->id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1385 g_free(add_req->who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1386 g_free(add_req);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1387 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1388 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1389
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1390 /* 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
1391 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
1392 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1393 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1394 char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1395 GSList *l = pkt->hash;
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1398 struct yahoo_pair *pair = l->data;
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 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1401 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1402 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1403 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1404 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1405 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1406 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1407 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1408 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1409 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1410
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(gc, who, msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1412 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1413
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1414 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
1415 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1416 switch (pkt->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1417 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1418 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1419 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1420 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1421 yahoo_buddy_added_us(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1422 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1423 case 7:
19360
dbc4bdfb09a9 Fix various things related to authorization on yahoo.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 19358
diff changeset
1424 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
1425 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1426 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1427 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1429 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1430
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1431 #define OUT_CHARSET "utf-8"
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1432
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1433 static char *yahoo_decode(const char *text)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1434 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1435 char *converted = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1436 char *n, *new;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1437 const char *end, *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1438 int i, k;
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 = new = g_malloc(strlen (text) + 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1441 end = text + strlen(text);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1443 for (p = text; p < end; p++, n++) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1444 if (*p == '\\') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1445 if (p[1] >= '0' && p[1] <= '7') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1446 p += 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1447 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
1448 char c = p[k];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1449 if (c < '0' || c > '7') break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1450 i *= 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1451 i += c - '0';
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 = i;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1454 p += k - 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1455 } else { /* bug 959248 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1456 /* 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
1457 * 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
1458 * already eaten by some unknown function.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1459 * This is arguably broken.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1460 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1461 * 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
1462 * 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
1463 * 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
1464 * for you.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1465 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1466 *n = *p;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1469 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1470 *n = *p;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1471 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1472
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1473 *n = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1474
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1475 if (strstr(text, "\033$B"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1476 converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1477 if (!converted)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1478 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
1479 g_free(new);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1480
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1481 return converted;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1482 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1483
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1484 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
1485 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1486 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
1487 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
1488 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
1489 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
1490 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
1491 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
1492 int count = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1493 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1494
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1495 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
1496 return;
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 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1499 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1500 if (pair->key == 9)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1501 count = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1502 else if (pair->key == 43)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1503 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1504 else if (pair->key == 42)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1505 email = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1506 else if (pair->key == 18)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1507 subj = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1508 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1509 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1510
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1511 if (who && subj && email && *email) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1512 char *dec_who = yahoo_decode(who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1513 char *dec_subj = yahoo_decode(subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1514 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
1515
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1516 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
1517 yahoo_mail_url, NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1518
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1519 g_free(dec_who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1520 g_free(dec_subj);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1521 g_free(from);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1522 } else if (count > 0) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1523 const char *to = purple_account_get_username(account);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1524 const char *url = yahoo_mail_url;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1525
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1526 purple_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1527 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1528 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1529 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1530 /* 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
1531 static const char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
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 /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1534 * in util.c, but it has a bug I don't feel like finding right now ;) */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1535 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
1536 /* 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
1537 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1538 for (; inlen >= 3; inlen -= 3)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1539 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1540 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1541 *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
1542 *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
1543 *out++ = base64digits[in[2] & 0x3f];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1544 in += 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1545 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1546 if (inlen > 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1547 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1548 unsigned char fragment;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1549
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1550 *out++ = base64digits[in[0] >> 2];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1551 fragment = (in[0] << 4) & 0x30;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1552 if (inlen > 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1553 fragment |= in[1] >> 4;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1554 *out++ = base64digits[fragment];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1555 *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
1556 *out++ = '-';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1557 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1558 *out = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1559 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1560
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1561 static void yahoo_process_auth_old(PurpleConnection *gc, const char *seed)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1562 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1563 struct yahoo_packet *pack;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1564 PurpleAccount *account = purple_connection_get_account(gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1565 const char *name = purple_normalize(account, purple_account_get_username(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1566 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
1567 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1569 /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1570 * will soon do so in the rest of the world.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1571 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1572 * The new clients use this authentication method. I warn you in advance, it's
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1573 * bizarre, convoluted, inordinately complicated. It's also no more secure than
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1574 * crypt() was. The only purpose this scheme could serve is to prevent third
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1575 * party clients from connecting to their servers.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1576 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1577 * Sorry, Yahoo.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1578 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1579
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1580 PurpleCipher *cipher;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1581 PurpleCipherContext *context;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1582 guchar digest[16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1583
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1584 char *crypt_result;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1585 char password_hash[25];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1586 char crypt_hash[25];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1587 char *hash_string_p = g_malloc(50 + strlen(name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1588 char *hash_string_c = g_malloc(50 + strlen(name));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1589
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1590 char checksum;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1591
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1592 int sv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1594 char result6[25];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1595 char result96[25];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1597 sv = seed[15];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1598 sv = sv % 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1599
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1600 cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1601 context = purple_cipher_context_new(cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1602
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1603 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
1604 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
1605
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1606 to_y64(password_hash, digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1607
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1608 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1609
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1610 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1611 purple_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1612 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
1613 to_y64(crypt_hash, digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1614
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1615 switch (sv) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1616 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1617 case 6:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1618 checksum = seed[seed[9] % 16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1619 g_snprintf(hash_string_p, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1620 "%c%s%s%s", checksum, name, seed, password_hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1621 g_snprintf(hash_string_c, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1622 "%c%s%s%s", checksum, name, seed, crypt_hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1623 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1624 case 2:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1625 case 7:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1626 checksum = seed[seed[15] % 16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1627 g_snprintf(hash_string_p, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1628 "%c%s%s%s", checksum, seed, password_hash, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1629 g_snprintf(hash_string_c, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1630 "%c%s%s%s", checksum, seed, crypt_hash, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1631 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1632 case 3:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1633 checksum = seed[seed[1] % 16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1634 g_snprintf(hash_string_p, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1635 "%c%s%s%s", checksum, name, password_hash, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1636 g_snprintf(hash_string_c, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1637 "%c%s%s%s", checksum, name, crypt_hash, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1638 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1639 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1640 checksum = seed[seed[3] % 16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1641 g_snprintf(hash_string_p, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1642 "%c%s%s%s", checksum, password_hash, seed, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1643 g_snprintf(hash_string_c, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1644 "%c%s%s%s", checksum, crypt_hash, seed, name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1645 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1646 case 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1647 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1648 checksum = seed[seed[7] % 16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1649 g_snprintf(hash_string_p, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1650 "%c%s%s%s", checksum, password_hash, name, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1651 g_snprintf(hash_string_c, strlen(name) + 50,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1652 "%c%s%s%s", checksum, crypt_hash, name, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1653 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1654 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1655
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1656 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1657 purple_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1658 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
1659 to_y64(result6, digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1660
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1661 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1662 purple_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1663 purple_cipher_context_digest(context, sizeof(digest), digest, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1664 purple_cipher_context_destroy(context);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1665 to_y64(result96, digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1666
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1667 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
22271
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1668
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1669 if(yd->jp) {
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1670 yahoo_packet_hash(pack, "sssss",
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1671 0, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1672 6, result6,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1673 96, result96,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1674 1, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1675 135, YAHOOJP_CLIENT_VERSION);
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1676 } else {
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1677 yahoo_packet_hash(pack, "ssssss",
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1678 0, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1679 6, result6,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1680 96, result96,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1681 1, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1682 244, YAHOO_CLIENT_VERSION_ID,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1683 135, YAHOO_CLIENT_VERSION);
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1684 }
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
1685
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1686 yahoo_packet_send_and_free(pack, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1687
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1688 g_free(hash_string_p);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1689 g_free(hash_string_c);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1690 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1691
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1692 /* I'm dishing out some uber-mad props to Cerulean Studios for cracking this
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1693 * and sending the fix! Thanks guys. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1694
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1695 static void yahoo_process_auth_new(PurpleConnection *gc, const char *seed)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1696 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1697 struct yahoo_packet *pack = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1698 PurpleAccount *account = purple_connection_get_account(gc);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1699 const char *name = purple_normalize(account, purple_account_get_username(account));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1700 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
1701 char *enc_pass;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1702 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1703
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1704 PurpleCipher *md5_cipher;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1705 PurpleCipherContext *md5_ctx;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1706 guchar md5_digest[16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1707
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1708 PurpleCipher *sha1_cipher;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1709 PurpleCipherContext *sha1_ctx1;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1710 PurpleCipherContext *sha1_ctx2;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1712 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1713 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1714
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1715 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1716 char *operand_lookup = "+|&%/*^-";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1717 char *delimit_lookup = ",;";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1718
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1719 char *password_hash = (char *)g_malloc(25);
22021
c72ea83f34d6 Fix my typo
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22020
diff changeset
1720 char *crypt_hash = (char *)g_malloc(25);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1721 char *crypt_result = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1722
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1723 unsigned char pass_hash_xor1[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1724 unsigned char pass_hash_xor2[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1725 unsigned char crypt_hash_xor1[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1726 unsigned char crypt_hash_xor2[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1727 char resp_6[100];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1728 char resp_96[100];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1729
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1730 unsigned char digest1[20];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1731 unsigned char digest2[20];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1732 unsigned char comparison_src[20];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1733 unsigned char magic_key_char[4];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1734 const char *magic_ptr;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1736 unsigned int magic[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1737 unsigned int magic_work = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1738 unsigned int magic_4 = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1739
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1740 int x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1741 int y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1742 int cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1743 int magic_cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1744 int magic_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1745
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1746 memset(password_hash, 0, 25);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1747 memset(crypt_hash, 0, 25);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1748 memset(&pass_hash_xor1, 0, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1749 memset(&pass_hash_xor2, 0, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1750 memset(&crypt_hash_xor1, 0, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1751 memset(&crypt_hash_xor2, 0, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1752 memset(&digest1, 0, 20);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1753 memset(&digest2, 0, 20);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1754 memset(&magic, 0, 64);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1755 memset(&resp_6, 0, 100);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1756 memset(&resp_96, 0, 100);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1757 memset(&magic_key_char, 0, 4);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1758 memset(&comparison_src, 0, 20);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1759
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1760 md5_cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1761 md5_ctx = purple_cipher_context_new(md5_cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1762
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1763 sha1_cipher = purple_ciphers_find_cipher("sha1");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1764 sha1_ctx1 = purple_cipher_context_new(sha1_cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1765 sha1_ctx2 = purple_cipher_context_new(sha1_cipher, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1766
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1767 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1768 * Magic: Phase 1. Generate what seems to be a 30 byte value (could change if base64
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1769 * ends up differently? I don't remember and I'm tired, so use a 64 byte buffer.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1770 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1771
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1772 magic_ptr = seed;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1773
22022
eeba86c553be Fix a couple compile warnings.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22021
diff changeset
1774 while (*magic_ptr != '\0') {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1775 char *loc;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1776
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1777 /* Ignore parentheses. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1778
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1779 if (*magic_ptr == '(' || *magic_ptr == ')') {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1780 magic_ptr++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1781 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1782 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1783
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1784 /* Characters and digits verify against the challenge lookup. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1785
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1786 if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1787 loc = strchr(challenge_lookup, *magic_ptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1788 if (!loc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1789 /* SME XXX Error - disconnect here */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1790 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1791
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1792 /* Get offset into lookup table and shl 3. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1793
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1794 magic_work = loc - challenge_lookup;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1795 magic_work <<= 3;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1796
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1797 magic_ptr++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1798 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1799 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1800 unsigned int local_store;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1802 loc = strchr(operand_lookup, *magic_ptr);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1803 if (!loc) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1804 /* SME XXX Disconnect */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1805 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1806
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1807 local_store = loc - operand_lookup;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1808
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1809 /* Oops; how did this happen? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1810
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1811 if (magic_cnt >= 64)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1812 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1813
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1814 magic[magic_cnt++] = magic_work | local_store;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1815 magic_ptr++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1816 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1817 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1818 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1819
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1820 magic_len = magic_cnt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1821 magic_cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1822
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1823 /* Magic: Phase 2. Take generated magic value and sprinkle fairy
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1824 * dust on the values.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1825 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1826
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1827 for (magic_cnt = magic_len - 2; magic_cnt >= 0; magic_cnt--) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1828 unsigned char byte1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1829 unsigned char byte2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1830
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1831 /* Bad. Abort. */
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 if ((magic_cnt + 1 > magic_len) || (magic_cnt > magic_len))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1834 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1835
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1836 byte1 = magic[magic_cnt];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1837 byte2 = magic[magic_cnt+1];
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 byte1 *= 0xcd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1840 byte1 ^= byte2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1841
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1842 magic[magic_cnt+1] = byte1;
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1843 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1844
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1845 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1846 * Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1847 * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1848 * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1849 * into particular functions we'll later call to potentially alter the magic key.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1850 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1851 * %-)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1852 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1853
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1854 magic_cnt = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1855 x = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1856
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1857 do {
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1858 unsigned int bl = 0;
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1859 unsigned int cl = magic[magic_cnt++];
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1860
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1861 if (magic_cnt >= magic_len)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1862 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1863
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1864 if (cl > 0x7F) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1865 if (cl < 0xe0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1866 bl = cl = (cl & 0x1f) << 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1867 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1868 bl = magic[magic_cnt++];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1869 cl = (cl & 0x0f) << 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1870 bl = ((bl & 0x3f) + cl) << 6;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1871 }
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 cl = magic[magic_cnt++];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1874 bl = (cl & 0x3f) + bl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1875 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1876 bl = cl;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1877
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1878 comparison_src[x++] = (bl & 0xff00) >> 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1879 comparison_src[x++] = bl & 0xff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1880 } while (x < 20);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1881
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1882 /* First four bytes are magic key. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1883 memcpy(&magic_key_char[0], comparison_src, 4);
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1884 magic_4 = magic_key_char[0] | (magic_key_char[1] << 8) |
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1885 (magic_key_char[2] << 16) | (magic_key_char[3] << 24);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1886
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1887 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1888 * Magic: Phase 4. Determine what function to use later by getting outside/inside
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1889 * loop values until we match our previous buffer.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1890 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1891 for (x = 0; x < 65535; x++) {
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1892 int leave = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1893
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1894 for (y = 0; y < 5; y++) {
22020
4163dcf643ae Some readability changes. Refs #4533.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22018
diff changeset
1895 unsigned char test[3];
15373
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 /* Calculate buffer. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1898 test[0] = x;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1899 test[1] = x >> 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1900 test[2] = y;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1901
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1902 purple_cipher_context_reset(md5_ctx, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1903 purple_cipher_context_append(md5_ctx, magic_key_char, 4);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1904 purple_cipher_context_append(md5_ctx, test, 3);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1905 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1906 md5_digest, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1907
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1908 if (!memcmp(md5_digest, comparison_src+4, 16)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1909 leave = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1910 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1912 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1913
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1914 if (leave == 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1915 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1916 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1917
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1918 /* If y != 0, we need some help. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1919 if (y != 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1920 unsigned int updated_key;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1921
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1922 /* Update magic stuff.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1923 * Call it twice because Yahoo's encryption is super bad ass.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1924 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1925 updated_key = yahoo_auth_finalCountdown(magic_4, 0x60, y, x);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1926 updated_key = yahoo_auth_finalCountdown(updated_key, 0x60, y, x);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1927
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1928 magic_key_char[0] = updated_key & 0xff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1929 magic_key_char[1] = (updated_key >> 8) & 0xff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1930 magic_key_char[2] = (updated_key >> 16) & 0xff;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1931 magic_key_char[3] = (updated_key >> 24) & 0xff;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1934 enc_pass = yahoo_string_encode(gc, pass, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1935
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1936 /* Get password and crypt hashes as per usual. */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1937 purple_cipher_context_reset(md5_ctx, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1938 purple_cipher_context_append(md5_ctx, (const guchar *)enc_pass, strlen(enc_pass));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1939 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1940 md5_digest, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1941 to_y64(password_hash, md5_digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1942
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1943 crypt_result = yahoo_crypt(enc_pass, "$1$_2S43d5f$");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1944
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1945 g_free(enc_pass);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1946 enc_pass = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1947
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1948 purple_cipher_context_reset(md5_ctx, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1949 purple_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1950 purple_cipher_context_digest(md5_ctx, sizeof(md5_digest),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1951 md5_digest, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1952 to_y64(crypt_hash, md5_digest, 16);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1953
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1954 /* Our first authentication response is based off of the password hash. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1955 for (x = 0; x < (int)strlen(password_hash); x++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1956 pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1957
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1958 if (cnt < 64)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1959 memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1960
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1961 cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1962
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1963 for (x = 0; x < (int)strlen(password_hash); x++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1964 pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1965
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1966 if (cnt < 64)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1967 memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt);
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 * The first context gets the password hash XORed with 0x36 plus a magic value
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1971 * which we previously extrapolated from our challenge.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1972 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1973
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1974 purple_cipher_context_append(sha1_ctx1, pass_hash_xor1, 64);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1975 if (y >= 3)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1976 purple_cipher_context_set_option(sha1_ctx1, "sizeLo", GINT_TO_POINTER(0x1ff));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1977 purple_cipher_context_append(sha1_ctx1, magic_key_char, 4);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1978 purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1980 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1981 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1982 * of the first context.
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1985 purple_cipher_context_append(sha1_ctx2, pass_hash_xor2, 64);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1986 purple_cipher_context_append(sha1_ctx2, digest1, 20);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
1987 purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1988
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1989 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1990 * Now that we have digest2, use it to fetch characters from an alphabet to construct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1991 * our first authentication response.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1992 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1993
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1994 for (x = 0; x < 20; x += 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1995 unsigned int val = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1996 unsigned int lookup = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1997
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1998 char byte[6];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
1999
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2000 memset(&byte, 0, 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2001
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2002 /* First two bytes of digest stuffed together. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2003
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2004 val = digest2[x];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2005 val <<= 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2006 val += digest2[x+1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2007
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2008 lookup = (val >> 0x0b);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2009 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2010 if (lookup >= strlen(alphabet1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2011 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2012 sprintf(byte, "%c", alphabet1[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2013 strcat(resp_6, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2014 strcat(resp_6, "=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2016 lookup = (val >> 0x06);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2017 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2018 if (lookup >= strlen(alphabet2))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2019 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2020 sprintf(byte, "%c", alphabet2[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2021 strcat(resp_6, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2022
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2023 lookup = (val >> 0x01);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2024 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2025 if (lookup >= strlen(alphabet2))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2026 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2027 sprintf(byte, "%c", alphabet2[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2028 strcat(resp_6, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2029
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2030 lookup = (val & 0x01);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2031 if (lookup >= strlen(delimit_lookup))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2032 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2033 sprintf(byte, "%c", delimit_lookup[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2034 strcat(resp_6, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2035 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2036
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2037 /* Our second authentication response is based off of the crypto hash. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2038
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2039 cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2040 memset(&digest1, 0, 20);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2041 memset(&digest2, 0, 20);
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 for (x = 0; x < (int)strlen(crypt_hash); x++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2044 crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36;
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 if (cnt < 64)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2047 memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2048
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2049 cnt = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2050
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2051 for (x = 0; x < (int)strlen(crypt_hash); x++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2052 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2053
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2054 if (cnt < 64)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2055 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2056
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2057 purple_cipher_context_reset(sha1_ctx1, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2058 purple_cipher_context_reset(sha1_ctx2, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2059
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 * The first context gets the password hash XORed with 0x36 plus a magic value
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2062 * which we previously extrapolated from our challenge.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2063 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2064
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2065 purple_cipher_context_append(sha1_ctx1, crypt_hash_xor1, 64);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2066 if (y >= 3) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2067 purple_cipher_context_set_option(sha1_ctx1, "sizeLo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2068 GINT_TO_POINTER(0x1ff));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2069 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2070 purple_cipher_context_append(sha1_ctx1, magic_key_char, 4);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2071 purple_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2072
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2073 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2074 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2075 * of the first context.
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2078 purple_cipher_context_append(sha1_ctx2, crypt_hash_xor2, 64);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2079 purple_cipher_context_append(sha1_ctx2, digest1, 20);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2080 purple_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2081
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2082 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2083 * Now that we have digest2, use it to fetch characters from an alphabet to construct
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2084 * our first authentication response.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2085 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2086
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2087 for (x = 0; x < 20; x += 2) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2088 unsigned int val = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2089 unsigned int lookup = 0;
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 char byte[6];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2092
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2093 memset(&byte, 0, 6);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2094
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2095 /* First two bytes of digest stuffed together. */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2096
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2097 val = digest2[x];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2098 val <<= 8;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2099 val += digest2[x+1];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2100
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2101 lookup = (val >> 0x0b);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2102 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2103 if (lookup >= strlen(alphabet1))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2104 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2105 sprintf(byte, "%c", alphabet1[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2106 strcat(resp_96, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2107 strcat(resp_96, "=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2108
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2109 lookup = (val >> 0x06);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2110 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2111 if (lookup >= strlen(alphabet2))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2112 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2113 sprintf(byte, "%c", alphabet2[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2114 strcat(resp_96, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2115
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2116 lookup = (val >> 0x01);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2117 lookup &= 0x1f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2118 if (lookup >= strlen(alphabet2))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2119 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2120 sprintf(byte, "%c", alphabet2[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2121 strcat(resp_96, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2122
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2123 lookup = (val & 0x01);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2124 if (lookup >= strlen(delimit_lookup))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2125 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2126 sprintf(byte, "%c", delimit_lookup[lookup]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2127 strcat(resp_96, byte);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2128 }
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2129 purple_debug_info("yahoo", "yahoo status: %d\n", yd->current_status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2130 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0);
22271
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2131
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2132 if(yd->jp) {
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2133 yahoo_packet_hash(pack, "sssss",
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2134 0, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2135 6, resp_6,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2136 96, resp_96,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2137 1, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2138 135, YAHOOJP_CLIENT_VERSION);
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2139 } else {
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2140 yahoo_packet_hash(pack, "ssssss",
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2141 0, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2142 6, resp_6,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2143 96, resp_96,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2144 1, name,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2145 244, YAHOO_CLIENT_VERSION_ID,
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2146 135, YAHOO_CLIENT_VERSION);
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2147 }
cc5b2a145652 Simplified version of the newest patch on #4533 to not try Yahoo protocol
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 22245
diff changeset
2148
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2149 if (yd->picture_checksum)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2150 yahoo_packet_hash_int(pack, 192, yd->picture_checksum);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2151
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2152 yahoo_packet_send_and_free(pack, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2153
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2154 purple_cipher_context_destroy(md5_ctx);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2155 purple_cipher_context_destroy(sha1_ctx1);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2156 purple_cipher_context_destroy(sha1_ctx2);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2157
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2158 g_free(password_hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2159 g_free(crypt_hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2160 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2161
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2162 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
2163 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2164 char *seed = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2165 char *sn = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2166 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2167 int m = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2168 gchar *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2169
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2170 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2171 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2172 if (pair->key == 94)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2173 seed = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2174 if (pair->key == 1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2175 sn = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2176 if (pair->key == 13)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2177 m = atoi(pair->value);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2178 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2179 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2180
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2181 if (seed) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2182 switch (m) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2183 case 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2184 yahoo_process_auth_old(gc, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2185 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2186 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2187 case 2: /* This case seems to work, could probably use testing */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2188 yahoo_process_auth_new(gc, seed);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2189 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2190 default:
23402
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2191 {
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2192 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
2193
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2194 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
2195 "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
2196 "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
2197 ((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
2198 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
2199 buf);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2200 g_free(buf);
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2201 yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2202 break;
c6b29adc22d1 Added "website" and "dev_website" items to the ui_info GHashTable,
Evan Schoenberg <evan.s@dreskin.net>
parents: 23399
diff changeset
2203 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2204 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2205 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2206 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2207
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2208 static void ignore_buddy(PurpleBuddy *buddy) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2209 PurpleGroup *group;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2210 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2211 gchar *name;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2212
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2213 if (!buddy)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2214 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2215
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2216 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
2217 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
2218 account = purple_buddy_get_account(buddy);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2219
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2220 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
2221 "Removing '%s' from buddy list.\n", name);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2222 purple_account_remove_buddy(account, buddy, group);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2223 purple_blist_remove_buddy(buddy);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2224
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
2225 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
2226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2227 g_free(name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2228 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2229
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
2230 static void keep_buddy(PurpleBuddy *b)
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
2231 {
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
2232 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
2233 purple_buddy_get_name(b), 1);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2234 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2235
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2236 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
2237 PurpleBuddy *b;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2238 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2239 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
2240 gchar *me = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2241 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
2242 gboolean ignore = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2243 gint status = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2244
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2245 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
2246 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2247 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2248 case 0:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2249 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2250 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2251 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
2252 me = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2253 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2254 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
2255 /* 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
2256 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
2257 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2258 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2259 status = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2260 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2261 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2262 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2263 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2264 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2265
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
2266 /*
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
2267 * 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
2268 * 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
2269 * 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
2270 * 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
2271 * 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
2272 */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2273 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
2274 case 12:
22424
35c4a9b4a699 Fix a missing a comma
Mark Doliner <mark@kingant.net>
parents: 22423
diff changeset
2275 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
2276 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
2277
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
2278 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
2279 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
2280 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
2281 "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
2282 "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
2283 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
2284 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
2285 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
2286 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
2287 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
2288 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
2289 }
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
2290 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
2291 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
2292 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
2293 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
2294 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
2295 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
2296 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
2297 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
2298 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
2299 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2300 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2301 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2302
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2303 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
2304 {
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2305 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2306 struct yahoo_data *yd = gc->proto_data;
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2307 #endif
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2308 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2309 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2310 char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2311 char *url = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2312 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
2313 PurpleAccount *account = gc->account;
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2314 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
2315
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2316 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2317 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2318
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2319 if (pair->key == 66)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2320 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
2321 else if (pair->key == 20)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2322 url = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2323
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2324 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2325 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2326
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2327 switch (err) {
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2328 case 0:
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2329 msg = g_strdup(_("Unknown error."));
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2330 reason = PURPLE_CONNECTION_ERROR_NETWORK_ERROR;
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2331 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2332 case 3:
22794
cc8903c59d6b Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <mark@kingant.net>
parents: 22683
diff changeset
2333 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
2334 reason = PURPLE_CONNECTION_ERROR_INVALID_USERNAME;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2335 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2336 case 13:
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2337 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2338 if (!yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2339 PurpleUtilFetchUrlData *url_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2340 yd->wm = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2341 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2342 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2343 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2344 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2345 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
2346 "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
2347 if (url_data != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2348 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
2349 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2350 }
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
2351 #endif
18650
648545b2c1f1 make us forget the password if the user didn't choose save password
Ka-Hing Cheung <khc@hxbc.us>
parents: 18642
diff changeset
2352 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
2353 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
2354
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2355 msg = g_strdup(_("Incorrect password."));
24590
c457c635eb8f Two functional changes here:
Mark Doliner <mark@kingant.net>
parents: 24400
diff changeset
2356 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2357 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2358 case 14:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2359 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
2360 reason = PURPLE_CONNECTION_ERROR_AUTHENTICATION_FAILED;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2361 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2362 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2363 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
2364 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2365
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2366 if (url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2367 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
2368 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2369 fullmsg = g_strdup(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2370
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
2371 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
2372 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2373 g_free(fullmsg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2374 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2375
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2376 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
2377 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2378 int err = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2379 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
2380 char *temp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2381 char *group = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2382 char *decoded_group;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2383 char *buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2384 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2385 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
2386 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
2387 int protocol = 0;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2388 gboolean msn = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2389
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2390 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2391 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2392
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2393 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2394 case 66:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2395 err = strtol(pair->value, NULL, 10);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2396 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2397 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
2398 temp = pair->value;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2399 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2400 case 65:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2401 group = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2402 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
2403 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
2404 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
2405 if(protocol == 2)
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2406 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
2407 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2408 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2409
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2410 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2411 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2412
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
2413 if (!temp)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2414 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2415 if (!group)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2416 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
2417
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2418 if(msn)
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
2419 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
2420 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
2421 who = g_strdup(temp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2422
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2423 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
2424 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
2425 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
2426 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
2427 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
2428
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2429 if( !g_hash_table_lookup(yd->peers, who) ) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2430 /* 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
2431 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
2432 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
2433 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
2434 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
2435 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
2436 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2437 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2438 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
2439 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
2440 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2441 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2442
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2443 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
2444 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
2445 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
2446 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
2447 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
2448 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2449 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
2450 g_free(who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2451 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2452
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2453 /* 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
2454 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
2455 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2456 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
2457 guchar *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
2458
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2459 /*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
2460 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
2461 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
2462 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
2463 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
2464 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2465
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2466 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
2467 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2468 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
2469 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
2470 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
2471 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
2472 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
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 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
2475
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2476 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
2477 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
2478 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
2479 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
2480 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
2481 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
2482 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
2483 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
2484
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2485 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
2486 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2487
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2488 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
2489 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2490 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
2491 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
2492
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2493 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
2494
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2495 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
2496 }
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 /* 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
2499 * 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
2500 * 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
2501 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
2502 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2503 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
2504 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
2505
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2506 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
2507 return ;
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 /* 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
2510 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
2511 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
2512 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
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 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
2515 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
2516 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
2517 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
2518 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
2519 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
2520 }
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 /* 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
2523 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
2524 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2525 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
2526 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
2527 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
2528 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
2529 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
2530 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
2531 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
2532 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
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 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
2535 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2536
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2537 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
2538
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2539 /* 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
2540 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
2541 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
2542
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2543 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
2544 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
2545 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
2546 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
2547 /* 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
2548 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
2549 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2550 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2551 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2552 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
2553 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
2554 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2555 /* 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
2556 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2557 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
2558 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2559
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2560 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
2561
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2562 /* 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
2563 * 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
2564 * 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
2565 * 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
2566 * 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
2567
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2568 switch(p2p_data->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
2569 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
2570 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
2571 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
2572 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
2573 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2574 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
2575 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
2576 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2577 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2578
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2579 /* 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
2580 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
2581 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
2582 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
2583 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
2584 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
2585 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
2586 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
2587
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2588 /* 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
2589 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
2590 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
2591
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( val_13_to_send == 7 )
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2593 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
2594 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
2595 /* 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
2596 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
2597 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
2598 if(p2p_data->connection_type == YAHOO_P2P_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
2599 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
2600 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
2601 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2602 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2603 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
2604 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2605 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2606 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2607
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2608 /* 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
2609 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
2610 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2611 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
2612 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
2613 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
2614 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
2615 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
2616 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
2617 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
2618 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
2619
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2620 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
2621 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2622 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
2623
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2624 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
2625 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
2626 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
2627 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
2628 {
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_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
2630 /* 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
2631 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
2632 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
2633 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2634 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
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 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2637
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2638 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
2639 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2640
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2641 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
2642 /* 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
2643 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
2644
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2645 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
2646 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
2647 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
2648 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
2649 } else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2650 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
2651 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2652 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2653 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2654
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2655 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
2656 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
2657 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
2658
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2659 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
2660 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
2661
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2662 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
2663 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
2664 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
2665 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
2666
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2667 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
2668 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
2669
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2670 /* packet processing */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2671 switch(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
2672 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
2673 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
2674 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2675 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
2676 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
2677 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2678 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
2679 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
2680 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2681 default:
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2682 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
2683 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2684
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2685 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
2686 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2687
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2688 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
2689 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2690 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
2691 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
2692 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
2693
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2694 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
2695 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2696 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
2697
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2698 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
2699 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
2700 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2701 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
2702 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
2703 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
2704 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2705 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2706
26158
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2707 /* remove timeout */
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2708 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2709 yd->yahoo_p2p_server_timeout_handle = 0;
e524694e3c06 remove connection timeout if already connected
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26157
diff changeset
2710
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2711 /* remove watcher and close p2p server */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2712 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
2713 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
2714 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
2715
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2716 /* 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
2717 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
2718 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
2719 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2720
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2721 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
2722 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2723 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
2724 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
2725
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2726 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
2727 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
2728
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2729 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
2730
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2731 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
2732 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
2733 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
2734 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
2735 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
2736 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
2737 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
2738
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2739 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
2740 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2741
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2742 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
2743 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2744 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
2745 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
2746
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2747 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
2748 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2749
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2750 if(listenfd == -1) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2751 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
2752 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
2753 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2754 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2755
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2756 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
2757
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2758 /* 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
2759 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
2760 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
2761
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2762 /* 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
2763 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
2764 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2765
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2766 /* 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
2767 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
2768 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2769 const char *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
2770 guint32 temp[4];
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2771 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
2772 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
2773 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
2774 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
2775 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
2776 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
2777 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
2778 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
2779
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2780 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
2781 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
2782
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2783 /* 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
2784 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
2785 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2786
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2787 /* 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
2788 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
2789 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2790
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2791 /* send packet to only those friends who arent p2p connected and to whom we havent already sent. Do not send if this condition doesn't hold good */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2792 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
2793 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2794
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2795 /* 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
2796 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
2797 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2798
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2799 /* 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
2800 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
2801 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2802
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2803 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
2804 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
2805 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2806
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2807 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
2808 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
2809 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
2810
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2811 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
2812 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
2813 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
2814 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
2815 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
2816 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
2817 2, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2818 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
2819 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
2820 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
2821 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
2822
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2823 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
2824
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2825 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
2826
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2827 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
2828 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
2829 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
2830 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
2831 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
2832 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
2833
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2834 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
2835
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2836 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
2837 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2838
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2839 /* 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
2840 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
2841 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2842 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
2843 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
2844 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
2845 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
2846
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2847 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
2848 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2849 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
2850
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2851 if(error_message != NULL) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2852 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
2853 yahoo_send_p2p_pkt(p2p_data->gc, p2p_data->host_username, 2);/* send p2p init packet with val_13=2 */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2854
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2855 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
2856 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2857 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2858
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2859 /* 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
2860 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
2861 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
2862
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2863 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
2864
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2865 /* 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
2866 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
2867 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
2868 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
2869 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
2870 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
2871 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
2872 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
2873
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2874 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
2875 yahoo_packet_free(pkt_to_send);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2876 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2877
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2878 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
2879 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2880 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2881 char *who = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2882 char *base64 = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2883 guchar *decoded;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2884 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
2885 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
2886 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
2887 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
2888 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
2889
26159
ffb0d441d0a3 identify when packet bounces back and contains our own ip instead
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26158
diff changeset
2890 /* 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
2891 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
2892 return ;
15373
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 (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2895 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2896
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2897 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2898 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2899 /* our identity */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2900 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2901 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2902 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2903 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2904 case 1:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2905 /* who again, the master identity this time? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2906 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2907 case 12:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2908 base64 = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2909 /* 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
2910 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
2911 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
2912 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
2913 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
2914 break;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2915 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
2916 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
2917 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
2918 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
2919 break;
15373
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 TODO: figure these out
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2922 yahoo: Key: 61 Value: 0
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2923 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
2924 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
2925 yahoo: Key: 49 Value: PEERTOPEER
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2926 yahoo: Key: 140 Value: 1
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2927 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2929 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2930
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2931 l = l->next;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2934 if (base64) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2935 guint32 ip;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2936 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
2937 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
2938 struct yahoo_p2p_data *p2p_data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2939
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2940 decoded = purple_base64_decode(base64, &len);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2941 if (len) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2942 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
2943 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
2944 g_free(tmp);
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
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2947 ip = strtol((gchar *)decoded, NULL, 10);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2948 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
2949 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
2950 (ip >> 24) & 0xff);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2951 f = yahoo_friend_find(gc, who);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2952 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
2953 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
2954 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
2955
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2956 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
2957
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2958 if(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
2959 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
2960 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2961 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2962 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
2963 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2964
26511
89da4ae5e451 Plug a possible leak. Initialize fd to -1. Avoid unnecessary strdup.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 26510
diff changeset
2965 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
2966 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
2967 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
2968 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
2969 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
2970 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
2971 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
2972 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
2973
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2974 /* connect to host */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2975 if((purple_proxy_connect(NULL, account, host_ip, YAHOO_PAGER_PORT_P2P, yahoo_p2p_init_cb, p2p_data))==NULL) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
2976 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
2977 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
2978 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
2979 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
2980 }
15373
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2983
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
2984 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
2985 {
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2986 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2987 char *who = NULL, *msg = NULL, *id = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2988 GSList *l = pkt->hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2989
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
2990 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
2991
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2992 while (l) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2993 struct yahoo_pair *pair = l->data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2994
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2995 switch (pair->key) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2996 case 4:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2997 who = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2998 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
2999 case 5:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3000 /* us */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3001 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3002 case 230:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3003 /* 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
3004 eg: base.tw.smiley.smiley43 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3005 id = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3006 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3007 case 231:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3008 /* the text of the audible */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3009 msg = pair->value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3010 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3011 case 232:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3012 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3013 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3014 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3016 l = l->next;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3017 }
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 if (!msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3020 msg = id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3021 if (!who || !msg)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3022 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3023 if (!g_utf8_validate(msg, -1, NULL)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3024 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
3025 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3026 }
22238
4cc1dfbc499b Get rid of yahoo_privacy_check and use purple_privacy_check directly.
Mark Doliner <mark@kingant.net>
parents: 22236
diff changeset
3027 if (!purple_privacy_check(account, who)) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3028 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
3029 purple_account_get_username(account), who);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3030 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3031 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3032 if (id) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3033 /* "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
3034 char **audible_locale = g_strsplit(id, ".", 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3035 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
3036 g_strfreev(audible_locale);
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 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
3039 g_free(buf);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3040 } else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3041 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
3042 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3043
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3044 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
3045 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3046 switch (pkt->service) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3047 case YAHOO_SERVICE_LOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3048 case YAHOO_SERVICE_LOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3049 case YAHOO_SERVICE_ISAWAY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3050 case YAHOO_SERVICE_ISBACK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3051 case YAHOO_SERVICE_GAMELOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3052 case YAHOO_SERVICE_GAMELOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3053 case YAHOO_SERVICE_CHATLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3054 case YAHOO_SERVICE_CHATLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3055 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3056 case YAHOO_SERVICE_STATUS_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3057 yahoo_process_status(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3058 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3059 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
3060 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
3061 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3062 case YAHOO_SERVICE_MESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3063 case YAHOO_SERVICE_GAMEMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3064 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
3065 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
3066 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3067 case YAHOO_SERVICE_SYSMESSAGE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3068 yahoo_process_sysmessage(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3069 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3070 case YAHOO_SERVICE_NEWMAIL:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3071 yahoo_process_mail(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3072 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3073 case YAHOO_SERVICE_NEWCONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3074 yahoo_process_contact(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3075 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3076 case YAHOO_SERVICE_AUTHRESP:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3077 yahoo_process_authresp(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3078 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3079 case YAHOO_SERVICE_LIST:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3080 yahoo_process_list(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3081 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3082 case YAHOO_SERVICE_LIST_15:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3083 yahoo_process_list_15(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3084 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3085 case YAHOO_SERVICE_AUTH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3086 yahoo_process_auth(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3087 break;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
3088 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
3089 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
3090 break;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3091 case YAHOO_SERVICE_ADDBUDDY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3092 yahoo_process_addbuddy(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3093 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3094 case YAHOO_SERVICE_IGNORECONTACT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3095 yahoo_process_ignore(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3096 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3097 case YAHOO_SERVICE_CONFINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3098 case YAHOO_SERVICE_CONFADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3099 yahoo_process_conference_invite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3100 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3101 case YAHOO_SERVICE_CONFDECLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3102 yahoo_process_conference_decline(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3103 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3104 case YAHOO_SERVICE_CONFLOGON:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3105 yahoo_process_conference_logon(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3106 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3107 case YAHOO_SERVICE_CONFLOGOFF:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3108 yahoo_process_conference_logoff(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3109 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3110 case YAHOO_SERVICE_CONFMSG:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3111 yahoo_process_conference_message(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3112 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3113 case YAHOO_SERVICE_CHATONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3114 yahoo_process_chat_online(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3115 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3116 case YAHOO_SERVICE_CHATLOGOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3117 yahoo_process_chat_logout(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3118 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3119 case YAHOO_SERVICE_CHATGOTO:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3120 yahoo_process_chat_goto(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3121 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3122 case YAHOO_SERVICE_CHATJOIN:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3123 yahoo_process_chat_join(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3124 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3125 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
3126 case YAHOO_SERVICE_CHATEXIT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3127 yahoo_process_chat_exit(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3128 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3129 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
3130 case YAHOO_SERVICE_CHATADDINVITE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3131 yahoo_process_chat_addinvite(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3132 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3133 case YAHOO_SERVICE_COMMENT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3134 yahoo_process_chat_message(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3135 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3136 case YAHOO_SERVICE_PRESENCE_PERM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3137 case YAHOO_SERVICE_PRESENCE_SESSION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3138 yahoo_process_presence(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3139 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3140 case YAHOO_SERVICE_P2PFILEXFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3141 /* 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
3142 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
3143 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
3144 case YAHOO_SERVICE_FILETRANSFER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3145 yahoo_process_filetransfer(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3146 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3147 case YAHOO_SERVICE_PEERTOPEER:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3148 yahoo_process_p2p(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3149 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3150 case YAHOO_SERVICE_PICTURE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3151 yahoo_process_picture(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3152 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3153 case YAHOO_SERVICE_PICTURE_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3154 yahoo_process_picture_update(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3155 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3156 case YAHOO_SERVICE_PICTURE_CHECKSUM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3157 yahoo_process_picture_checksum(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3158 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3159 case YAHOO_SERVICE_PICTURE_UPLOAD:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3160 yahoo_process_picture_upload(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3161 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3162 case YAHOO_SERVICE_AVATAR_UPDATE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3163 yahoo_process_avatar_update(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3164 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3165 case YAHOO_SERVICE_AUDIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3166 yahoo_process_audible(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3167 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3168 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
3169 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
3170 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3171 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
3172 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
3173 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3174 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
3175 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
3176 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
3177 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
3178 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
3179 break;
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3180
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3181 default:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3182 purple_debug(PURPLE_DEBUG_ERROR, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3183 "Unhandled service 0x%02x\n", pkt->service);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3184 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3185 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3186 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3187
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3188 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
3189 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3190 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3191 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3192 char buf[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3193 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3194
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3195 len = read(yd->fd, buf, sizeof(buf));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3196
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3197 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3198 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3199
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3200 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3201 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3202 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3203
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3204 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
3205 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3206 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
3207 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3208 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3209 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3210 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
3211 _("Server closed the connection."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3212 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3213 }
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
3214 gc->last_received = time(NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3215 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
3216 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3217 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3218
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3219 while (1) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3220 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3221 int pos = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3222 int pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3223
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3224 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3225 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3226
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3227 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
3228 /* 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
3229 * are you trying to pull? */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3230 guchar *start;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3231
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3232 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
3233
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3234 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
3235 if (start) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3236 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
3237 yd->rxlen -= start - yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3238 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3239 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3240 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3241 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3242 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3243 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3244 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3245 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3246
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3247 pos += 4; /* YMSG */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3248 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3249 pos += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3250
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3251 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
3252 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3253 "%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
3254
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3255 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3256 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3257
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3258 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
3259
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3260 pkt = yahoo_packet_new(0, 0, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3261
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3262 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
3263 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
3264 purple_debug(PURPLE_DEBUG_MISC, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3265 "Yahoo Service: 0x%02x Status: %d\n",
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3266 pkt->service, pkt->status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3267 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
3268
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3269 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
3270
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3271 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3272 if (yd->rxlen) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3273 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
3274 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3275 yd->rxqueue = tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3276 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3277 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3278 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3279 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3280
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3281 yahoo_packet_process(gc, pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3282
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3283 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3284 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3285 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3286
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3287 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
3288 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3289 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3290 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3291 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3292
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3293 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3294 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3295 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3296 }
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 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3299 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3300 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
3301 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3302 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
3303 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3304 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3306
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3307 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3308 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3309
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3310 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
3311
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3312 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
3313 yahoo_packet_send_and_free(pkt, yd);
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 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
3316 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3317
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3318 #ifdef TRY_WEBMESSENGER_LOGIN
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3319 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
3320 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3321 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3322 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3323 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3324
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3325 if (!PURPLE_CONNECTION_IS_VALID(gc)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3326 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3327 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3328 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3329
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3330 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3331 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3332 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
3333 error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3334 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
3335 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3336 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3337 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3338
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3339 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3340 yd->fd = source;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3341
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3342 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
3343
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3344 yahoo_packet_hash(pkt, "sss", 0,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3345 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
3346 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
3347 6, yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3348 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3349
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3350 g_free(yd->auth);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3351 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
3352 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3353
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3354 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
3355 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3356 PurpleConnection *gc = data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3357 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
3358 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3359 char bufread[2048], *i = bufread, *buf = bufread;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3360 int len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3361 GString *s;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3362
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3363 len = read(source, bufread, sizeof(bufread) - 1);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3364
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3365 if (len < 0) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3366 gchar *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3367
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3368 if (errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3369 /* No worries */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3370 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3371
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3372 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
3373 g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3374 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
3375 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3376 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3377 } else if (len == 0) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3378 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
3379 _("Server closed the connection."));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3380 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3381 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3382
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3383 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
3384 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
3385 memcpy(yd->rxqueue + yd->rxlen, buf, len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3386 yd->rxlen += len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3387 i = buf = (char *)yd->rxqueue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3388 len = yd->rxlen;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3389 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3390 buf[len] = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3391
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3392 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
3393 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
3394 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
3395 _("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
3396 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
3397 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3398 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3399
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3400 s = g_string_sized_new(len);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3401
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3402 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
3403
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3404 i += strlen("Set-Cookie: ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3405 for (;*i != ';' && *i != '\0'; i++)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3406 g_string_append_c(s, *i);
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3407
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3408 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
3409 /* 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
3410 * 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
3411 */
15373
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 yd->auth = g_string_free(s, FALSE);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3415 purple_input_remove(gc->inpa);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3416 close(source);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3417 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3418 yd->rxqueue = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3419 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3420 /* 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
3421 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
3422 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
3423 yahoo_got_web_connected, gc) == NULL) {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3424 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
3425 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3426 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3427 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3428 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3429
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3430 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
3431 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3432 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3433 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3434 int written, remaining;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3435
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3436 gc = data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3437 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3438
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3439 remaining = strlen(yd->auth) - yd->auth_written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3440 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
3441
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3442 if (written < 0 && errno == EAGAIN)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3443 written = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3444 else if (written <= 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3445 gchar *tmp;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3446 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3447 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3448 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3449 purple_input_remove(gc->inpa);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3450 gc->inpa = 0;
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3451 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
3452 "login.yahoo.com:80", g_strerror(errno));
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3453 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
3454 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3455 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3456 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3457
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3458 if (written < remaining) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3459 yd->auth_written += written;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3460 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3461 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3462
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3463 g_free(yd->auth);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3464 yd->auth = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3465 yd->auth_written = 0;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3466 purple_input_remove(gc->inpa);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3467 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
3468 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3469
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3470 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
3471 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3472 PurpleConnection *gc = data;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3473
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3474 if (source < 0) {
17449
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3475 gchar *tmp;
df788cd53596 Better error messages for Yahoo! login failures
Mark Doliner <mark@kingant.net>
parents: 17043
diff changeset
3476 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
3477 "login.yahoo.com:80", error_message);
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3478 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
3479 g_free(tmp);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3480 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3481 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3482
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3483 if (gc->inpa == 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3484 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3485 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
3486 yahoo_got_cookies_send_cb, gc);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3487 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
3488 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3489 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3491 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
3492 {
24593
9fb7910c1176 Add a debug line and remove a duplicate "login=" get parameter which
Mark Doliner <mark@kingant.net>
parents: 24590
diff changeset
3493 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
3494 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3495 g_string_append_c(url, '&');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3496 g_string_append(url, key);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3497 g_string_append_c(url, '=');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3498 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3499 g_string_append_c(url, '1');
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3500 else if (!strcmp(key, ".challenge"))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3501 g_string_append(url, val);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3502 else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3503 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
3504 }
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 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
3507 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3508 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
3509 const char *c = buf;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3510 char *d;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3511 char name[64], value[64];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3512 int count;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3513 int input_len = strlen("<input ");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3514 int name_len = strlen("name=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3515 int value_len = strlen("value=\"");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3516 while ((len > ((c - buf) + input_len))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3517 && (c = strstr(c, "<input "))) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3518 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
3519 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3520 c += name_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3521 count = sizeof(name)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3522 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
3523 && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3524 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3525 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3526 count = sizeof(value)-1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3527 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
3528 continue;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3529 d += value_len;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3530 if (strchr(c, '>') < d)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3531 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3532 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
3533 && *c!='"' && count; c++, d++, count--)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3534 *d = *c;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3535 *d = '\0';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3536 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
3537 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3538 return hash;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3539 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3540
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3541 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3542 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
3543 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
3544 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3545 PurpleConnection *gc = (PurpleConnection *)user_data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3546 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
3547 struct yahoo_data *yd = gc->proto_data;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3548 const char *sn = purple_account_get_username(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3549 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
3550 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
3551 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
3552 char md5[33], *hashp = md5, *chal;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3553 int i;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3554 PurpleCipher *cipher;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3555 PurpleCipherContext *context;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3556 guchar digest[16];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3557
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3558 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
3559
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3560 if (error_message != NULL)
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3561 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3562 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
3563 error_message);
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3564 return;
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3565 }
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3566
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3567 url = g_string_append(url, sn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3568 url = g_string_append(url, "&passwd=");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3569
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3570 cipher = purple_ciphers_find_cipher("md5");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3571 context = purple_cipher_context_new(cipher, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3572
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3573 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
3574 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
3575 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3576 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3577 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3578 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3579
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3580 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
3581 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3582 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
3583 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
3584 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3585 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3586 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3587 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3588 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3589 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3590 * 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
3591 * I updated it..
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3592
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3593 purple_cipher_context_reset(context, NULL);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3594 purple_cipher_context_append(context, md5, strlen(md5));
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3595 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
3596 hashp = md5;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3597 for (i = 0; i < 16; ++i) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3598 g_snprintf(hashp, 3, "%02x", digest[i]);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3599 hashp += 2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3600 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3601 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3602 g_free(chal);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3603
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3604 url = g_string_append(url, md5);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3605 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
3606
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3607 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
3608 "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
3609 g_hash_table_destroy(hash);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3610 yd->auth = g_string_free(url, FALSE);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3611 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
3612 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
3613 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3614 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3615 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3616
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3617 purple_cipher_context_destroy(context);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3618 }
15743
12778e2f7282 Disable Yahoo! web authentication. It's failing right now because
Mark Doliner <mark@kingant.net>
parents: 15623
diff changeset
3619 #endif
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3620
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3621 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
3622 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3623 const char *server;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3624
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3625 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
3626
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3627 if (strcmp(server, "scs.yahoo.com") == 0)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3628 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
3629 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3630
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3631 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
3632 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3633 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
3634 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
3635
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
3636 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
3637 purple_imgstore_unref(img);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3638 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3639
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3640 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
3641 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3642 PurplePresence *presence;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3643 const char *status_id;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3646 presence = purple_status_get_presence(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3647 status_id = purple_status_get_id(status);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3648 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
3649
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3650 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
3651 if ((msg != NULL) && (*msg != '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3652 return YAHOO_STATUS_CUSTOM;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3653 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3654 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3655 } 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
3656 return YAHOO_STATUS_BRB;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3657 } 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
3658 return YAHOO_STATUS_BUSY;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3659 } 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
3660 return YAHOO_STATUS_NOTATHOME;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3661 } 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
3662 return YAHOO_STATUS_NOTATDESK;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3663 } 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
3664 return YAHOO_STATUS_NOTINOFFICE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3665 } 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
3666 return YAHOO_STATUS_ONPHONE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3667 } 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
3668 return YAHOO_STATUS_ONVACATION;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3669 } 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
3670 return YAHOO_STATUS_OUTTOLUNCH;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3671 } 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
3672 return YAHOO_STATUS_STEPPEDOUT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3673 } 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
3674 return YAHOO_STATUS_INVISIBLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3675 } 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
3676 return YAHOO_STATUS_CUSTOM;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3677 } 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
3678 return YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3679 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3680 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
3681 return YAHOO_STATUS_AVAILABLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3682 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3683 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3684
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3685 static void yahoo_login(PurpleAccount *account) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3686 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
3687 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
3688 PurpleStatus *status = purple_account_get_active_status(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3689 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
3690
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3691 purple_connection_update_progress(gc, _("Connecting"), 1, 2);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3692
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3693 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
3694
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
3695 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
3696 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
3697 yd->txhandler = 0;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3698 /* 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
3699 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
3700 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
3701 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
3702 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
3703 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
3704 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
3705 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
3706 yd->confs = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3707 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
3708 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
3709
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3710 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
3711
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3712 yahoo_server_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3713 yahoo_picture_check(account);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3714
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3715 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
3716 yd->jp = TRUE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3717 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3718 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
3719 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
3720 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3721 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3722 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
3723 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3724 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3725 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3726 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3727 yd->jp = FALSE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3728 if (purple_proxy_connect(gc, account,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3729 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
3730 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
3731 yahoo_got_connected, gc) == NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3732 {
21358
ba41f2a60253 Rename:
Will Thompson <will.thompson@collabora.co.uk>
parents: 20816
diff changeset
3733 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
3734 _("Connection problem"));
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3735 return;
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3738 }
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 static void yahoo_close(PurpleConnection *gc) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3741 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
3742 GSList *l;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3743
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3744 if (gc->inpa)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3745 purple_input_remove(gc->inpa);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3746
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3747 while (yd->url_datas) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3748 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
3749 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
3750 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3751
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3752 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
3753 PurpleConversation *conv = l->data;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3754
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3755 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
3756 purple_connection_get_display_name(gc),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3757 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
3758 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3759 g_slist_free(yd->confs);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3760
22018
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3761 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
3762 g_free(l->data);
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3763 l->data=NULL;
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3764 }
118046227581 This patch from Thanumalayan S. implements Yahoo protocol version 15 file
Thanumalayan <madthanu@gmail.com>
parents: 22017
diff changeset
3765 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
3766
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
3767 yd->chat_online = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3768 if (yd->in_chat)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3769 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
3770
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3771 purple_timeout_remove(yd->yahoo_p2p_timer);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3772 if(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
3773 purple_timeout_remove(yd->yahoo_p2p_server_timeout_handle);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3774
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3775 /* close p2p server if it is waiting for a peer 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
3776 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
3777 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
3778 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
3779
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
3780 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
3781 g_hash_table_destroy(yd->peers);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3782 g_hash_table_destroy(yd->friends);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3783 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
3784 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
3785 g_free(yd->chat_name);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3786
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3787 g_free(yd->cookie_y);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3788 g_free(yd->cookie_t);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3789
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3790 if (yd->txhandler)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3791 purple_input_remove(yd->txhandler);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3792
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3793 purple_circ_buffer_destroy(yd->txbuf);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3794
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3795 if (yd->fd >= 0)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3796 close(yd->fd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3797
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3798 g_free(yd->rxqueue);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3799 yd->rxlen = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3800 g_free(yd->picture_url);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3801
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3802 if (yd->buddy_icon_connect_data)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3803 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
3804 if (yd->picture_upload_todo)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3805 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
3806 if (yd->ycht)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3807 ycht_connection_close(yd->ycht);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3808
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
3809 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
3810 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
3811 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
3812 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
3813
22416
0c098ebe9f16 Fixed bug in which Yahoo contacts were erroneously considered to be blocked,
Evan Schoenberg <evan.s@dreskin.net>
parents: 22330
diff changeset
3814 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
3815
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3816 g_free(yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3817 gc->proto_data = NULL;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3820 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
3821 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3822 return "yahoo";
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3823 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3824
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3825 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
3826 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3827 PurpleAccount *account;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3828 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3829 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3830 YahooFriend *f;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3831 PurplePresence *presence;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3832
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3833 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
3834 !(gc = purple_account_get_connection(account)) ||
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3835 !(yd = gc->proto_data))
15497
0d4890637238 clean up some compile warnings
Nathan Walp <nwalp@pidgin.im>
parents: 15462
diff changeset
3836 return NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3837
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3838 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
3839 if (!f) {
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3840 return "not-authorized";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3841 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3842
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3843 presence = purple_buddy_get_presence(b);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3844
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3845 if (purple_presence_is_online(presence)) {
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3846 if (yahoo_friend_get_game(f))
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3847 return "game";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3848 if (f->protocol == 2)
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3849 return "msn";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3850 }
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
3851 return NULL;
15373
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 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
3855 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3856 switch (a) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3857 case YAHOO_STATUS_BRB:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3858 return _("Be Right Back");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3859 case YAHOO_STATUS_BUSY:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3860 return _("Busy");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3861 case YAHOO_STATUS_NOTATHOME:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3862 return _("Not at Home");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3863 case YAHOO_STATUS_NOTATDESK:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3864 return _("Not at Desk");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3865 case YAHOO_STATUS_NOTINOFFICE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3866 return _("Not in Office");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3867 case YAHOO_STATUS_ONPHONE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3868 return _("On the Phone");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3869 case YAHOO_STATUS_ONVACATION:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3870 return _("On Vacation");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3871 case YAHOO_STATUS_OUTTOLUNCH:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3872 return _("Out to Lunch");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3873 case YAHOO_STATUS_STEPPEDOUT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3874 return _("Stepped Out");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3875 case YAHOO_STATUS_INVISIBLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3876 return _("Invisible");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3877 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3878 return _("Idle");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3879 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3880 return _("Offline");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3881 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3882 return _("Available");
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 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3885
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3886 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
3887
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3888 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3889 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3890
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3891 GHashTable *components;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3892 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3893 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3894
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3895 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
3896
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3897 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3898 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
3899 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3900 id = yd->conf_id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3901
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3902 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
3903 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
3904 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
3905 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
3906 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
3907 yahoo_c_join(gc, components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3908 g_hash_table_destroy(components);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3909
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3910 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
3911 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3912
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3913 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
3914 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3915 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3916 int presence_val = GPOINTER_TO_INT(data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3917
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3918 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3919 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
3920
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3921 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
3922 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3923
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3924 static void yahoo_game(PurpleBlistNode *node, gpointer data) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3925
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3926 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3927 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3928
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3929 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3930 const char *game;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3931 char *game2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3932 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3933 char url[256];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3934 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3935
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3936 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
3937
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3938 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3939 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
3940 yd = (struct yahoo_data *) gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3941
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3942 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
3943 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3944 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3945
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3946 game = yahoo_friend_get_game(f);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3947 if (!game)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3948 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3950 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
3951 while (*t && *t != '\t')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3952 t++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3953 *t = 0;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3954 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
3955 purple_notify_uri(gc, url);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3956 g_free(game2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3957 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3958
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
3959 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
3960 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3961 YahooFriend *f = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3962 const char *msg;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3963 char *msg2;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3964 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3965
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3966 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3967 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
3968 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3969 return g_strdup(_("Not on server list"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3970
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3971 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3972 case YAHOO_STATUS_AVAILABLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3973 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3974 case YAHOO_STATUS_IDLE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3975 if (f->idle == -1)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3976 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
3977 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3978 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3979 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
3980 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3981 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
3982 purple_util_chrreplace(msg2, '\n', ' ');
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3983 return msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3984
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3985 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3986 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
3987 }
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 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
3991 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3992 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3993 char *escaped;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3994 char *status = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
3995 const char *presence = NULL;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3996 PurpleAccount *account;
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3997
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3998 account = purple_buddy_get_account(b);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
3999 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
4000 if (!f)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4001 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
4002 else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4003 switch (f->status) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4004 case YAHOO_STATUS_CUSTOM:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4005 if (!yahoo_friend_get_status_message(f))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4006 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4007 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
4008 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4009 case YAHOO_STATUS_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4010 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4011 default:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4012 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
4013 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4014 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4015
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4016 switch (f->presence) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4017 case YAHOO_PRESENCE_ONLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4018 presence = _("Appear Online");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4019 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4020 case YAHOO_PRESENCE_PERM_OFFLINE:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4021 presence = _("Appear Permanently Offline");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4022 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4023 case YAHOO_PRESENCE_DEFAULT:
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4024 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4025 default:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4026 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
4027 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4028 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4029 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4030
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4031 if (status != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4032 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
4033 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
4034 g_free(status);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4035 g_free(escaped);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4036 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4037
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4038 if (presence != NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4039 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
4040 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4041
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4042 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
4043 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4044 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4045 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4046
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4047 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
4048
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4049 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4050 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
4051
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4052 yahoo_add_buddy(gc, buddy, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4053 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4054
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4055
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4056 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
4057 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4058 PurpleBuddy *buddy;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4059 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4060
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4061 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
4062
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4063 buddy = (PurpleBuddy *) node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4064 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
4065
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4066 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
4067 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4068
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4069 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
4070 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4071 PurpleMenuAction *act;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4072 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
4073
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4074 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4075 if (f->presence != YAHOO_PRESENCE_ONLINE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4076 act = purple_menu_action_new(_("Appear Online"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4077 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4078 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4079 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4080 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4081 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4082 act = purple_menu_action_new(_("Appear Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4083 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4084 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4085 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4086 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4087 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4088 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4089
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4090 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4091 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
4092 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4093 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4094 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4095 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4096 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4097 act = purple_menu_action_new(_("Appear Permanently Offline"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4098 PURPLE_CALLBACK(yahoo_presence_settings),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4099 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4100 NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4101 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4102 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4103
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4104 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4105 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4106
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4107 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
4108 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4109 PurpleBuddy *b = (PurpleBuddy *)node;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4110 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
4111 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
4112
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4113 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
4114 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4115
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4116 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
4117 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4118 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4119 PurpleMenuAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4120
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4121 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
4122 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4123 static char buf2[1024];
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4124 YahooFriend *f;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4125
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4126 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
4127
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4128 if (!f && !yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4129 act = purple_menu_action_new(_("Add Buddy"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4130 PURPLE_CALLBACK(yahoo_addbuddyfrommenu_cb),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4131 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4132 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4133
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4134 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4135
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4136 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4137
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4138 if (f && f->status != YAHOO_STATUS_OFFLINE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4139 if (!yd->wm) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4140 act = purple_menu_action_new(_("Join in Chat"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4141 PURPLE_CALLBACK(yahoo_chat_goto_menu),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4142 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4143 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4144 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4145
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4146 act = purple_menu_action_new(_("Initiate Conference"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4147 PURPLE_CALLBACK(yahoo_initiate_conference),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4148 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4149 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4150
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4151 if (yahoo_friend_get_game(f)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4152 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
4153 char *room;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4154 char *t;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4155
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4156 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
4157 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
4158 room++;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4159 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
4160 while (*t != '\n')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4161 t++; /* replace the \n with a space */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4162 *t = ' ';
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4163 g_snprintf(buf2, sizeof buf2, "%s", room);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4164
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4165 act = purple_menu_action_new(buf2,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4166 PURPLE_CALLBACK(yahoo_game),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4167 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4168 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4169 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4170 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4171 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4172
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4173 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4174 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
4175 build_presence_submenu(f, gc));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4176 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4177 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4178
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4179 if (f) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4180 act = purple_menu_action_new(_("Start Doodling"),
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4181 PURPLE_CALLBACK(yahoo_doodle_blist_node),
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4182 NULL, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4183 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4184 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4185
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4186 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4187 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4188
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4189 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
4190 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4191 if(PURPLE_BLIST_NODE_IS_BUDDY(node)) {
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4192 return yahoo_buddy_menu((PurpleBuddy *) node);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4193 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4194 return NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4195 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4196 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4197
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4198 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
4199 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4200 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4201
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4202 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
4203 yahoo_packet_hash_str(pkt, 3, entry);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4204 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4205
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4206 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
4207 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4208
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
4209 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
4210 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
4211 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
4212 {
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
4213 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
4214 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
4215 gchar *url;
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
4216 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
4217
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
4218 g_return_if_fail(PURPLE_CONNECTION_IS_VALID(gc));
22831
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
4219
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
4220 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
4221
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
4222 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
4223 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
4224 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
4225 /* 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
4226 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
4227 "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
4228 ".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
4229 "&.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
4230 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
4231 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
4232 }
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
4233
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
4234 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
4235 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
4236 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
4237 }
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
4238
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
4239 /* 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
4240 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
4241
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
4242 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
4243 }
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
4244
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
4245
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
4246 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
4247 {
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
4248 /* 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
4249 /* 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
4250
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
4251 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
4252 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
4253
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
4254 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
4255 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
4256 /* 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
4257 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
4258 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
4259 "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
4260 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s;\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
4261 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\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
4262 "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
4263 "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
4264 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
4265 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
4266
b0ed2ce8514d A patch from Gideon N. Guillen, with some minor modifications from me. This
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 21803
diff changeset
4267 url_data = purple_util_fetch_url_request(base_url, use_whole_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
4268 "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE,
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
4269 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
4270
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
4271 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
4272
22831
0b11895cc564 Leak fixes. Avoid creating an unnecessary parallel data structure to YahooFriend.
Daniel Atallah <daniel.atallah@gmail.com>
parents: 22794
diff changeset
4273 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
4274 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
4275 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
4276 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
4277 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
4278 "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
4279 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
4280 }
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
4281
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
4282 }
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
4283
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
4284
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4285 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
4286 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4287 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
4288 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
4289 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
4290 _("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
4291 _("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
4292 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
4293 gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4294 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4295
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4296 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
4297 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4298 PurpleConnection *gc = (PurpleConnection *) action->context;
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
4299 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
4300 "", FALSE, FALSE, NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4301 _("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
4302 _("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
4303 purple_connection_get_account(gc), NULL, NULL,
21099
51cf02dbdb0e disapproval of revision 'c484d979c4fda4433a9633ff8b69bd8a395c9479'
Richard Laager <rlaager@wiktel.com>
parents: 21095
diff changeset
4304 gc);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4305 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4306
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4307 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
4308 GList *m = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4309 PurplePluginAction *act;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4310
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4311 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
4312 yahoo_show_act_id);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4313 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4314
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4315 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
4316 yahoo_show_chat_goto);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4317 m = g_list_append(m, act);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4318
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
4319 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
4320 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
4321 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
4322 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
4323
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4324 return m;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4325 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4326
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4327 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
4328 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
4329 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
4330 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
4331 };
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4332
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4333 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
4334
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4335 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
4336 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
4337 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4338 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
4339 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
4340 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
4341 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
4342 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
4343 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
4344 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
4345 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
4346
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4347 if (error_message != NULL) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4348 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
4349
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4350 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
4351 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
4352 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
4353 return ;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4354 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4355 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
4356 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
4357 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
4358 mobile_no = (char *)xmlnode_get_attrib(validate_data_child, "msisdn");
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4359
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4360 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
4361 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
4362 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
4363
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4364 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
4365 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
4366
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4367 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
4368
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4369 if( strcmp(status, "Valid") == 0) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4370 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
4371 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
4372 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4373 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4374 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
4375 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
4376 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4377
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4378 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
4379 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
4380 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
4381 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
4382 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
4383 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
4384 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
4385 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
4386 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4387 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4388
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4389 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
4390 {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4391 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
4392 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
4393 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
4394 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
4395 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
4396 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
4397 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
4398 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
4399
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4400 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
4401 return;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4402
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4403 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
4404 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
4405 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
4406 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
4407
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4408 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
4409 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
4410
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4411 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
4412
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4413 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
4414 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
4415
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4416 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
4417 "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
4418 "Cookie: T=%s; path=/; domain=.yahoo.com; Y=%s; path=/; domain=.yahoo.com;\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
4419 "User-Agent: Mozilla/4.0 (compatible; MSIE 5.5)\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
4420 "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
4421 "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
4422 "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
4423 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
4424
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4425 /* 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
4426 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
4427 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
4428
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4429 url_data = purple_util_fetch_url_request(YAHOO_SMS_CARRIER_URL, use_whole_url,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4430 "Mozilla/4.0 (compatible; MSIE 5.5)", TRUE, request, FALSE,
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4431 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
4432
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4433 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
4434 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
4435
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4436 if (!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
4437 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
4438 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
4439 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
4440 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
4441 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
4442 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
4443 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4444 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4445
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4446 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
4447 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4448 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
4449 struct yahoo_packet *pkt = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4450 char *msg = yahoo_html_to_codes(what);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4451 char *msg2;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4452 gboolean utf8 = TRUE;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4453 PurpleWhiteboard *wb;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4454 int ret = 1;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4455 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
4456 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
4457 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
4458 struct yahoo_p2p_data *p2p_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4459 gboolean msn = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4460 msg2 = yahoo_string_encode(gc, msg, &utf8);
24400
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4461
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4462 if(msg2) {
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4463 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
4464 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
4465
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4466 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
4467 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
4468 " 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
4469 " 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
4470 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
4471 yahoo_packet_free(pkt);
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4472 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
4473 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
4474 return -E2BIG;
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4475 }
9e0458c98b4c This was originally a patch from Brian Geppert that corrected the 'silently
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 24171
diff changeset
4476 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4477
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4478 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
4479
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4480 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
4481 /* 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
4482 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
4483 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
4484 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
4485 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
4486
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4487 carrier = g_hash_table_lookup(yd->sms_carrier, who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4488 if (!carrier) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4489 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
4490 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
4491 sms_cb_data->gc = gc;
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4492 sms_cb_data->who = g_malloc(strlen(who));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4493 sms_cb_data->what = g_malloc(strlen(what));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4494 strcpy(sms_cb_data->who, who);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4495 strcpy(sms_cb_data->what, what);
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4496
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4497 purple_conversation_write(conv, NULL, "Getting mobile carrier to send the sms", PURPLE_MESSAGE_SYSTEM, time(NULL));
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4498
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4499 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
4500
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4501 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
4502 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
4503 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
4504 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4505 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
4506 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
4507
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4508 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
4509 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
4510 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
4511 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4512
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4513 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
4514 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
4515 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
4516 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
4517 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
4518 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
4519 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
4520 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
4521 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
4522
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4523 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
4524 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
4525
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4526 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
4527 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4528
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4529 pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4530 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
4531 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
4532 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
4533 }
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
4534 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
4535 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
4536 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
4537 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
4538 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4539
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4540 if (utf8)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4541 yahoo_packet_hash_str(pkt, 97, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4542 yahoo_packet_hash_str(pkt, 14, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4543
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4544 /*
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4545 * IMVironment.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4546 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4547 * 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
4548 * 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
4549 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4550 * 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
4551 * 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
4552 * to nothing.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4553 *
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4554 * 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
4555 */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4556 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
4557 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
4558 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
4559 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4560 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4561 const char *imv;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4562 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
4563 if (imv != NULL)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4564 yahoo_packet_hash_str(pkt, 63, imv);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4565 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4566 yahoo_packet_hash_str(pkt, 63, ";0");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4567 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4568
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4569 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
4570 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
4571 if (!yd->picture_url)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4572 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
4573 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4574 yahoo_packet_hash_str(pkt, 206, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4575
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4576 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
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 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000) {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4578 /* if p2p link exists, send through it. To-do: key 15, time value to be sent in case of p2p */
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4579 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
4580 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
4581 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
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_send(pkt, yd);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4585 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
4586 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
4587 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4588 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4589 else
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4590 ret = -E2BIG;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4591
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4592 yahoo_packet_free(pkt);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4593
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4594 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4595 g_free(msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4596
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4597 return ret;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4598 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4599
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4600 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
4601 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4602 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
4603 struct yahoo_p2p_data *p2p_data;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4604 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
4605 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
4606
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4607 /* 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
4608 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
4609 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
4610
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
4611 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
4612
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4613 /* check to see if p2p link exists, send through it */
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4614 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
4615 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
4616 14, " ", 13, state == PURPLE_TYPING ? "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
4617 5, who, 11, p2p_data->session_id, 1002, "1"); /* To-do: key 15 to be sent in case of p2p */
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4618 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
4619 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
4620 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4621 else { /* send through yahoo server */
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4622 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
4623 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
4624 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
4625 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
4626 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
4627 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
4628 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
4629 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
4630 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
4631 }
15373
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 return 0;
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4636 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
4637 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4638 YahooFriend *f = value;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4639 if (f && f->presence == YAHOO_PRESENCE_ONLINE)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4640 f->presence = YAHOO_PRESENCE_DEFAULT;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4641 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4642
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4643 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
4644 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4645 PurpleConnection *gc;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4646 PurplePresence *presence;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4647 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4648 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4649 int old_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4650 const char *msg = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4651 char *tmp = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4652 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
4653 gboolean utf8 = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4654
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4655 if (!purple_status_is_active(status))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4656 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4657
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4658 gc = purple_account_get_connection(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4659 presence = purple_status_get_presence(status);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4660 yd = (struct yahoo_data *)gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4661 old_status = yd->current_status;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4662
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4663 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
4664
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4665 if (yd->current_status == YAHOO_STATUS_CUSTOM)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4666 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4667 msg = purple_status_get_attr_string(status, "message");
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4668
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4669 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
4670 tmp = yahoo_string_encode(gc, msg, &utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4671 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
4672 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4673 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4674 if ((msg == NULL) || (*msg == '\0'))
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4675 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
4676 tmp = yahoo_string_encode(gc, msg, &utf8);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4677 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
4678 g_free(tmp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4679 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4680 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4681
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4682 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4683 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
4684 yahoo_packet_hash_str(pkt, 13, "2");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4685 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4686
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4687 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4688 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4689
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4690 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4691 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
4692
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4693 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
4694 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
4695 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
4696 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4697 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4698 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4699
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4700 g_free(conv_msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4701
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4702 if (purple_presence_is_idle(presence))
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4703 yahoo_packet_hash_str(pkt, 47, "2");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4704 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
4705 yahoo_packet_hash_str(pkt, 47, "1");
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 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4708
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4709 if (old_status == YAHOO_STATUS_INVISIBLE) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4710 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
4711 yahoo_packet_hash_str(pkt, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4712 yahoo_packet_send_and_free(pkt, yd);
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 /* Any per-session presence settings are removed */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4715 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
4716
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4717 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4718 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4719
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4720 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
4721 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4722 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4723 struct yahoo_packet *pkt = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4724 char *msg = NULL, *msg2 = NULL;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4725 PurpleStatus *status = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4726
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4727 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
4728 yd->current_status = YAHOO_STATUS_IDLE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4729 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
4730 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
4731 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
4732 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4733
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4734 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
4735
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4736 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
4737 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4738 const char *tmp;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4739 if (status == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4740 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
4741 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
4742 if (tmp != NULL) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4743 msg = yahoo_string_encode(gc, tmp, NULL);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4744 msg2 = purple_markup_strip_html(msg);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4745 yahoo_packet_hash_str(pkt, 19, msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4746 } else {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4747 /* 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
4748 * 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
4749 yahoo_packet_hash_str(pkt, 19, _("Away"));
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4750 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4751 } else {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4752 yahoo_packet_hash_str(pkt, 19, "");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4753 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4754
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4755 if (idle)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4756 yahoo_packet_hash_str(pkt, 47, "2");
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4757 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
4758 yahoo_packet_hash_str(pkt, 47, "1");
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 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4761
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4762 g_free(msg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4763 g_free(msg2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4764 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4765
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4766 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
4767 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4768 PurpleStatusType *type;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4769 GList *types = NULL;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4770
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4771 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
4772 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4773 "message", _("Message"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4774 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
4775 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4776
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4777 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
4778 NULL, TRUE, TRUE, FALSE,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4779 "message", _("Message"),
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4780 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
4781 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4782
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4783 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
4784 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4785
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4786 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
4787 types = g_list_append(types, type);
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 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
4790 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4791
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4792 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
4793 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4794
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4795 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
4796 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4797
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4798 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
4799 types = g_list_append(types, type);
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 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
4802 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4803
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4804 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
4805 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4806
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4807 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
4808 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4809
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4810
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4811 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
4812 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4813
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4814 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
4815 types = g_list_append(types, type);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4816
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4817 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
4818 types = g_list_append(types, type);
2193394fd427 Yahoo mobile status
Sean Egan <seanegan@gmail.com>
parents: 15497
diff changeset
4819
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4820 return types;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4821 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4822
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4823 static void yahoo_keepalive(PurpleConnection *gc)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4824 {
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
4825 struct yahoo_packet *pkt;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4826 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
4827 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
4828
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
4829 /* 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
4830 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
4831 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
4832
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
4833 /* 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
4834 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
4835 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
4836 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
4837 } 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
4838 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
4839 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
4840 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
4841 }
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
4842 } 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
4843 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
4844 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
4845 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4846 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4847
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
4848 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
4849 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
4850 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
4851 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
4852 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
4853 }
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
4854
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4855 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4856
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4857 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
4858 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4859 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
4860 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
4861 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
4862 char *group2;
19299
b3a5e7c45b5c Allow you to authorize msn buddies to add your yahoo account.
Tim Ringenbach <marv@pidgin.im>
parents: 19199
diff changeset
4863 YahooFriend *f;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4864 const char *bname;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4865 gboolean msn = FALSE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4866
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4867 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4868 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4869
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4870 bname = purple_buddy_get_name(buddy);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4871 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
4872 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4873
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4874 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
4875 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
4876
22239
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4877 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
4878 if (g)
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4879 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
4880 else
1ca7a70f1faa Use the group passed into yahoo_add_buddy() instead of looking
Mark Doliner <mark@kingant.net>
parents: 22238
diff changeset
4881 group = "Buddies";
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4882
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4883 group2 = yahoo_string_encode(gc, group, NULL);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4884 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4885 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
4886 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
4887 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4888 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
4889 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
4890 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
4891 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
4892 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
4893 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
4894 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
4895 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
4896 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
4897 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
4898 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4899 }
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4900 else {
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4901 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
4902 14, "",
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4903 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
4904 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
4905 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
4906 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
4907 300, "319",
26172
7114d475a9e7 propagate from branch 'im.pidgin.pidgin' (head aa9e255d8e32921a2fe4e6bd74fe36d1ffdc9ec1)
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26171 25925
diff changeset
4908 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
4909 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
4910 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
4911 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
4912 );
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
4913 }
26171
bfaed4d103b4 Update yahoo.c as per im.pidgin.pidgin to resolve conflicts
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26170
diff changeset
4914 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
4915 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
4916
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4917 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4918 g_free(group2);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4919 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4920
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4921 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
4922 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4923 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
4924 struct yahoo_packet *pkt;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4925 GSList *buddies, *l;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4926 PurpleGroup *g;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4927 gboolean remove = TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4928 char *cg;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4929 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
4930 YahooFriend *f = NULL;
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4931 gboolean msn = FALSE;
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4932
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4933 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
4934 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
4935 if (!f)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4936 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4937
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4938 gname = purple_group_get_name(group);
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4939 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
4940 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
4941 msn = TRUE;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4942 for (l = buddies; l; l = l->next) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4943 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
4944 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
4945 remove = FALSE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4946 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4947 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4948 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4949
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4950 g_slist_free(buddies);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4951
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4952 if (remove)
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4953 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
4954
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
4955 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
4956 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
4957
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
4958 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
4959 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
4960 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
4961 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
4962 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
4963 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
4964 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
4965 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
4966 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4967 g_free(cg);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4968 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4969
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4970 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
4971 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
4972 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4973
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4974 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4975 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4976
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4977 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4978 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4979
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4980 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
4981 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
4982 7, who, 13, "1");
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4983 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4984 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4985
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
4986 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
4987 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
4988 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4989
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4990 if (!yd->logged_in)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4991 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4992
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4993 if (!who || who[0] == '\0')
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4994 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4995
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4996 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
4997 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
4998 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
4999 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5000
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5001 static void yahoo_set_permit_deny(PurpleConnection *gc)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5002 {
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5003 PurpleAccount *account;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5004 GSList *deny;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5005
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5006 account = purple_connection_get_account(gc);
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5007
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5008 switch (account->perm_deny)
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5009 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5010 case PURPLE_PRIVACY_ALLOW_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5011 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
5012 yahoo_rem_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5013 break;
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5014
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5015 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
5016 case PURPLE_PRIVACY_ALLOW_USERS:
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5017 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
5018 case PURPLE_PRIVACY_DENY_ALL:
22243
6dbbf194ec14 Clean up a function
Mark Doliner <mark@kingant.net>
parents: 22242
diff changeset
5019 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
5020 yahoo_add_deny(gc, deny->data);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5021 break;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5022 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5023 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5024
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5025 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
5026 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5027 yahoo_dest_colorht();
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5028
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5029 return TRUE;
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
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5032 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
5033 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
5034 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5035 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5036 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5037 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
5038 YahooFriend *f = yahoo_friend_find(gc, who);
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
5039 gboolean msn = FALSE;
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5040 const char *temp = NULL;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5041
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5042 /* 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
5043 * don't bother letting the server know.
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5044 */
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
5045 if (!f)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5046 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5047
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5048 if(f->protocol == 2) {
26166
bc31ebd391d3 use "msn/" rather than "wlm/"
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26164
diff changeset
5049 msn = TRUE;
26164
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5050 temp = who+4;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5051 } else
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5052 temp = who;
1e02d4592894 msn interoperability: change groups
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26163
diff changeset
5053
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5054 /* 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
5055 * 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
5056 * 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
5057 */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5058 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
5059 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
5060 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5061 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5062 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5063 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5064 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5065
19189
07413ddcd49c Allow you to move your Yahoo! buddies between groups again.
Tim Ringenbach <marv@pidgin.im>
parents: 18769
diff changeset
5066 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
5067 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
5068 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
5069 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
5070 "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
5071 else
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
5072 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
5073 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
5074 "240", 303, "240");
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5075 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5076
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5077 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5078 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5079 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5080
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5081 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
5082 PurpleGroup *group, GList *moved_buddies)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5083 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5084 struct yahoo_data *yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5085 struct yahoo_packet *pkt;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5086 char *gpn, *gpo;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5087
25130
16734635febf Start hiding blist.h internals in prpls.
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 24171
diff changeset
5088 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
5089 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
5090 if (!strcmp(gpn, gpo)) {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5091 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5092 g_free(gpo);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5093 return;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5094 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5095
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5096 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
5097 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
5098 65, gpo, 67, gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5099 yahoo_packet_send_and_free(pkt, yd);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5100 g_free(gpn);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5101 g_free(gpo);
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
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5104 /********************************* Commands **********************************/
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 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5107 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
5108 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
5109
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5110 if (*args && args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5111 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5112
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
5113 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
5114
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5115 return PURPLE_CMD_RET_OK;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5116 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5117
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5118 static PurplePlugin *my_protocol = NULL;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5119
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5120 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5121 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
5122 char **args, char **error, void *data)
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5123 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5124 GHashTable *comp;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5125 PurpleConnection *gc;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5126 struct yahoo_data *yd;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5127 int id;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5128
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5129 if (!args || !args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5130 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5131
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5132 gc = purple_conversation_get_gc(conv);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5133 yd = gc->proto_data;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5134 id = yd->conf_id;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5135 purple_debug(PURPLE_DEBUG_INFO, "yahoo",
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5136 "Trying to join %s \n", args[0]);
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 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
5139 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
5140 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
5141
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5142 yahoo_c_join(gc, comp);
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5143
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5144 g_hash_table_destroy(comp);
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5145 return PURPLE_CMD_RET_OK;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5146 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5147
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5148 static PurpleCmdRet
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5149 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
5150 char **args, char **error, void *data)
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 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
5153 if (*args && args[0])
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5154 return PURPLE_CMD_RET_FAILED;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5155 purple_roomlist_show_with_account(account);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5156 return PURPLE_CMD_RET_OK;
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5157 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5158
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5159 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
5160 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5161 return TRUE;
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5162 }
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
5163
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5164 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
5165 {
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5166 PurpleConversation *c;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5167
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
5168 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
5169 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
5170
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5171 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
5172
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5173 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
5174 "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
5175 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
5176
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5177 return TRUE;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5178 }
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5179
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5180 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
5181 {
19465
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
5182 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
5183
d9d9283680a4 In MSN prpl, use attention API. Can be disabled by undefining
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19464
diff changeset
5184 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
5185 /* 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
5186 /* 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
5187 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
5188 _("%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
5189 }
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5190
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5191 return list;
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5192 }
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5193
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5194 /************************** Plugin Initialization ****************************/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5195 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5196 yahoopurple_register_commands(void)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5197 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5198 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
5199 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5200 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5201 "prpl-yahoo", yahoopurple_cmd_chat_join,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5202 _("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
5203 purple_cmd_register("list", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5204 PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT |
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5205 PURPLE_CMD_FLAG_PRPL_ONLY,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5206 "prpl-yahoo", yahoopurple_cmd_chat_list,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5207 _("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
5208 purple_cmd_register("buzz", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5209 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
5210 "prpl-yahoo", yahoopurple_cmd_buzz,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5211 _("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
5212 purple_cmd_register("doodle", "", PURPLE_CMD_P_PRPL,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5213 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
5214 "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
5215 _("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
5216 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5217
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5218 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
5219 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5220 PurpleAccount *acct = NULL;
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5221
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5222 /* 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
5223 if (acct_id) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5224 acct = purple_accounts_find(acct_id, prpl);
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5225 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
5226 acct = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5227 } else { /* Otherwise find an active account for the protocol */
18063
926ccb104da0 disapproval of revision '1411afd7660760db59966c3a9f18e2adab8eb27e'
Richard Laager <rlaager@wiktel.com>
parents: 18058
diff changeset
5228 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
5229 while (l) {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5230 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
5231 && 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
5232 acct = l->data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5233 break;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5234 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5235 l = l->next;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5236 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5237 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5238
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5239 return acct;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5240 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5241
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5242 /* 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
5243 * 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
5244 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
5245 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5246 char **retval = user_data;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5247
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5248 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
5249 *retval = key;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5250 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5251 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5252
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5253 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
5254 {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5255 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
5256 PurpleAccount *acct;
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5257
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5258 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
5259 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5260
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5261 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
5262
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5263 if (!acct)
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5264 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5265
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5266 /* 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
5267 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
5268 char *sname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5269 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
5270 if (sname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5271 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
5272
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5273 PurpleConversation *conv = purple_find_conversation_with_account(
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5274 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
5275 if (conv == NULL)
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5276 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
5277 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
5278
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5279 if (message) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5280 /* Spaces are encoded as '+' */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5281 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
5282 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
5283 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5284 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
5285 /* else
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5286 **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
5287 * 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
5288 pidgindialogs_im(); */
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5289
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5290 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5291 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5292 /* ymsgr:Chat?roomname */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5293 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
5294 char *rname = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5295 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
5296 if (rname) {
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5297 /* 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
5298 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
5299 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
5300 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
5301 }
26156
3e788c0db3a6 resolved conflict -- merged im.pidgin.pidgin to im.pidgin.soc.2008.yahoo
Sulabh Mahajan <sulabh@soc.pidgin.im>
parents: 26154
diff changeset
5302 /* else
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5303 ** 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
5304 pidgin_blist_joinchat_show(); */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5305
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5306 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5307 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5308 /* ymsgr:AddFriend?name */
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5309 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
5310 char *name = NULL;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5311 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
5312 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
5313 return TRUE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5314 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5315
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5316 return FALSE;
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5317 }
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5318
24040
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5319 static GHashTable *
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5320 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
5321 {
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5322 GHashTable *table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5323 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
5324 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
5325 return table;
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5326 }
e339b3429965 Show 'ICQ UIN...' and 'Yahoo ID...' in the screenname field
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23986
diff changeset
5327
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5328 static PurpleWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5329 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5330 yahoo_doodle_start,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5331 yahoo_doodle_end,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5332 yahoo_doodle_get_dimensions,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5333 NULL,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5334 yahoo_doodle_get_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5335 yahoo_doodle_set_brush,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5336 yahoo_doodle_send_draw_list,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5337 yahoo_doodle_clear,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5338
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5339 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5340 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5341 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5342 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5343 NULL
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5344 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5345
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5346 static PurplePluginProtocolInfo prpl_info =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5347 {
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5348 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
5349 NULL, /* user_splits */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5350 NULL, /* protocol_options */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5351 {"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
5352 yahoo_list_icon,
15462
0b6f337a46d5 Emblems in the blist
Sean Egan <seanegan@gmail.com>
parents: 15382
diff changeset
5353 yahoo_list_emblem,
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5354 yahoo_status_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5355 yahoo_tooltip_text,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5356 yahoo_status_types,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5357 yahoo_blist_node_menu,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5358 yahoo_c_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5359 yahoo_c_info_defaults,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5360 yahoo_login,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5361 yahoo_close,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5362 yahoo_send_im,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5363 NULL, /* set info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5364 yahoo_send_typing,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5365 yahoo_get_info,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5366 yahoo_set_status,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5367 yahoo_set_idle,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5368 NULL, /* change_passwd*/
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5369 yahoo_add_buddy,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5370 NULL, /* add_buddies */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5371 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
5372 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
5373 NULL, /* add_permit */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5374 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
5375 NULL, /* rem_permit */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5376 yahoo_rem_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5377 yahoo_set_permit_deny,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5378 yahoo_c_join,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5379 NULL, /* reject chat invite */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5380 yahoo_get_chat_name,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5381 yahoo_c_invite,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5382 yahoo_c_leave,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5383 NULL, /* chat whisper */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5384 yahoo_c_send,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5385 yahoo_keepalive,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5386 NULL, /* register_user */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5387 NULL, /* get_cb_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5388 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
5389 yahoo_update_alias, /* alias_buddy */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5390 yahoo_change_buddys_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5391 yahoo_rename_group,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5392 NULL, /* buddy_free */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5393 NULL, /* convo_closed */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5394 purple_normalize_nocase, /* normalize */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5395 yahoo_set_buddy_icon,
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5396 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
5397 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
5398 NULL, /* set_chat_topic */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5399 NULL, /* find_blist_chat */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5400 yahoo_roomlist_get_list,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5401 yahoo_roomlist_cancel,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5402 yahoo_roomlist_expand_category,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5403 NULL, /* can_receive_file */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5404 yahoo_send_file,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5405 yahoo_new_xfer,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5406 yahoo_offline_message, /* offline_message */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5407 &yahoo_whiteboard_prpl_ops,
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5408 NULL, /* send_raw */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5409 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
5410 NULL, /* unregister_user */
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5411
19464
ca45543c11a3 Change Yahoo prpl to use attention API in libpurple. Previous behavior can
Jeffrey Connelly <jaconnel@calpoly.edu>
parents: 19444
diff changeset
5412 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
5413 yahoo_attention_types,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5414
23109
718a9c287839 Use up the last padding for PurplePluginProtocolInfo in a way that allows
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 22683
diff changeset
5415 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
5416 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
5417 NULL, /* initiate_media */
ff29208e03ef propagate from branch 'im.pidgin.pidgin' (head 75f0460d3679231b61d572e76fe02534a597c6b5)
Sadrul Habib Chowdhury <imadil@gmail.com>
parents: 23111 23787
diff changeset
5418 NULL /* can_do_media */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5419 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5420
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5421 static PurplePluginInfo info =
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5422 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5423 PURPLE_PLUGIN_MAGIC,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5424 PURPLE_MAJOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5425 PURPLE_MINOR_VERSION,
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5426 PURPLE_PLUGIN_PROTOCOL, /**< type */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5427 NULL, /**< ui_requirement */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5428 0, /**< flags */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5429 NULL, /**< dependencies */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5430 PURPLE_PRIORITY_DEFAULT, /**< priority */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5431 "prpl-yahoo", /**< id */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5432 "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
5433 DISPLAY_VERSION, /**< version */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5434 /** summary */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5435 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5436 /** description */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5437 N_("Yahoo Protocol Plugin"),
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5438 NULL, /**< author */
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5439 PURPLE_WEBSITE, /**< homepage */
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5440 NULL, /**< load */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5441 yahoo_unload_plugin, /**< unload */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5442 NULL, /**< destroy */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5443 NULL, /**< ui_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5444 &prpl_info, /**< extra_info */
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5445 NULL,
16667
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5446 yahoo_actions,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5447
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5448 /* padding */
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5449 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5450 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5451 NULL,
a338acd14365 And now the protocols
Gary Kramlich <grim@reaperworld.com>
parents: 16522
diff changeset
5452 NULL
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5453 };
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5454
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5455 static void
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5456 init_plugin(PurplePlugin *plugin)
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5457 {
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5458 PurpleAccountOption *option;
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5459
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5460 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
5461 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
5462
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5463 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
5464 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
5465
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5466 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
5467 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
5468
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5469 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
5470 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
5471
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5472 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
5473 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
5474
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5475 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
5476 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
5477
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5478 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
5479 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
5480
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5481 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
5482 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
5483
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5484 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
5485 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
5486
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5487 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
5488 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
5489
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5490
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5491 #if 0
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5492 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
5493 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
5494
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5495 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
5496 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
5497
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5498 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
5499 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
5500 #endif
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5501
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5502 my_protocol = plugin;
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5503 yahoopurple_register_commands();
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5504 yahoo_init_colorht();
15623
71af5b6209d5 uri-handler support for AIM/ICQ, Yahoo and MSN
Daniel Atallah <daniel.atallah@gmail.com>
parents: 15524
diff changeset
5505
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5506 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
5507 PURPLE_CALLBACK(yahoo_uri_handler), NULL);
15373
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5508 }
5fe8042783c1 Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff changeset
5509
15822
32c366eeeb99 sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@gmail.com>
parents: 15743
diff changeset
5510 PURPLE_INIT_PLUGIN(yahoo, init_plugin, info);