annotate src/protocols/yahoo/yahoo.c @ 13842:a9ff4499d9ce

[gaim-migrate @ 16295] Hopefully improve the typing notification code so it's a lot easier to understand. This also creates a distinction between the signals emitted when receiving GAIM_TYPED and GAIM_NOT_TYPING messages (by adding a gaim-typed signal). And the gaim-not-typing signal should work in all cases. Most of this is stuff I changed last week during work, thanks to Meebo committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Tue, 20 Jun 2006 08:17:49 +0000
parents 967ef719cb62
children 8d1c55309e3c
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1 /*
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2 * gaim
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3 *
8046
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8045
diff changeset
4 * Gaim is the legal property of its developers, whose names are too numerous
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8045
diff changeset
5 * to list here. Please refer to the COPYRIGHT file distributed with this
fa6395637e2c [gaim-migrate @ 8730]
Sean Egan <seanegan@gmail.com>
parents: 8045
diff changeset
6 * source distribution.
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * This program is free software; you can redistribute it and/or modify
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
9 * it under the terms of the GNU General Public License as published by
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * the Free Software Foundation; either version 2 of the License, or
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 * (at your option) any later version.
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * This program is distributed in the hope that it will be useful,
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 * GNU General Public License for more details.
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * You should have received a copy of the GNU General Public License
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * along with this program; if not, write to the Free Software
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
22 */
9369
241a799cc821 [gaim-migrate @ 10177]
Sean Egan <seanegan@gmail.com>
parents: 9329
diff changeset
23
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
24 #include "internal.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
25
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
26 #include "account.h"
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
27 #include "accountopt.h"
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
28 #include "blist.h"
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
29 #include "cipher.h"
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
30 #include "cmds.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
31 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
32 #include "notify.h"
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
33 #include "privacy.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
34 #include "prpl.h"
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
35 #include "proxy.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
36 #include "request.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
37 #include "server.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
38 #include "util.h"
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
39 #include "version.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
40
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
41 #include "yahoo.h"
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
42 #include "yahoochat.h"
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
43 #include "yahoo_auth.h"
12417
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
44 #include "yahoo_crypt.h"
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
45 #include "yahoo_doodle.h"
12417
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
46 #include "yahoo_filexfer.h"
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
47 #include "yahoo_friend.h"
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
48 #include "yahoo_packet.h"
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
49 #include "yahoo_picture.h"
d30c0a7a5619 [gaim-migrate @ 14724]
Richard Laager <rlaager@wiktel.com>
parents: 12378
diff changeset
50 #include "ycht.h"
2795
536bb833fdeb [gaim-migrate @ 2808]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2786
diff changeset
51
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
52 /* #define YAHOO_DEBUG */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
54 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *, GaimGroup *);
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
55 static void yahoo_login_page_cb(void *user_data, const char *buf, size_t len);
11653
c7aaac1fb252 [gaim-migrate @ 13937]
Mark Doliner <mark@kingant.net>
parents: 11644
diff changeset
56 static void yahoo_set_status(GaimAccount *account, GaimStatus *status);
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
57
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
58 static void
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
59 yahoo_add_permit(GaimConnection *gc, const char *who)
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
60 {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
61 gaim_debug_info("yahoo",
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
62 "Permitting ID %s local contact rights for account %s\n", who, gc->account);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
63 gaim_privacy_permit_add(gc->account,who,TRUE);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
64 }
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
65
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
66 static void
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
67 yahoo_rem_permit(GaimConnection *gc, const char *who)
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
68 {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
69 gaim_debug_info("yahoo",
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
70 "Denying ID %s local contact rights for account %s\n", who, gc->account);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
71 gaim_privacy_permit_remove(gc->account,who,TRUE);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
72 }
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
73
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
74 gboolean yahoo_privacy_check(GaimConnection *gc, const char *who)
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
75 {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
76 /* returns TRUE if allowed through, FALSE otherwise */
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
77 gboolean permitted;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
78
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
79 permitted = gaim_privacy_check(gc->account, who);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
80
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
81 /* print some debug info */
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
82 if (!permitted) {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
83 char *deb = NULL;
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
84 switch (gc->account->perm_deny)
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
85 {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
86 case GAIM_PRIVACY_DENY_ALL:
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
87 deb = "GAIM_PRIVACY_DENY_ALL";
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
88 break;
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
89 case GAIM_PRIVACY_DENY_USERS:
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
90 deb = "GAIM_PRIVACY_DENY_USERS";
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
91 break;
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
92 case GAIM_PRIVACY_ALLOW_BUDDYLIST:
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
93 deb = "GAIM_PRIVACY_ALLOW_BUDDYLIST";
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
94 break;
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
95 }
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
96 if(deb)
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
97 gaim_debug_info("yahoo",
11111
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
98 "%s blocked data received from %s (%s)\n",
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
99 gc->account->username,who, deb);
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
100 } else if (gc->account->perm_deny == GAIM_PRIVACY_ALLOW_USERS) {
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
101 gaim_debug_info("yahoo",
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
102 "%s allowed data received from %s (GAIM_PRIVACY_ALLOW_USERS)\n",
f03dce7ea408 [gaim-migrate @ 13163]
Richard Laager <rlaager@wiktel.com>
parents: 11109
diff changeset
103 gc->account->username,who);
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
104 }
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
105
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
106 return permitted;
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
107 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
108
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
109 static void yahoo_update_status(GaimConnection *gc, const char *name, YahooFriend *f)
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
110 {
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
111 char *status = NULL;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
112
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
113 if (!gc || !name || !f || !gaim_find_buddy(gaim_connection_get_account(gc), name))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
114 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
115
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
116 if (f->status == YAHOO_STATUS_OFFLINE)
11250
4e25fb6678bd [gaim-migrate @ 13419]
Mark Doliner <mark@kingant.net>
parents: 11188
diff changeset
117 {
4e25fb6678bd [gaim-migrate @ 13419]
Mark Doliner <mark@kingant.net>
parents: 11188
diff changeset
118 return;
4e25fb6678bd [gaim-migrate @ 13419]
Mark Doliner <mark@kingant.net>
parents: 11188
diff changeset
119 }
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
120
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
121 switch (f->status) {
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
122 case YAHOO_STATUS_AVAILABLE:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
123 status = YAHOO_STATUS_TYPE_AVAILABLE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
124 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
125 case YAHOO_STATUS_BRB:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
126 status = YAHOO_STATUS_TYPE_BRB;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
127 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
128 case YAHOO_STATUS_BUSY:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
129 status = YAHOO_STATUS_TYPE_BUSY;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
130 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
131 case YAHOO_STATUS_NOTATHOME:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
132 status = YAHOO_STATUS_TYPE_NOTATHOME;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
133 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
134 case YAHOO_STATUS_NOTATDESK:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
135 status = YAHOO_STATUS_TYPE_NOTATDESK;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
136 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
137 case YAHOO_STATUS_NOTINOFFICE:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
138 status = YAHOO_STATUS_TYPE_NOTINOFFICE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
139 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
140 case YAHOO_STATUS_ONPHONE:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
141 status = YAHOO_STATUS_TYPE_ONPHONE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
142 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
143 case YAHOO_STATUS_ONVACATION:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
144 status = YAHOO_STATUS_TYPE_ONVACATION;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
145 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
146 case YAHOO_STATUS_OUTTOLUNCH:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
147 status = YAHOO_STATUS_TYPE_OUTTOLUNCH;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
148 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
149 case YAHOO_STATUS_STEPPEDOUT:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
150 status = YAHOO_STATUS_TYPE_STEPPEDOUT;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
151 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
152 case YAHOO_STATUS_INVISIBLE: /* this should never happen? */
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
153 status = YAHOO_STATUS_TYPE_INVISIBLE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
154 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
155 case YAHOO_STATUS_CUSTOM:
13686
2d31d61f572c [gaim-migrate @ 16089]
Richard Laager <rlaager@wiktel.com>
parents: 13558
diff changeset
156 case YAHOO_STATUS_IDLE:
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
157 if (!f->away)
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
158 status = YAHOO_STATUS_TYPE_AVAILABLE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
159 else
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
160 status = YAHOO_STATUS_TYPE_AWAY;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
161 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
162 default:
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
163 gaim_debug_warning("yahoo", "Warning, unknown status %d\n", f->status);
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
164 break;
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
165 }
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
166
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
167 if (status) {
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
168 if (f->status == YAHOO_STATUS_CUSTOM)
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
169 gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, status, "message",
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
170 yahoo_friend_get_status_message(f), NULL);
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
171 else
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
172 gaim_prpl_got_user_status(gaim_connection_get_account(gc), name, status, NULL);
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
173 }
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
174
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
175 if (f->idle != 0)
10746
1f51dd1a7f87 [gaim-migrate @ 12348]
Mark Doliner <mark@kingant.net>
parents: 10740
diff changeset
176 gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, TRUE, f->idle);
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
177 else
10746
1f51dd1a7f87 [gaim-migrate @ 12348]
Mark Doliner <mark@kingant.net>
parents: 10740
diff changeset
178 gaim_prpl_got_user_idle(gaim_connection_get_account(gc), name, FALSE, 0);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
179 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
180
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
181 static void yahoo_process_status(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 {
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
183 GaimAccount *account = gaim_connection_get_account(gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185 GSList *l = pkt->hash;
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
186 YahooFriend *f = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 char *name = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
188
7892
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
189 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
8383
ae15e717ca75 [gaim-migrate @ 9111]
Luke Schierer <lschiere@pidgin.im>
parents: 8375
diff changeset
190 gc->wants_to_die = TRUE;
10746
1f51dd1a7f87 [gaim-migrate @ 12348]
Mark Doliner <mark@kingant.net>
parents: 10740
diff changeset
191 gaim_connection_error(gc, _("You have signed on from another location."));
7892
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
192 return;
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
193 }
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
194
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 switch (pair->key) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 case 0: /* we won't actually do anything with this */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 case 1: /* we don't get the full buddy list here. */
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
202 if (!yd->logged_in) {
7664
e4264f71fac7 [gaim-migrate @ 8308]
Luke Schierer <lschiere@pidgin.im>
parents: 7651
diff changeset
203 gaim_connection_set_display_name(gc, pair->value);
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
204 gaim_connection_set_state(gc, GAIM_CONNECTED);
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
205 yd->logged_in = TRUE;
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
206 if (yd->picture_upload_todo) {
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
207 yahoo_buddy_icon_upload(gc, yd->picture_upload_todo);
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
208 yd->picture_upload_todo = NULL;
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
209 }
11653
c7aaac1fb252 [gaim-migrate @ 13937]
Mark Doliner <mark@kingant.net>
parents: 11644
diff changeset
210 yahoo_set_status(account, gaim_account_get_active_status(account));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
212 /* this requests the list. i have a feeling that this is very evil
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
213 *
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
214 * scs.yahoo.com sends you the list before this packet without it being
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
215 * requested
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
216 *
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
217 * do_import(gc, NULL);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
218 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
219 * yahoo_packet_send_and_free(newpkt, yd);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
220 */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
221
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
222 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 case 8: /* how many online buddies we have */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 case 7: /* the current buddy */
10553
7d165e1eec4d [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
227 if (name && f) /* update the previous buddy before changing the variables */
7d165e1eec4d [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
228 yahoo_update_status(gc, name, f);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 name = pair->value;
9886
694c80fc7c2e [gaim-migrate @ 10771]
Tim Ringenbach <marv@pidgin.im>
parents: 9835
diff changeset
230 if (name && g_utf8_validate(name, -1, NULL))
694c80fc7c2e [gaim-migrate @ 10771]
Tim Ringenbach <marv@pidgin.im>
parents: 9835
diff changeset
231 f = yahoo_friend_find_or_new(gc, name);
9888
ef5543c8a664 [gaim-migrate @ 10773]
Tim Ringenbach <marv@pidgin.im>
parents: 9886
diff changeset
232 else {
ef5543c8a664 [gaim-migrate @ 10773]
Tim Ringenbach <marv@pidgin.im>
parents: 9886
diff changeset
233 f = NULL;
ef5543c8a664 [gaim-migrate @ 10773]
Tim Ringenbach <marv@pidgin.im>
parents: 9886
diff changeset
234 name = NULL;
ef5543c8a664 [gaim-migrate @ 10773]
Tim Ringenbach <marv@pidgin.im>
parents: 9886
diff changeset
235 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
237 case 10: /* state */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
238 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
239 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
240
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
241 f->status = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
242 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
243 f->away = 1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
244 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
245 f->away = 0;
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
246
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
247 if (f->status == YAHOO_STATUS_IDLE) {
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
248 /* Idle may have already been set in a more precise way in case 137 */
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
249 if (f->idle == 0)
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
250 f->idle = time(NULL);
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
251 } else
6804
3ef17670e69f [gaim-migrate @ 7344]
Luke Schierer <lschiere@pidgin.im>
parents: 6796
diff changeset
252 f->idle = 0;
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
253
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
254 if (f->status != YAHOO_STATUS_CUSTOM)
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
255 yahoo_friend_set_status_message(f, NULL);
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
256
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
257 f->sms = 0;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 case 19: /* custom message */
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
260 if (f)
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
261 yahoo_friend_set_status_message(f, yahoo_string_decode(gc, pair->value, FALSE));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 break;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
263 case 11: /* this is the buddy's session id */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265 case 17: /* in chat? */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
267 case 47: /* is custom status away or not? 2=idle*/
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
268 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
269 break;
8441
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
270
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
271 /* I have no idea what it means when this is
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
272 * set when someone's available, but it doesn't
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
273 * mean idle. */
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
274 if (f->status == YAHOO_STATUS_AVAILABLE)
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
275 break;
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
276
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
277 f->away = strtol(pair->value, NULL, 10);
10141
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
278 if (f->away == 2) {
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
279 /* Idle may have already been set in a more precise way in case 137 */
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
280 if (f->idle == 0)
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
281 f->idle = time(NULL);
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
282 }
e47d1bf844c9 [gaim-migrate @ 11212]
Tim Ringenbach <marv@pidgin.im>
parents: 10126
diff changeset
283
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
284 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
285 case 138: /* either we're not idle, or we are but won't say how long */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
286 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
287 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
288
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
289 if (f->idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
290 f->idle = -1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
291 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
292 case 137: /* usually idle time in seconds, sometimes login time */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
293 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
294 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
295
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
296 if (f->status != YAHOO_STATUS_AVAILABLE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
297 f->idle = time(NULL) - strtol(pair->value, NULL, 10);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
298 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
299 case 13: /* bitmask, bit 0 = pager, bit 1 = chat, bit 2 = game */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
300 if (strtol(pair->value, NULL, 10) == 0) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
301 if (f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
302 f->status = YAHOO_STATUS_OFFLINE;
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
303 gaim_prpl_got_user_status(account, name, "offline", NULL);
2807
f01e6a425136 [gaim-migrate @ 2820]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2805
diff changeset
304 break;
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
305 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
306 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
307 case 60: /* SMS */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
308 if (f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
309 f->sms = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
310 yahoo_update_status(gc, name, f);
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
311 }
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
312 break;
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
313 case 197: /* Avatars */
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
314 {
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
315 guchar *decoded;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11111
diff changeset
316 char *tmp;
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11111
diff changeset
317 gsize len;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
318
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
319 if (pair->value) {
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11111
diff changeset
320 decoded = gaim_base64_decode(pair->value, &len);
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
321 if (len) {
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
322 tmp = gaim_str_binary_to_ascii(decoded, len);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
323 gaim_debug_info("yahoo", "Got key 197, value = %s\n", tmp);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
324 g_free(tmp);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
325 }
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
326 g_free(decoded);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
327 }
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
328 break;
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
329 }
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
330 case 192: /* Pictures, aka Buddy Icons, checksum */
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
331 {
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
332 int cksum = strtol(pair->value, NULL, 10);
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
333 GaimBuddy *b;
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
334
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
335 if (!name)
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
336 break;
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
337
9325
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
338 b = gaim_find_buddy(gc->account, name);
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
339
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
340 if (!cksum || (cksum == -1)) {
9325
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
341 if (f)
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
342 yahoo_friend_set_buddy_icon_need_request(f, TRUE);
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
343 gaim_buddy_icons_set_for_user(gc->account, name, NULL, 0);
9325
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
344 if (b)
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
345 gaim_blist_node_remove_setting((GaimBlistNode *)b, YAHOO_ICON_CHECKSUM_KEY);
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
346 break;
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
347 }
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
348
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
349 if (!f)
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
350 break;
9325
f40233043b5a [gaim-migrate @ 10133]
Tim Ringenbach <marv@pidgin.im>
parents: 9318
diff changeset
351
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
352 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
353 if (cksum != gaim_blist_node_get_int((GaimBlistNode*)b, YAHOO_ICON_CHECKSUM_KEY))
9310
085190b9dd64 [gaim-migrate @ 10118]
Tim Ringenbach <marv@pidgin.im>
parents: 9308
diff changeset
354 yahoo_send_picture_request(gc, name);
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
355
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
356 break;
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
357 }
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2951
diff changeset
358 case 16: /* Custom error message */
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
359 {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
360 char *tmp = yahoo_string_decode(gc, pair->value, TRUE);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
361 gaim_notify_error(gc, NULL, tmp, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
362 g_free(tmp);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
363 }
2951
b74f4f7165a1 [gaim-migrate @ 2964]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
364 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
365 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
366 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
367 "Unknown status key %d\n", pair->key);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
368 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
369 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
370
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
371 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
372 }
10553
7d165e1eec4d [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
373
7d165e1eec4d [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
374 if (name && f) /* update the last buddy */
7d165e1eec4d [gaim-migrate @ 11930]
Tim Ringenbach <marv@pidgin.im>
parents: 10504
diff changeset
375 yahoo_update_status(gc, name, f);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
378 static void yahoo_do_group_check(GaimAccount *account, GHashTable *ht, const char *name, const char *group)
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
379 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
380 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
381 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
382 GSList *list, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
383 gboolean onlist = 0;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
384 char *oname = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
385 char **oname_p = &oname;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
386 GSList **list_p = &list;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
387
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
388 if (!g_hash_table_lookup_extended(ht, gaim_normalize(account, name), (gpointer *) oname_p, (gpointer *) list_p))
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
389 list = gaim_find_buddies(account, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
390 else
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
391 g_hash_table_steal(ht, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
392
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
393 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
394 b = i->data;
12088
980c877bd238 [gaim-migrate @ 14385]
Mark Doliner <mark@kingant.net>
parents: 12010
diff changeset
395 g = gaim_buddy_get_group(b);
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
396 if (!gaim_utf8_strcasecmp(group, g->name)) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
397 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
398 "Oh good, %s is in the right group (%s).\n", name, group);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
399 list = g_slist_delete_link(list, i);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
400 onlist = 1;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
401 break;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
402 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
403 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
404
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
405 if (!onlist) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
406 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
407 "Uhoh, %s isn't on the list (or not in this group), adding him to group %s.\n", name, group);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
408 if (!(g = gaim_find_group(group))) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
409 g = gaim_group_new(group);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
410 gaim_blist_add_group(g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
411 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
412 b = gaim_buddy_new(account, name, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
413 gaim_blist_add_buddy(b, NULL, g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
414 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
415
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
416 if (list) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
417 if (!oname)
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
418 oname = g_strdup(gaim_normalize(account, name));
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
419 g_hash_table_insert(ht, oname, list);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
420 } else if (oname)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
421 g_free(oname);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
422 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
423
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
424 static void yahoo_do_group_cleanup(gpointer key, gpointer value, gpointer user_data)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
425 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
426 char *name = key;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
427 GSList *list = value, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
428 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
429 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
430
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
431 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
432 b = i->data;
12088
980c877bd238 [gaim-migrate @ 14385]
Mark Doliner <mark@kingant.net>
parents: 12010
diff changeset
433 g = gaim_buddy_get_group(b);
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
434 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "Deleting Buddy %s from group %s.\n", name, g->name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
435 gaim_blist_remove_buddy(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
436 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
437 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
438
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
439 static char *_getcookie(char *rawcookie)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
440 {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
441 char *cookie = NULL;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
442 char *tmpcookie;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
443 char *cookieend;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
444
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
445 if (strlen(rawcookie) < 2)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
446 return NULL;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
447 tmpcookie = g_strdup(rawcookie+2);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
448 cookieend = strchr(tmpcookie, ';');
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
449
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
450 if (cookieend)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
451 *cookieend = '\0';
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
452
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
453 cookie = g_strdup(tmpcookie);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
454 g_free(tmpcookie);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
455
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
456 return cookie;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
457 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
458
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
459 static void yahoo_process_cookie(struct yahoo_data *yd, char *c)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
460 {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
461 if (c[0] == 'Y') {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
462 if (yd->cookie_y)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
463 g_free(yd->cookie_y);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
464 yd->cookie_y = _getcookie(c);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
465 } else if (c[0] == 'T') {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
466 if (yd->cookie_t)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
467 g_free(yd->cookie_t);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
468 yd->cookie_t = _getcookie(c);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
469 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
470 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
471
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
472 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
473 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
474 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
475 gboolean export = FALSE;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
476 gboolean got_serv_list = FALSE;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
477 GaimBuddy *b;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
478 GaimGroup *g;
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
479 YahooFriend *f = NULL;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
480 GaimAccount *account = gaim_connection_get_account(gc);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
481 struct yahoo_data *yd = gc->proto_data;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
482 GHashTable *ht;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
483
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
484 char **lines;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
485 char **split;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
486 char **buddies;
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
487 char **tmp, **bud, *norm_bud;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
488 char *grp = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
489
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
490 if (pkt->id)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
491 yd->session_id = pkt->id;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
492
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
493 while (l) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
494 struct yahoo_pair *pair = l->data;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
495 l = l->next;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
496
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
497 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
498 case 87:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
499 if (!yd->tmp_serv_blist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
500 yd->tmp_serv_blist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
501 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
502 g_string_append(yd->tmp_serv_blist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
503 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
504 case 88:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
505 if (!yd->tmp_serv_ilist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
506 yd->tmp_serv_ilist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
507 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
508 g_string_append(yd->tmp_serv_ilist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
509 break;
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
510 case 59: /* cookies, yum */
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
511 yahoo_process_cookie(yd, pair->value);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
512 break;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
513 case YAHOO_SERVICE_PRESENCE_PERM:
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
514 if (!yd->tmp_serv_plist)
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
515 yd->tmp_serv_plist = g_string_new(pair->value);
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
516 else
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
517 g_string_append(yd->tmp_serv_plist, pair->value);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
518 break;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
519 }
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
520 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
521
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
522 if (pkt->status != 0)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
523 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
524
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
525 if (yd->tmp_serv_blist) {
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
526 ht = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) g_slist_free);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
527
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
528 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
529 for (tmp = lines; *tmp; tmp++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
530 split = g_strsplit(*tmp, ":", 2);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
531 if (!split)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
532 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
533 if (!split[0] || !split[1]) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
534 g_strfreev(split);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
535 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
536 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
537 grp = yahoo_string_decode(gc, split[0], FALSE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
538 buddies = g_strsplit(split[1], ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
539 for (bud = buddies; bud && *bud; bud++) {
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
540 norm_bud = g_strdup(gaim_normalize(account, *bud));
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
541 f = yahoo_friend_find_or_new(gc, norm_bud);
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
542
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
543 if (!(b = gaim_find_buddy(account, norm_bud))) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
544 if (!(g = gaim_find_group(grp))) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
545 g = gaim_group_new(grp);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
546 gaim_blist_add_group(g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
547 }
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
548 b = gaim_buddy_new(account, norm_bud, NULL);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
549 gaim_blist_add_buddy(b, NULL, g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
550 export = TRUE;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
551 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
552
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
553 yahoo_do_group_check(account, ht, norm_bud, grp);
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
554 g_free(norm_bud);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
555 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
556 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
557 g_strfreev(split);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
558 g_free(grp);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
559 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
560 g_strfreev(lines);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
561
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
562 g_string_free(yd->tmp_serv_blist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
563 yd->tmp_serv_blist = NULL;
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
564 g_hash_table_foreach(ht, yahoo_do_group_cleanup, NULL);
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
565 g_hash_table_destroy(ht);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
566 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
567
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
568 if (yd->tmp_serv_ilist) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
569 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
570 for (bud = buddies; bud && *bud; bud++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
571 /* The server is already ignoring the user */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
572 got_serv_list = TRUE;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
573 gaim_privacy_deny_add(gc->account, *bud, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
574 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
575 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
576
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
577 g_string_free(yd->tmp_serv_ilist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
578 yd->tmp_serv_ilist = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
579 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
580
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
581 if (got_serv_list &&
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
582 ((gc->account->perm_deny != GAIM_PRIVACY_ALLOW_BUDDYLIST) &&
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
583 (gc->account->perm_deny != GAIM_PRIVACY_DENY_ALL) &&
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
584 (gc->account->perm_deny != GAIM_PRIVACY_ALLOW_USERS)))
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
585 {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
586 gc->account->perm_deny = GAIM_PRIVACY_DENY_USERS;
12138
4e729e3d8f0b [gaim-migrate @ 14439]
Richard Laager <rlaager@wiktel.com>
parents: 12088
diff changeset
587 gaim_debug_info("yahoo", "%s privacy defaulting to GAIM_PRIVACY_DENY_USERS.\n",
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
588 gc->account->username);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
589 }
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
590
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
591 if (yd->tmp_serv_plist) {
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
592 buddies = g_strsplit(yd->tmp_serv_plist->str, ",", -1);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
593 for (bud = buddies; bud && *bud; bud++) {
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
594 f = yahoo_friend_find(gc, *bud);
12138
4e729e3d8f0b [gaim-migrate @ 14439]
Richard Laager <rlaager@wiktel.com>
parents: 12088
diff changeset
595 if (f) {
4e729e3d8f0b [gaim-migrate @ 14439]
Richard Laager <rlaager@wiktel.com>
parents: 12088
diff changeset
596 gaim_debug_info("yahoo", "%s setting presence for %s to PERM_OFFLINE\n",
4e729e3d8f0b [gaim-migrate @ 14439]
Richard Laager <rlaager@wiktel.com>
parents: 12088
diff changeset
597 gc->account->username, *bud);
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
598 f->presence = YAHOO_PRESENCE_PERM_OFFLINE;
12138
4e729e3d8f0b [gaim-migrate @ 14439]
Richard Laager <rlaager@wiktel.com>
parents: 12088
diff changeset
599 }
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
600 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
601 g_strfreev(buddies);
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
602 g_string_free(yd->tmp_serv_plist, TRUE);
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
603 yd->tmp_serv_plist = NULL;
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
604
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
605 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
606 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
607
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
608 static void yahoo_process_notify(GaimConnection *gc, struct yahoo_packet *pkt)
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
609 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
610 char *msg = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
611 char *from = NULL;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
612 char *stat = NULL;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
613 char *game = NULL;
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
614 YahooFriend *f = NULL;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
615 GSList *l = pkt->hash;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
616
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
617 while (l) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
618 struct yahoo_pair *pair = l->data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
619 if (pair->key == 4)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
620 from = pair->value;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
621 if (pair->key == 49)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
622 msg = pair->value;
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
623 if (pair->key == 13)
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
624 stat = pair->value;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
625 if (pair->key == 14)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
626 game = pair->value;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
627 l = l->next;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
628 }
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
629
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
630 if (!from || !msg)
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
631 return;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
632
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
633 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
634 && (yahoo_privacy_check(gc, from))) {
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
635 if (*stat == '1')
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
636 serv_got_typing(gc, from, 0, GAIM_TYPING);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
637 else
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
638 serv_got_typing_stopped(gc, from);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
639 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) {
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
640 GaimBuddy *bud = gaim_find_buddy(gc->account, from);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
641
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
642 if (!bud) {
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
643 gaim_debug(GAIM_DEBUG_WARNING, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
644 "%s is playing a game, and doesn't want "
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
645 "you to know.\n", from);
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
646 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
647
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
648 f = yahoo_friend_find(gc, from);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
649 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
650 return; /* if they're not on the list, don't bother */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
651
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
652 yahoo_friend_set_game(f, NULL);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
653
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
654 if (*stat == '1') {
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
655 yahoo_friend_set_game(f, game);
3020
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3019
diff changeset
656 if (bud)
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
657 yahoo_update_status(gc, from, f);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
658 }
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
659 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
660 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
661
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
662
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
663 struct _yahoo_im {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
664 char *from;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
665 int time;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
666 int utf8;
9284
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
667 int buddy_icon;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
668 char *msg;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
669 };
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
670
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
671 static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 {
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
673 GSList *l = pkt->hash;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
674 GSList *list = NULL;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
675 struct _yahoo_im *im = NULL;
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
676
13461
b6a63c9b0cb4 [gaim-migrate @ 15836]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13343
diff changeset
677 const char *imv = NULL;
6069
5ca86172352a [gaim-migrate @ 6519]
Luke Schierer <lschiere@pidgin.im>
parents: 6061
diff changeset
678
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
679 if (pkt->status <= 1 || pkt->status == 5) {
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
680 while (l != NULL) {
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
681 struct yahoo_pair *pair = l->data;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
682 if (pair->key == 4) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
683 im = g_new0(struct _yahoo_im, 1);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
684 list = g_slist_append(list, im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
685 im->from = pair->value;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
686 im->time = time(NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
687 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
688 if (pair->key == 97)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
689 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
690 im->utf8 = strtol(pair->value, NULL, 10);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
691 if (pair->key == 15)
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
692 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
693 im->time = strtol(pair->value, NULL, 10);
9284
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
694 if (pair->key == 206)
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
695 if (im)
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
696 im->buddy_icon = strtol(pair->value, NULL, 10);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
697 if (pair->key == 14) {
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
698 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
699 im->msg = pair->value;
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
700 }
11801
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
701 /* IMV key */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
702 if (pair->key == 63)
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
703 {
13461
b6a63c9b0cb4 [gaim-migrate @ 15836]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13343
diff changeset
704 imv = pair->value;
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
705 }
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
706 l = l->next;
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
707 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 } else if (pkt->status == 2) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
709 gaim_notify_error(gc, NULL,
10386
232808c6d6ab [gaim-migrate @ 11612]
Tim Ringenbach <marv@pidgin.im>
parents: 10379
diff changeset
710 _("Your Yahoo! message did not get sent."), NULL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 }
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
712
13461
b6a63c9b0cb4 [gaim-migrate @ 15836]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13343
diff changeset
713 /** TODO: It seems that this check should be per IM, not global */
11801
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
714 /* Check for the Doodle IMV */
13461
b6a63c9b0cb4 [gaim-migrate @ 15836]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13343
diff changeset
715 if(im != NULL && imv != NULL && !strcmp(imv, "doodle;11"))
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
716 {
11801
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
717 GaimWhiteboard *wb;
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
718
11800
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
719 if (!yahoo_privacy_check(gc, im->from)) {
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
720 gaim_debug_info("yahoo", "Doodle request from %s dropped.\n", im->from);
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
721 return;
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
722 }
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
723
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
724 wb = gaim_whiteboard_get_session(gc->account, im->from);
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
725
11801
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
726 /* If a Doodle session doesn't exist between this user */
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
727 if(wb == NULL)
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
728 {
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
729 wb = gaim_whiteboard_create(gc->account, im->from, DOODLE_STATE_REQUESTED);
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
730
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
731 yahoo_doodle_command_send_request(gc, im->from);
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
732 yahoo_doodle_command_send_ready(gc, im->from);
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
733 }
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
734 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
735
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
736 for (l = list; l; l = l->next) {
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
737 YahooFriend *f;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
738 char *m, *m2;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
739 im = l->data;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
740
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
741 if (!im->from || !im->msg) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
742 g_free(im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
743 continue;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
744 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
745
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
746 if (!yahoo_privacy_check(gc, im->from)) {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
747 gaim_debug_info("yahoo", "Message from %s dropped.\n", im->from);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
748 return;
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
749 }
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
750
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
751 m = yahoo_string_decode(gc, im->msg, im->utf8);
12994
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
752 /* This may actually not be necessary, but it appears
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
753 * that at least at one point some clients were sending
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
754 * "\r\n" as line delimiters, so we want to avoid double
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
755 * lines. */
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
756 m2 = gaim_strreplace(m, "\r\n", "\n");
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
757 g_free(m);
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
758 m = m2;
6ea877c5a444 [gaim-migrate @ 15347]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12970
diff changeset
759 gaim_util_chrreplace(m, '\r', '\n');
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
760
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
761 if (!strcmp(m, "<ding>")) {
11338
17142948653e [gaim-migrate @ 13551]
Mark Doliner <mark@kingant.net>
parents: 11318
diff changeset
762 GaimConversation *c = gaim_conversation_new(GAIM_CONV_TYPE_IM,
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
763 gaim_connection_get_account(gc), im->from);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
764 gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_RECV,
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
765 im->time);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
766 g_free(m);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
767 g_free(im);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
768 continue;
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
769 }
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
770
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
771 m2 = yahoo_codes_to_html(m);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
772 g_free(m);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
773 serv_got_im(gc, im->from, m2, 0, im->time);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
774 g_free(m2);
9284
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
775
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
776 if ((f = yahoo_friend_find(gc, im->from)) && im->buddy_icon == 2) {
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
777 if (yahoo_friend_get_buddy_icon_need_request(f)) {
9310
085190b9dd64 [gaim-migrate @ 10118]
Tim Ringenbach <marv@pidgin.im>
parents: 9308
diff changeset
778 yahoo_send_picture_request(gc, im->from);
9284
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
779 yahoo_friend_set_buddy_icon_need_request(f, FALSE);
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
780 }
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
781 }
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
782
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
783 g_free(im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
784 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
785 g_slist_free(list);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
787
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
788 static void yahoo_process_sysmessage(GaimConnection *gc, struct yahoo_packet *pkt)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
789 {
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
790 GSList *l = pkt->hash;
10070
2b6bf836c6b9 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
791 char *prim, *me = NULL, *msg = NULL, *escmsg = NULL;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
792
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
793 while (l) {
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
794 struct yahoo_pair *pair = l->data;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
795
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
796 if (pair->key == 5)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
797 me = pair->value;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
798 if (pair->key == 14)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
799 msg = pair->value;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
800
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
801 l = l->next;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
802 }
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
803
10070
2b6bf836c6b9 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
804 if (!msg || !g_utf8_validate(msg, -1, NULL))
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
805 return;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
806
10732
c4cb90065e1d [gaim-migrate @ 12334]
Luke Schierer <lschiere@pidgin.im>
parents: 10687
diff changeset
807 escmsg = g_markup_escape_text(msg, -1);
10070
2b6bf836c6b9 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
808
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
809 prim = g_strdup_printf(_("Yahoo! system message for %s:"),
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
810 me?me:gaim_connection_get_display_name(gc));
10070
2b6bf836c6b9 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
811 gaim_notify_info(NULL, NULL, prim, escmsg);
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
812 g_free(prim);
10070
2b6bf836c6b9 [gaim-migrate @ 11046]
Tim Ringenbach <marv@pidgin.im>
parents: 10009
diff changeset
813 g_free(escmsg);
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
814 }
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
815
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
816 struct yahoo_add_request {
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
817 GaimConnection *gc;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
818 char *id;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
819 char *who;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
820 char *msg;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
821 };
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
822
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
823 static void
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
824 yahoo_buddy_add_authorize_cb(struct yahoo_add_request *add_req, const char *msg) {
12378
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
825 GaimBuddy *buddy = gaim_find_buddy(add_req->gc->account, add_req->who);
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
826
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
827 if (buddy != NULL)
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
828 gaim_account_notify_added(add_req->gc->account, add_req->who,
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
829 add_req->id, NULL, add_req->msg);
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
830 else
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
831 gaim_account_request_add(add_req->gc->account, add_req->who,
c9aeafdb445e [gaim-migrate @ 14682]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12318
diff changeset
832 add_req->id, NULL, add_req->msg);
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
833
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
834 g_free(add_req->id);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
835 g_free(add_req->who);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
836 g_free(add_req->msg);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
837 g_free(add_req);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
838 }
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
839
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
840 static void
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
841 yahoo_buddy_add_deny_cb(struct yahoo_add_request *add_req, const char *msg) {
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
842 struct yahoo_packet *pkt;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
843 char *encoded_msg = NULL;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
844 struct yahoo_data *yd = add_req->gc->proto_data;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
845
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
846 if (msg)
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
847 encoded_msg = yahoo_string_encode(add_req->gc, msg, NULL);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
848
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
849 pkt = yahoo_packet_new(YAHOO_SERVICE_REJECTCONTACT,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
850 YAHOO_STATUS_AVAILABLE, 0);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
851
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
852 yahoo_packet_hash(pkt, "sss",
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
853 1, gaim_normalize(add_req->gc->account,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
854 gaim_account_get_username(
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
855 gaim_connection_get_account(
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
856 add_req->gc))),
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
857 7, add_req->who,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
858 14, encoded_msg ? encoded_msg : "");
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
859
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
860 yahoo_packet_send_and_free(pkt, yd);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
861
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
862 g_free(encoded_msg);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
863
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
864 g_free(add_req->id);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
865 g_free(add_req->who);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
866 g_free(add_req->msg);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
867 g_free(add_req);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
868 }
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
869
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
870 static void yahoo_buddy_added_us(GaimConnection *gc, struct yahoo_packet *pkt) {
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
871 struct yahoo_add_request *add_req;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
872 char *msg = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
873 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
874
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
875 add_req = g_new0(struct yahoo_add_request, 1);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
876 add_req->gc = gc;
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
877
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
878 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
879 struct yahoo_pair *pair = l->data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
880
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
881 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
882 case 1:
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
883 add_req->id = g_strdup(pair->value);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
884 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
885 case 3:
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
886 add_req->who = g_strdup(pair->value);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
887 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
888 case 15: /* time, for when they add us and we're offline */
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
889 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
890 case 14:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
891 msg = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
892 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
893 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
894 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
895 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
896
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
897 if (add_req->id) {
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
898 char *prompt_msg;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
899 if (msg)
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
900 add_req->msg = yahoo_string_decode(gc, msg, FALSE);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
901
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
902 /* TODO: this is almost exactly the same as what MSN does,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
903 * this should probably be moved to the core.
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
904 */
11109
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
905 prompt_msg = g_strdup_printf(_("The user %s wants to add %s to "
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
906 "his or her buddy list%s%s."),
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
907 add_req->who, add_req->id,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
908 add_req->msg ? ": " : "",
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
909 add_req->msg ? add_req->msg : "");
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
910 gaim_request_input(gc, NULL, prompt_msg,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
911 _("Message (optional) :"),
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
912 NULL, TRUE, FALSE, NULL,
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
913 _("Authorize"), G_CALLBACK(
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
914 yahoo_buddy_add_authorize_cb),
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
915 _("Deny"), G_CALLBACK(
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
916 yahoo_buddy_add_deny_cb),
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
917 add_req);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
918 g_free(prompt_msg);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
919 } else {
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
920 g_free(add_req->id);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
921 g_free(add_req->who);
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
922 /*g_free(add_req->msg);*/
b8f11f70cf97 [gaim-migrate @ 13161]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11078
diff changeset
923 g_free(add_req);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
924 }
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
925 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
926
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
927 static void yahoo_buddy_denied_our_add(GaimConnection *gc, struct yahoo_packet *pkt)
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
928 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
929 char *who = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
930 char *msg = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
931 GSList *l = pkt->hash;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
932 GString *buf = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
933 struct yahoo_data *yd = gc->proto_data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
934
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
935 while (l) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
936 struct yahoo_pair *pair = l->data;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
937
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
938 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
939 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
940 who = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
941 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
942 case 14:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
943 msg = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
944 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
945 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
946 l = l->next;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
947 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
948
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
949 if (who) {
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
950 char *msg2;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
951 buf = g_string_sized_new(0);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
952 if (!msg) {
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
953 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list."), who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
954 } else {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
955 msg2 = yahoo_string_decode(gc, msg, FALSE);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
956 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg2);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
957 g_free(msg2);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
958 }
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
959 gaim_notify_info(gc, NULL, _("Add buddy rejected"), buf->str);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
960 g_string_free(buf, TRUE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
961 g_hash_table_remove(yd->friends, who);
9983
7286c1483ceb [gaim-migrate @ 10894]
Tim Ringenbach <marv@pidgin.im>
parents: 9979
diff changeset
962 gaim_prpl_got_user_status(gaim_connection_get_account(gc), who, "offline", NULL); /* FIXME: make this set not on list status instead */
11838
ded0ec14f5d3 [gaim-migrate @ 14129]
Mark Doliner <mark@kingant.net>
parents: 11837
diff changeset
963 /* TODO: Shouldn't we remove the buddy from our local list? */
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
964 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
965 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
966
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
967 static void yahoo_process_contact(GaimConnection *gc, struct yahoo_packet *pkt)
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
968 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
969 switch (pkt->status) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
970 case 1:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
971 yahoo_process_status(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
972 return;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
973 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
974 yahoo_buddy_added_us(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
975 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
976 case 7:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
977 yahoo_buddy_denied_our_add(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
978 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
979 default:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
980 break;
2683
4836eae8dd8c [gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2682
diff changeset
981 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
982 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
983
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
984 #define OUT_CHARSET "utf-8"
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
985
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
986 static char *yahoo_decode(const char *text)
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
987 {
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
988 char *converted = NULL;
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
989 char *n, *new;
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
990 const char *end, *p;
8616
aa815d1a996d [gaim-migrate @ 9367]
Ethan Blanton <elb@pidgin.im>
parents: 8591
diff changeset
991 int i, k;
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
992
7771
a481ffe303d2 [gaim-migrate @ 8416]
Nathan Walp <nwalp@pidgin.im>
parents: 7747
diff changeset
993 n = new = g_malloc(strlen (text) + 1);
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
994 end = text + strlen(text);
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
995
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
996 for (p = text; p < end; p++, n++) {
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
997 if (*p == '\\') {
9064
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
998 if (p[1] >= '0' && p[1] <= '7') {
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
999 p += 1;
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1000 for (i = 0, k = 0; k < 3; k += 1) {
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1001 char c = p[k];
9065
23547b9f8cec [gaim-migrate @ 9841]
Tim Ringenbach <marv@pidgin.im>
parents: 9064
diff changeset
1002 if (c < '0' || c > '7') break;
9064
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1003 i *= 8;
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1004 i += c - '0';
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1005 }
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1006 *n = i;
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1007 p += k - 1;
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1008 } else { /* bug 959248 */
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1009 /* If we see a \ not followed by an octal number,
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1010 * it means that it is actually a \\ with one \
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1011 * already eaten by some unknown function.
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1012 * This is arguably broken.
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1013 *
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1014 * I think wing is wrong here, there is no function
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1015 * called that I see that could have done it. I guess
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1016 * it is just really sending single \'s. That's yahoo
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1017 * for you.
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1018 */
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1019 *n = *p;
290a7213f9e4 [gaim-migrate @ 9840]
Tim Ringenbach <marv@pidgin.im>
parents: 9062
diff changeset
1020 }
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1021 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1022 else
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1023 *n = *p;
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1024 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1025
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1026 *n = '\0';
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
1027
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1028 if (strstr(text, "\033$B"))
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1029 converted = g_convert(new, n - new, OUT_CHARSET, "iso-2022-jp", NULL, NULL, NULL);
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1030 if (!converted)
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1031 converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1032 g_free(new);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1033
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1034 return converted;
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1035 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1036
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1037 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1038 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1039 GaimAccount *account = gaim_connection_get_account(gc);
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1040 struct yahoo_data *yd = gc->proto_data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1041 char *who = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1042 char *email = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1043 char *subj = NULL;
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1044 char *yahoo_mail_url = (yd->jp? YAHOOJP_MAIL_URL: YAHOO_MAIL_URL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1045 int count = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1046 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1047
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1048 if (!gaim_account_get_check_mail(account))
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1049 return;
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1050
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1051 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1052 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1053 if (pair->key == 9)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1054 count = strtol(pair->value, NULL, 10);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1055 else if (pair->key == 43)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1056 who = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1057 else if (pair->key == 42)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1058 email = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1059 else if (pair->key == 18)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1060 subj = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1061 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1062 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1063
4001
9178da61c19f [gaim-migrate @ 4201]
Luke Schierer <lschiere@pidgin.im>
parents: 3996
diff changeset
1064 if (who && subj && email && *email) {
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1065 char *dec_who = yahoo_decode(who);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1066 char *dec_subj = yahoo_decode(subj);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1067 char *from = g_strdup_printf("%s (%s)", dec_who, email);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1068
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1069 gaim_notify_email(gc, dec_subj, from, gaim_account_get_username(account),
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1070 yahoo_mail_url, NULL, NULL);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1071
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1072 g_free(dec_who);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
1073 g_free(dec_subj);
2850
cbe6a1e63a72 [gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2813
diff changeset
1074 g_free(from);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1075 } else if (count > 0) {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1076 const char *to = gaim_account_get_username(account);
9221
8054855f2bb9 [gaim-migrate @ 10017]
Tim Ringenbach <marv@pidgin.im>
parents: 9220
diff changeset
1077 const char *url = yahoo_mail_url;
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1078
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1079 gaim_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url,
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1080 NULL, NULL);
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
1081 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1082 }
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1083 /* This is the y64 alphabet... it's like base64, but has a . and a _ */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1084 char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1085
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1086 /* This is taken from Sylpheed by Hiroyuki Yamamoto. We have our own tobase64 function
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1087 * in util.c, but it has a bug I don't feel like finding right now ;) */
11897
a1aa681f1448 [gaim-migrate @ 14188]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11838
diff changeset
1088 static void to_y64(char *out, const unsigned char *in, gsize inlen)
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1089 /* raw bytes in quasi-big-endian order to base 64 string (NUL-terminated) */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1090 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1091 for (; inlen >= 3; inlen -= 3)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1092 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1093 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1094 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1095 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1096 *out++ = base64digits[in[2] & 0x3f];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1097 in += 3;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1098 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1099 if (inlen > 0)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1100 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1101 unsigned char fragment;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1102
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1103 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1104 fragment = (in[0] << 4) & 0x30;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1105 if (inlen > 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1106 fragment |= in[1] >> 4;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1107 *out++ = base64digits[fragment];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1108 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1109 *out++ = '-';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1110 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1111 *out = '\0';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1112 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1113
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1114 static void yahoo_process_auth_old(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1115 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1116 struct yahoo_packet *pack;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1117 GaimAccount *account = gaim_connection_get_account(gc);
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
1118 const char *name = gaim_normalize(account, gaim_account_get_username(account));
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
1119 const char *pass = gaim_connection_get_password(gc);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1120 struct yahoo_data *yd = gc->proto_data;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1121
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1122 /* So, Yahoo has stopped supporting its older clients in India, and undoubtedly
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1123 * will soon do so in the rest of the world.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1124 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1125 * The new clients use this authentication method. I warn you in advance, it's
8735
92cbf9713795 [gaim-migrate @ 9490]
Christian Hammond <chipx86@chipx86.com>
parents: 8713
diff changeset
1126 * bizarre, convoluted, inordinately complicated. It's also no more secure than
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1127 * crypt() was. The only purpose this scheme could serve is to prevent third
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1128 * party clients from connecting to their servers.
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1129 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1130 * Sorry, Yahoo.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1131 */
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1132
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1133 GaimCipher *cipher;
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1134 GaimCipherContext *context;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
1135 guchar digest[16];
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1136
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1137 char *crypt_result;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1138 char password_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1139 char crypt_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1140 char *hash_string_p = g_malloc(50 + strlen(name));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1141 char *hash_string_c = g_malloc(50 + strlen(name));
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1142
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1143 char checksum;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1144
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1145 int sv;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1146
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1147 char result6[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1148 char result96[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1149
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1150 sv = seed[15];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1151 sv = sv % 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1152
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1153 cipher = gaim_ciphers_find_cipher("md5");
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1154 context = gaim_cipher_context_new(cipher, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1155
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1156 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1157 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1158
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1159 to_y64(password_hash, digest, 16);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1160
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1161 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1162
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1163 gaim_cipher_context_reset(context, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1164 gaim_cipher_context_append(context, (const guchar *)crypt_result, strlen(crypt_result));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1165 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1166 to_y64(crypt_hash, digest, 16);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1167
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1168 switch (sv) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1169 case 1:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1170 case 6:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1171 checksum = seed[seed[9] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1172 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1173 "%c%s%s%s", checksum, name, seed, password_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1174 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1175 "%c%s%s%s", checksum, name, seed, crypt_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1176 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1177 case 2:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1178 case 7:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1179 checksum = seed[seed[15] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1180 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1181 "%c%s%s%s", checksum, seed, password_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1182 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1183 "%c%s%s%s", checksum, seed, crypt_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1184 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1185 case 3:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1186 checksum = seed[seed[1] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1187 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1188 "%c%s%s%s", checksum, name, password_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1189 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1190 "%c%s%s%s", checksum, name, crypt_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1191 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1192 case 4:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1193 checksum = seed[seed[3] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1194 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1195 "%c%s%s%s", checksum, password_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1196 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1197 "%c%s%s%s", checksum, crypt_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1198 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1199 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1200 case 5:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1201 checksum = seed[seed[7] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1202 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1203 "%c%s%s%s", checksum, password_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1204 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1205 "%c%s%s%s", checksum, crypt_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1206 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1207 }
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1208
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1209 gaim_cipher_context_reset(context, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1210 gaim_cipher_context_append(context, (const guchar *)hash_string_p, strlen(hash_string_p));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1211 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1212 to_y64(result6, digest, 16);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1213
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1214 gaim_cipher_context_reset(context, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1215 gaim_cipher_context_append(context, (const guchar *)hash_string_c, strlen(hash_string_c));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1216 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1217 gaim_cipher_context_destroy(context);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1218 to_y64(result96, digest, 16);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1219
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1220 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
1221 yahoo_packet_hash(pack, "ssss", 0, name, 6, result6, 96, result96, 1, name);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
1222 yahoo_packet_send_and_free(pack, yd);
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1223
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1224 g_free(hash_string_p);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1225 g_free(hash_string_c);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1226 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1227
6998
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
1228 /* I'm dishing out some uber-mad props to Cerulean Studios for cracking this
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
1229 * and sending the fix! Thanks guys. */
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
1230
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1231 static void yahoo_process_auth_new(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1232 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1233 struct yahoo_packet *pack = NULL;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1234 GaimAccount *account = gaim_connection_get_account(gc);
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
1235 const char *name = gaim_normalize(account, gaim_account_get_username(account));
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
1236 const char *pass = gaim_connection_get_password(gc);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1237 struct yahoo_data *yd = gc->proto_data;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1238
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1239 GaimCipher *md5_cipher;
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1240 GaimCipherContext *md5_ctx;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
1241 guchar md5_digest[16];
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1242
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1243 GaimCipher *sha1_cipher;
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1244 GaimCipherContext *sha1_ctx1;
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1245 GaimCipherContext *sha1_ctx2;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1246
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1247 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1248 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1249
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1250 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1251 char *operand_lookup = "+|&%/*^-";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1252 char *delimit_lookup = ",;";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1253
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1254 char *password_hash = (char *)g_malloc(25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1255 char *crypt_hash = (char *)g_malloc(25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1256 char *crypt_result = NULL;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1257
11144
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1258 unsigned char pass_hash_xor1[64];
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1259 unsigned char pass_hash_xor2[64];
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1260 unsigned char crypt_hash_xor1[64];
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1261 unsigned char crypt_hash_xor2[64];
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1262 char resp_6[100];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1263 char resp_96[100];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1264
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1265 unsigned char digest1[20];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1266 unsigned char digest2[20];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1267 unsigned char comparison_src[20];
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1268 unsigned char magic_key_char[4];
11144
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1269 const char *magic_ptr;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1270
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1271 unsigned int magic[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1272 unsigned int magic_work = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1273 unsigned int magic_4 = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1274
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1275 int x;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1276 int y;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1277 int cnt = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1278 int magic_cnt = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1279 int magic_len;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1280
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1281 memset(password_hash, 0, 25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1282 memset(crypt_hash, 0, 25);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1283 memset(&pass_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1284 memset(&pass_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1285 memset(&crypt_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1286 memset(&crypt_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1287 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1288 memset(&digest2, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1289 memset(&magic, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1290 memset(&resp_6, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1291 memset(&resp_96, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1292 memset(&magic_key_char, 0, 4);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1293 memset(&comparison_src, 0, 20);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1294
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1295 md5_cipher = gaim_ciphers_find_cipher("md5");
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1296 md5_ctx = gaim_cipher_context_new(md5_cipher, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1297
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1298 sha1_cipher = gaim_ciphers_find_cipher("sha1");
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1299 sha1_ctx1 = gaim_cipher_context_new(sha1_cipher, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1300 sha1_ctx2 = gaim_cipher_context_new(sha1_cipher, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1301
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1302 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1303 * Magic: Phase 1. Generate what seems to be a 30 byte value (could change if base64
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1304 * ends up differently? I don't remember and I'm tired, so use a 64 byte buffer.
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1305 */
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1306
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1307 magic_ptr = seed;
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
1308
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1309 while (*magic_ptr != (int)NULL) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1310 char *loc;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1311
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1312 /* Ignore parentheses. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1313
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1314 if (*magic_ptr == '(' || *magic_ptr == ')') {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1315 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1316 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1317 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1318
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1319 /* Characters and digits verify against the challenge lookup. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1320
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1321 if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1322 loc = strchr(challenge_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1323 if (!loc) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1324 /* SME XXX Error - disconnect here */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1325 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1326
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1327 /* Get offset into lookup table and shl 3. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1328
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1329 magic_work = loc - challenge_lookup;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1330 magic_work <<= 3;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1331
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1332 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1333 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1334 } else {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1335 unsigned int local_store;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1336
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1337 loc = strchr(operand_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1338 if (!loc) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1339 /* SME XXX Disconnect */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1340 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1341
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1342 local_store = loc - operand_lookup;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1343
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1344 /* Oops; how did this happen? */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1345
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1346 if (magic_cnt >= 64)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1347 break;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1348
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1349 magic[magic_cnt++] = magic_work | local_store;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1350 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1351 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1352 }
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1353 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1354
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1355 magic_len = magic_cnt;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1356 magic_cnt = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1357
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1358 /* Magic: Phase 2. Take generated magic value and sprinkle fairy
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1359 * dust on the values.
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1360 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1361
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1362 for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1363 unsigned char byte1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1364 unsigned char byte2;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1365
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1366 /* Bad. Abort. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1367
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1368 if ((magic_cnt + 1 > magic_len) || (magic_cnt > magic_len))
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1369 break;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1370
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1371 byte1 = magic[magic_cnt];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1372 byte2 = magic[magic_cnt+1];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1373
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1374 byte1 *= 0xcd;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1375 byte1 ^= byte2;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1376
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1377 magic[magic_cnt+1] = byte1;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1378 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1379
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1380 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1381 * Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1382 * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1383 * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1384 * into particular functions we'll later call to potentially alter the magic key.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1385 *
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1386 * %-)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1387 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1388
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1389 magic_cnt = 1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1390 x = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1391
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1392 do {
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1393 unsigned int bl = 0;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1394 unsigned int cl = magic[magic_cnt++];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1395
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1396 if (magic_cnt >= magic_len)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1397 break;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1398
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1399 if (cl > 0x7F) {
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1400 if (cl < 0xe0)
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1401 bl = cl = (cl & 0x1f) << 6;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1402 else {
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1403 bl = magic[magic_cnt++];
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1404 cl = (cl & 0x0f) << 6;
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1405 bl = ((bl & 0x3f) + cl) << 6;
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1406 }
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1407
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1408 cl = magic[magic_cnt++];
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1409 bl = (cl & 0x3f) + bl;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1410 } else
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1411 bl = cl;
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1412
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1413 comparison_src[x++] = (bl & 0xff00) >> 8;
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1414 comparison_src[x++] = bl & 0xff;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1415 } while (x < 20);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1416
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1417 /* First four bytes are magic key. */
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1418 memcpy(&magic_key_char[0], comparison_src, 4);
8482
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1419 magic_4 = magic_key_char[0] | (magic_key_char[1]<<8) | (magic_key_char[2]<<16) | (magic_key_char[3]<<24);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1420
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1421 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1422 * Magic: Phase 4. Determine what function to use later by getting outside/inside
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1423 * loop values until we match our previous buffer.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1424 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1425 for (x = 0; x < 65535; x++) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1426 int leave = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1427
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1428 for (y = 0; y < 5; y++) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1429 unsigned char test[3];
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1430
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1431 /* Calculate buffer. */
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1432 test[0] = x;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1433 test[1] = x >> 8;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1434 test[2] = y;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1435
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1436 gaim_cipher_context_reset(md5_ctx, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1437 gaim_cipher_context_append(md5_ctx, magic_key_char, 4);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1438 gaim_cipher_context_append(md5_ctx, test, 3);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1439 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest),
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1440 md5_digest, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1441
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1442 if (!memcmp(md5_digest, comparison_src+4, 16)) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1443 leave = 1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1444 break;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1445 }
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1446 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1447
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1448 if (leave == 1)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1449 break;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1450 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1451
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1452 /* If y != 0, we need some help. */
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1453 if (y != 0) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1454 unsigned int updated_key;
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1455
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1456 /* Update magic stuff.
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1457 * Call it twice because Yahoo's encryption is super bad ass.
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1458 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1459 updated_key = yahoo_auth_finalCountdown(magic_4, 0x60, y, x);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1460 updated_key = yahoo_auth_finalCountdown(updated_key, 0x60, y, x);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1461
8482
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1462 magic_key_char[0] = updated_key & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1463 magic_key_char[1] = (updated_key >> 8) & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1464 magic_key_char[2] = (updated_key >> 16) & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1465 magic_key_char[3] = (updated_key >> 24) & 0xff;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1466 }
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1467
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1468 /* Get password and crypt hashes as per usual. */
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1469 gaim_cipher_context_reset(md5_ctx, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1470 gaim_cipher_context_append(md5_ctx, (const guchar *)pass, strlen(pass));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1471 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest),
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1472 md5_digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1473 to_y64(password_hash, md5_digest, 16);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1474
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1475 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1476 gaim_cipher_context_reset(md5_ctx, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
1477 gaim_cipher_context_append(md5_ctx, (const guchar *)crypt_result, strlen(crypt_result));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1478 gaim_cipher_context_digest(md5_ctx, sizeof(md5_digest),
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1479 md5_digest, NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1480 to_y64(crypt_hash, md5_digest, 16);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1481
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1482 /* Our first authentication response is based off of the password hash. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1483 for (x = 0; x < (int)strlen(password_hash); x++)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1484 pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1485
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1486 if (cnt < 64)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1487 memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1488
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1489 cnt = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1490
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1491 for (x = 0; x < (int)strlen(password_hash); x++)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1492 pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1493
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1494 if (cnt < 64)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1495 memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1496
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1497 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1498 * The first context gets the password hash XORed with 0x36 plus a magic value
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1499 * which we previously extrapolated from our challenge.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1500 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1501
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1502 gaim_cipher_context_append(sha1_ctx1, pass_hash_xor1, 64);
9382
37fd8a10f5fa [gaim-migrate @ 10190]
Sean Egan <seanegan@gmail.com>
parents: 9376
diff changeset
1503 if (y >= 3)
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1504 gaim_cipher_context_set_option(sha1_ctx1, "sizeLo", GINT_TO_POINTER(0x1ff));
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1505 gaim_cipher_context_append(sha1_ctx1, magic_key_char, 4);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1506 gaim_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1507
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1508 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1509 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1510 * of the first context.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1511 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1512
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1513 gaim_cipher_context_append(sha1_ctx2, pass_hash_xor2, 64);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1514 gaim_cipher_context_append(sha1_ctx2, digest1, 20);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1515 gaim_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1516
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1517 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1518 * Now that we have digest2, use it to fetch characters from an alphabet to construct
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1519 * our first authentication response.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1520 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1521
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1522 for (x = 0; x < 20; x += 2) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1523 unsigned int val = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1524 unsigned int lookup = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1525
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1526 char byte[6];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1527
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1528 memset(&byte, 0, 6);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1529
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1530 /* First two bytes of digest stuffed together. */
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1531
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1532 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1533 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1534 val += digest2[x+1];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1535
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1536 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1537 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1538 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1539 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1540 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1541 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1542 strcat(resp_6, "=");
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1543
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1544 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1545 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1546 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1547 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1548 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1549 strcat(resp_6, byte);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1550
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1551 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1552 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1553 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1554 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1555 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1556 strcat(resp_6, byte);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1557
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1558 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1559 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1560 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1561 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1562 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1563 }
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1564
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1565 /* Our second authentication response is based off of the crypto hash. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1566
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1567 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1568 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1569 memset(&digest2, 0, 20);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1570
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1571 for (x = 0; x < (int)strlen(crypt_hash); x++)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1572 crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1573
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1574 if (cnt < 64)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1575 memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1576
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1577 cnt = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1578
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1579 for (x = 0; x < (int)strlen(crypt_hash); x++)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1580 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1581
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1582 if (cnt < 64)
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1583 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1584
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1585 gaim_cipher_context_reset(sha1_ctx1, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1586 gaim_cipher_context_reset(sha1_ctx2, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1587
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1588 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1589 * The first context gets the password hash XORed with 0x36 plus a magic value
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1590 * which we previously extrapolated from our challenge.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1591 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1592
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1593 gaim_cipher_context_append(sha1_ctx1, crypt_hash_xor1, 64);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1594 if (y >= 3) {
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1595 gaim_cipher_context_set_option(sha1_ctx1, "sizeLo",
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1596 GINT_TO_POINTER(0x1ff));
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1597 }
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1598 gaim_cipher_context_append(sha1_ctx1, magic_key_char, 4);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1599 gaim_cipher_context_digest(sha1_ctx1, sizeof(digest1), digest1, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1600
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1601 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1602 * The second context gets the password hash XORed with 0x5c plus the SHA-1 digest
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1603 * of the first context.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1604 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1605
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1606 gaim_cipher_context_append(sha1_ctx2, crypt_hash_xor2, 64);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1607 gaim_cipher_context_append(sha1_ctx2, digest1, 20);
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
1608 gaim_cipher_context_digest(sha1_ctx2, sizeof(digest2), digest2, NULL);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1609
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1610 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1611 * Now that we have digest2, use it to fetch characters from an alphabet to construct
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1612 * our first authentication response.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1613 */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1614
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1615 for (x = 0; x < 20; x += 2) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1616 unsigned int val = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1617 unsigned int lookup = 0;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1618
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1619 char byte[6];
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1620
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1621 memset(&byte, 0, 6);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1622
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
1623 /* First two bytes of digest stuffed together. */
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1624
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1625 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1626 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1627 val += digest2[x+1];
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1628
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1629 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1630 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1631 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1632 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1633 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1634 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1635 strcat(resp_96, "=");
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1636
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1637 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1638 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1639 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1640 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1641 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1642 strcat(resp_96, byte);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1643
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1644 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1645 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1646 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1647 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1648 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1649 strcat(resp_96, byte);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1650
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1651 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1652 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1653 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1654 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1655 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1656 }
10784
c29edc9a5e40 [gaim-migrate @ 12417]
Mark Doliner <mark@kingant.net>
parents: 10755
diff changeset
1657 gaim_debug_info("yahoo", "yahoo status: %d\n", yd->current_status);
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
1658 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, yd->current_status, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
1659 yahoo_packet_hash(pack, "sssss", 0, name, 6, resp_6, 96, resp_96, 1,
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
1660 name, 135, "6,0,0,1710");
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1661 if (yd->picture_checksum)
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
1662 yahoo_packet_hash_int(pack, 192, yd->picture_checksum);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
1663
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
1664 yahoo_packet_send_and_free(pack, yd);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1665
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1666 gaim_cipher_context_destroy(md5_ctx);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1667 gaim_cipher_context_destroy(sha1_ctx1);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1668 gaim_cipher_context_destroy(sha1_ctx2);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
1669
7424
c8b4a617ee5b [gaim-migrate @ 8026]
Ethan Blanton <elb@pidgin.im>
parents: 7423
diff changeset
1670 g_free(password_hash);
c8b4a617ee5b [gaim-migrate @ 8026]
Ethan Blanton <elb@pidgin.im>
parents: 7423
diff changeset
1671 g_free(crypt_hash);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1672 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1673
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1674 static void yahoo_process_auth(GaimConnection *gc, struct yahoo_packet *pkt)
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1675 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1676 char *seed = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1677 char *sn = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1678 GSList *l = pkt->hash;
7010
eb3ed649252e [gaim-migrate @ 7573]
Sean Egan <seanegan@gmail.com>
parents: 6998
diff changeset
1679 int m = 0;
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1680 gchar *buf;
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1681
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1682 while (l) {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1683 struct yahoo_pair *pair = l->data;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1684 if (pair->key == 94)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1685 seed = pair->value;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1686 if (pair->key == 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1687 sn = pair->value;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1688 if (pair->key == 13)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1689 m = atoi(pair->value);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1690 l = l->next;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1691 }
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1692
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1693 if (seed) {
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1694 switch (m) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1695 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1696 yahoo_process_auth_old(gc, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1697 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1698 case 1:
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1699 yahoo_process_auth_new(gc, seed);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1700 break;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1701 default:
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1702 buf = g_strdup_printf(_("The Yahoo server has requested the use of an unrecognized "
7129
8246bd3141ae [gaim-migrate @ 7696]
Luke Schierer <lschiere@pidgin.im>
parents: 7127
diff changeset
1703 "authentication method. This version of Gaim will likely not be able "
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1704 "to successfully sign on to Yahoo. Check %s for updates."), GAIM_WEBSITE);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1705 gaim_notify_error(gc, "", _("Failed Yahoo! Authentication"),
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1706 buf);
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1707 g_free(buf);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1708 yahoo_process_auth_new(gc, seed); /* Can't hurt to try it anyway. */
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1709 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1710 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1711 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1712
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1713 static void ignore_buddy(GaimBuddy *buddy) {
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1714 GaimGroup *group;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1715 GaimAccount *account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1716 gchar *name;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1717
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1718 if (!buddy)
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1719 return;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1720
12088
980c877bd238 [gaim-migrate @ 14385]
Mark Doliner <mark@kingant.net>
parents: 12010
diff changeset
1721 group = gaim_buddy_get_group(buddy);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1722 name = g_strdup(buddy->name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1723 account = buddy->account;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1724
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1725 gaim_debug(GAIM_DEBUG_INFO, "blist",
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1726 "Removing '%s' from buddy list.\n", buddy->name);
11643
eb14bbcf7249 [gaim-migrate @ 13920]
Mark Doliner <mark@kingant.net>
parents: 11640
diff changeset
1727 gaim_account_remove_buddy(account, buddy, group);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1728 gaim_blist_remove_buddy(buddy);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1729
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1730 serv_add_deny(account->gc, name);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
1731
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1732 g_free(name);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1733 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1734
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1735 static void keep_buddy(GaimBuddy *b) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1736 gaim_privacy_deny_remove(b->account, b->name, 1);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1737 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1738
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1739 static void yahoo_process_ignore(GaimConnection *gc, struct yahoo_packet *pkt) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1740 GaimBuddy *b;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1741 GSList *l;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1742 gchar *who = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1743 gchar *sn = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1744 gchar buf[BUF_LONG];
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1745 gint ignore = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1746 gint status = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1747
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1748 for (l = pkt->hash; l; l = l->next) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1749 struct yahoo_pair *pair = l->data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1750 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1751 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1752 who = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1753 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1754 case 1:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1755 sn = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1756 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1757 case 13:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1758 ignore = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1759 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1760 case 66:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1761 status = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1762 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1763 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1764 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1765 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1766 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1767
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1768 switch (status) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1769 case 12:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1770 b = gaim_find_buddy(gc->account, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1771 g_snprintf(buf, sizeof(buf), _("You have tried to ignore %s, but the "
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1772 "user is on your buddy list. Clicking \"Yes\" "
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1773 "will remove and ignore the buddy."), who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1774 gaim_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, b,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1775 G_CALLBACK(ignore_buddy),
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1776 G_CALLBACK(keep_buddy));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1777 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1778 case 2:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1779 case 3:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1780 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1781 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1782 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1783 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1784 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1785
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1786 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1787 {
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1788 struct yahoo_data *yd = gc->proto_data;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1789 GSList *l = pkt->hash;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1790 int err = 0;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1791 char *msg;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1792 char *url = NULL;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1793 char *fullmsg;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1794
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1795 while (l) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1796 struct yahoo_pair *pair = l->data;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1797
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1798 if (pair->key == 66)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1799 err = strtol(pair->value, NULL, 10);
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1800 if (pair->key == 20)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1801 url = pair->value;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1802
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1803 l = l->next;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1804 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1805
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1806 switch (err) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1807 case 3:
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1808 msg = g_strdup(_("Invalid username."));
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1809 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1810 case 13:
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1811 if (!yd->wm) {
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1812 yd->wm = TRUE;
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1813 if (yd->fd >= 0)
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1814 close(yd->fd);
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1815 if (gc->inpa)
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1816 gaim_input_remove(gc->inpa);
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1817 gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE,
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1818 yahoo_login_page_cb, gc);
9835
908e6800ced1 [gaim-migrate @ 10706]
Luke Schierer <lschiere@pidgin.im>
parents: 9833
diff changeset
1819 gaim_notify_warning(gc, NULL, _("Normal authentication failed!"),
908e6800ced1 [gaim-migrate @ 10706]
Luke Schierer <lschiere@pidgin.im>
parents: 9833
diff changeset
1820 _("The normal authentication method has failed. "
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1821 "This means either your password is incorrect, "
9835
908e6800ced1 [gaim-migrate @ 10706]
Luke Schierer <lschiere@pidgin.im>
parents: 9833
diff changeset
1822 "or Yahoo!'s authentication scheme has changed. "
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1823 "Gaim will now attempt to log in using Web "
9835
908e6800ced1 [gaim-migrate @ 10706]
Luke Schierer <lschiere@pidgin.im>
parents: 9833
diff changeset
1824 "Messenger authentication, which will result "
9410
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1825 "in reduced functionality and features."));
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1826 return;
73ef7b884e02 [gaim-migrate @ 10225]
Tim Ringenbach <marv@pidgin.im>
parents: 9409
diff changeset
1827 }
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1828 msg = g_strdup(_("Incorrect password."));
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1829 break;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1830 case 14:
9280
2104c1039626 [gaim-migrate @ 10083]
Tim Ringenbach <marv@pidgin.im>
parents: 9279
diff changeset
1831 msg = g_strdup(_("Your account is locked, please log in to the Yahoo! website."));
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1832 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1833 default:
9280
2104c1039626 [gaim-migrate @ 10083]
Tim Ringenbach <marv@pidgin.im>
parents: 9279
diff changeset
1834 msg = g_strdup_printf(_("Unknown error number %d. Logging into the Yahoo! website may fix this."), err);
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1835 }
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1836
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1837 if (url)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1838 fullmsg = g_strdup_printf("%s\n%s", msg, url);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1839 else
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1840 fullmsg = g_strdup(msg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1841
9280
2104c1039626 [gaim-migrate @ 10083]
Tim Ringenbach <marv@pidgin.im>
parents: 9279
diff changeset
1842 gc->wants_to_die = TRUE;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1843 gaim_connection_error(gc, fullmsg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1844 g_free(msg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1845 g_free(fullmsg);
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1846 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1847
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1848 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1849 {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1850 int err = 0;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1851 char *who = NULL;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1852 char *group = NULL;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1853 char *decoded_group;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1854 char *buf;
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
1855 YahooFriend *f;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1856 GSList *l = pkt->hash;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1857
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1858 while (l) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1859 struct yahoo_pair *pair = l->data;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1860
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1861 switch (pair->key) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1862 case 66:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1863 err = strtol(pair->value, NULL, 10);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1864 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1865 case 7:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1866 who = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1867 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1868 case 65:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1869 group = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1870 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1871 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1872
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1873 l = l->next;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1874 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1875
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1876 if (!who)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1877 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1878 if (!group)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1879 group = "";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1880
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1881 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
1882 f = yahoo_friend_find_or_new(gc, who);
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
1883 yahoo_update_status(gc, who, f);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1884 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1885 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1886
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1887 decoded_group = yahoo_string_decode(gc, group, FALSE);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1888 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."),
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1889 who, decoded_group, gaim_connection_get_display_name(gc));
9637
6c44a5d7cf54 [gaim-migrate @ 10485]
Sean Egan <seanegan@gmail.com>
parents: 9604
diff changeset
1890 if (!gaim_conv_present_error(who, gaim_connection_get_account(gc), buf))
6c44a5d7cf54 [gaim-migrate @ 10485]
Sean Egan <seanegan@gmail.com>
parents: 9604
diff changeset
1891 gaim_notify_error(gc, NULL, _("Could not add buddy to server list"), buf);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1892 g_free(buf);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1893 g_free(decoded_group);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1894 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1895
9062
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1896 static void yahoo_process_p2p(GaimConnection *gc, struct yahoo_packet *pkt)
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1897 {
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1898 GSList *l = pkt->hash;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1899 char *who = NULL;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1900 char *base64 = NULL;
11137
096020ae09a9 [gaim-migrate @ 13201]
Mark Doliner <mark@kingant.net>
parents: 11127
diff changeset
1901 guchar *decoded;
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11111
diff changeset
1902 gsize len;
9062
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1903
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1904 while (l) {
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1905 struct yahoo_pair *pair = l->data;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1906
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1907 switch (pair->key) {
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1908 case 5:
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1909 /* our identity */
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1910 break;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1911 case 4:
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1912 who = pair->value;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1913 break;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1914 case 1:
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1915 /* who again, the master identity this time? */
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1916 break;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1917 case 12:
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1918 base64 = pair->value;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1919 /* so, this is an ip address. in base64. decoded it's in ascii.
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1920 after strtol, it's in reversed byte order. Who thought this up?*/
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1921 break;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1922 /*
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1923 TODO: figure these out
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1924 yahoo: Key: 61 Value: 0
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1925 yahoo: Key: 2 Value:
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1926 yahoo: Key: 13 Value: 0
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1927 yahoo: Key: 49 Value: PEERTOPEER
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1928 yahoo: Key: 140 Value: 1
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1929 yahoo: Key: 11 Value: -1786225828
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1930 */
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1931
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1932 }
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1933
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1934 l = l->next;
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1935 }
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1936
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1937 if (base64) {
9281
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1938 guint32 ip;
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1939 char *tmp2;
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1940 YahooFriend *f;
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1941
11127
719779387f96 [gaim-migrate @ 13183]
Mark Doliner <mark@kingant.net>
parents: 11111
diff changeset
1942 decoded = gaim_base64_decode(base64, &len);
9277
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1943 if (len) {
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1944 char *tmp = gaim_str_binary_to_ascii(decoded, len);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1945 gaim_debug_info("yahoo", "Got P2P service packet (from server): who = %s, ip = %s\n", who, tmp);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1946 g_free(tmp);
185fbd8b5998 [gaim-migrate @ 10080]
Tim Ringenbach <marv@pidgin.im>
parents: 9224
diff changeset
1947 }
9281
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1948
11144
923b78741964 [gaim-migrate @ 13208]
Mark Doliner <mark@kingant.net>
parents: 11137
diff changeset
1949 tmp2 = g_strndup((const gchar *)decoded, len); /* so its \0 terminated...*/
9281
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1950 ip = strtol(tmp2, NULL, 10);
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1951 g_free(tmp2);
9062
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1952 g_free(decoded);
9281
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1953 tmp2 = g_strdup_printf("%u.%u.%u.%u", ip & 0xff, (ip >> 8) & 0xff, (ip >> 16) & 0xff,
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1954 (ip >> 24) & 0xff);
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1955 f = yahoo_friend_find(gc, who);
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1956 if (f)
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1957 yahoo_friend_set_ip(f, tmp2);
adde46ad65e9 [gaim-migrate @ 10084]
Tim Ringenbach <marv@pidgin.im>
parents: 9280
diff changeset
1958 g_free(tmp2);
9062
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1959 }
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1960 }
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
1961
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1962 static void yahoo_process_audible(GaimConnection *gc, struct yahoo_packet *pkt)
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1963 {
12798
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1964 char *who = NULL, *msg = NULL, *id = NULL;
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1965 GSList *l = pkt->hash;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1966
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1967 while (l) {
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1968 struct yahoo_pair *pair = l->data;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1969
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1970 switch (pair->key) {
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1971 case 4:
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1972 who = pair->value;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1973 break;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1974 case 5:
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1975 /* us */
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1976 break;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1977 case 230:
12798
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1978 /* the audible, in foo.locale.bar.baz format
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1979 eg: base.tw.smiley.smiley43 */
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1980 id = pair->value;
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1981 break;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1982 case 231:
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1983 /* the text of the audible */
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1984 msg = pair->value;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1985 break;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1986 case 232:
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1987 /* weird number (md5 hash?), like 8ebab9094156135f5dcbaccbeee662a5c5fd1420 */
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1988 break;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1989 }
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1990
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1991 l = l->next;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1992 }
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1993
12798
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1994 if (!msg)
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
1995 msg = id;
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1996 if (!who || !msg)
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1997 return;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1998 if (!g_utf8_validate(msg, -1, NULL)) {
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
1999 gaim_debug_misc("yahoo", "Warning, nonutf8 audible, ignoring!\n");
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2000 return;
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2001 }
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
2002 if (!yahoo_privacy_check(gc, who)) {
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
2003 gaim_debug_misc("yahoo", "Audible message from %s for %s dropped!\n",
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
2004 gc->account->username, who);
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
2005 return;
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
2006 }
12798
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2007 if (id) {
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2008 /* "http://us.dl1.yimg.com/download.yahoo.com/dl/aud/"+locale+"/"+id+".swf" */
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2009 char **audible_locale = g_strsplit(id, ".", 0);
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2010 char *buf = g_strdup_printf(_("[ Audible %s/%s/%s.swf ] %s"), YAHOO_AUDIBLE_URL, audible_locale[1], id, msg);
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2011 g_strfreev(audible_locale);
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2012
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2013 serv_got_im(gc, who, buf, 0, time(NULL));
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2014 g_free(buf);
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2015 } else
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2016 serv_got_im(gc, who, msg, 0, time(NULL));
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2017 }
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2018
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2019 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2020 {
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2021 switch (pkt->service) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2022 case YAHOO_SERVICE_LOGON:
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
2023 case YAHOO_SERVICE_LOGOFF:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2024 case YAHOO_SERVICE_ISAWAY:
2737
f61c1f3a6afa [gaim-migrate @ 2750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2724
diff changeset
2025 case YAHOO_SERVICE_ISBACK:
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2026 case YAHOO_SERVICE_GAMELOGON:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2027 case YAHOO_SERVICE_GAMELOGOFF:
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
2028 case YAHOO_SERVICE_CHATLOGON:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
2029 case YAHOO_SERVICE_CHATLOGOFF:
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
2030 case YAHOO_SERVICE_Y6_STATUS_UPDATE:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2031 yahoo_process_status(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2032 break;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2033 case YAHOO_SERVICE_NOTIFY:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2034 yahoo_process_notify(gc, pkt);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2035 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2036 case YAHOO_SERVICE_MESSAGE:
2786
318f846120e2 [gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2772
diff changeset
2037 case YAHOO_SERVICE_GAMEMSG:
5939
3014de25a8a4 [gaim-migrate @ 6379]
Luke Schierer <lschiere@pidgin.im>
parents: 5921
diff changeset
2038 case YAHOO_SERVICE_CHATMSG:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2039 yahoo_process_message(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2040 break;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
2041 case YAHOO_SERVICE_SYSMESSAGE:
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
2042 yahoo_process_sysmessage(gc, pkt);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
2043 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2044 case YAHOO_SERVICE_NEWMAIL:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2045 yahoo_process_mail(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2046 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2047 case YAHOO_SERVICE_NEWCONTACT:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2048 yahoo_process_contact(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2049 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2050 case YAHOO_SERVICE_AUTHRESP:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2051 yahoo_process_authresp(gc, pkt);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2052 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2053 case YAHOO_SERVICE_LIST:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2054 yahoo_process_list(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2055 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
2056 case YAHOO_SERVICE_AUTH:
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
2057 yahoo_process_auth(gc, pkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
2058 break;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2059 case YAHOO_SERVICE_ADDBUDDY:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2060 yahoo_process_addbuddy(gc, pkt);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2061 break;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2062 case YAHOO_SERVICE_IGNORECONTACT:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2063 yahoo_process_ignore(gc, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2064 break;
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2065 case YAHOO_SERVICE_CONFINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2066 case YAHOO_SERVICE_CONFADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2067 yahoo_process_conference_invite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2068 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2069 case YAHOO_SERVICE_CONFDECLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2070 yahoo_process_conference_decline(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2071 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2072 case YAHOO_SERVICE_CONFLOGON:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2073 yahoo_process_conference_logon(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2074 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2075 case YAHOO_SERVICE_CONFLOGOFF:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2076 yahoo_process_conference_logoff(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2077 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2078 case YAHOO_SERVICE_CONFMSG:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2079 yahoo_process_conference_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2080 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2081 case YAHOO_SERVICE_CHATONLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2082 yahoo_process_chat_online(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2083 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2084 case YAHOO_SERVICE_CHATLOGOUT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2085 yahoo_process_chat_logout(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2086 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2087 case YAHOO_SERVICE_CHATGOTO:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2088 yahoo_process_chat_goto(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2089 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2090 case YAHOO_SERVICE_CHATJOIN:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2091 yahoo_process_chat_join(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2092 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2093 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2094 case YAHOO_SERVICE_CHATEXIT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2095 yahoo_process_chat_exit(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2096 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2097 case YAHOO_SERVICE_CHATINVITE: /* XXX never seen this one, might not do it right */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2098 case YAHOO_SERVICE_CHATADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2099 yahoo_process_chat_addinvite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2100 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2101 case YAHOO_SERVICE_COMMENT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2102 yahoo_process_chat_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2103 break;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2104 case YAHOO_SERVICE_PRESENCE_PERM:
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2105 case YAHOO_SERVICE_PRESENCE_SESSION:
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2106 yahoo_process_presence(gc, pkt);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2107 break;
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2108 case YAHOO_SERVICE_P2PFILEXFER:
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
2109 /* This case had no break and continued; thus keeping it this way.*/
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
2110 yahoo_process_p2pfilexfer(gc, pkt);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2111 case YAHOO_SERVICE_FILETRANSFER:
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2112 yahoo_process_filetransfer(gc, pkt);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2113 break;
11180
5d103f550f6a [gaim-migrate @ 13291]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11153
diff changeset
2114 case YAHOO_SERVICE_PEERTOPEER:
9062
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2115 yahoo_process_p2p(gc, pkt);
c6d32e1c0120 [gaim-migrate @ 9838]
Tim Ringenbach <marv@pidgin.im>
parents: 9041
diff changeset
2116 break;
9284
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
2117 case YAHOO_SERVICE_PICTURE:
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
2118 yahoo_process_picture(gc, pkt);
fe0291162312 [gaim-migrate @ 10087]
Tim Ringenbach <marv@pidgin.im>
parents: 9283
diff changeset
2119 break;
9292
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2120 case YAHOO_SERVICE_PICTURE_UPDATE:
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2121 yahoo_process_picture_update(gc, pkt);
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2122 break;
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2123 case YAHOO_SERVICE_PICTURE_CHECKSUM:
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2124 yahoo_process_picture_checksum(gc, pkt);
750d9b56a465 [gaim-migrate @ 10095]
Tim Ringenbach <marv@pidgin.im>
parents: 9285
diff changeset
2125 break;
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2126 case YAHOO_SERVICE_PICTURE_UPLOAD:
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2127 yahoo_process_picture_upload(gc, pkt);
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2128 break;
9604
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2129 case YAHOO_SERVICE_AUDIBLE:
8e9727919633 [gaim-migrate @ 10447]
Tim Ringenbach <marv@pidgin.im>
parents: 9475
diff changeset
2130 yahoo_process_audible(gc, pkt);
12798
09d4ea834370 [gaim-migrate @ 15145]
Richard Laager <rlaager@wiktel.com>
parents: 12797
diff changeset
2131 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2132 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
2133 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2134 "Unhandled service 0x%02x\n", pkt->service);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2135 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2136 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2137 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2138
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2139 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2140 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2141 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2142 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2143 char buf[1024];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2144 int len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2145
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2146 len = read(yd->fd, buf, sizeof(buf));
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2147
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2148 if (len <= 0) {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
2149 gaim_connection_error(gc, _("Unable to read"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2150 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2151 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2152
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2153 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2154 memcpy(yd->rxqueue + yd->rxlen, buf, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2155 yd->rxlen += len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2156
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2157 while (1) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2158 struct yahoo_packet *pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2159 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2160 int pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2161
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2162 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2163 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2164
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11303
diff changeset
2165 if (strncmp((char *)yd->rxqueue, "YMSG", MIN(4, yd->rxlen)) != 0) {
10610
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2166 /* HEY! This isn't even a YMSG packet. What
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2167 * are you trying to pull? */
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2168 guchar *start;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2169
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2170 gaim_debug_warning("yahoo", "Error in YMSG stream, got something not a YMSG packet!");
10611
41a18bf60ee1 [gaim-migrate @ 12065]
Tim Ringenbach <marv@pidgin.im>
parents: 10610
diff changeset
2171
10635
6895c4212362 [gaim-migrate @ 12117]
Tim Ringenbach <marv@pidgin.im>
parents: 10611
diff changeset
2172 start = memchr(yd->rxqueue + 1, 'Y', yd->rxlen - 1);
10610
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2173 if (start) {
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2174 g_memmove(yd->rxqueue, start, yd->rxlen - (start - yd->rxqueue));
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2175 yd->rxlen -= start - yd->rxqueue;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2176 continue;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2177 } else {
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2178 g_free(yd->rxqueue);
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2179 yd->rxqueue = NULL;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2180 yd->rxlen = 0;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2181 return;
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2182 }
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2183 }
74cc119beceb [gaim-migrate @ 12063]
Tim Ringenbach <marv@pidgin.im>
parents: 10575
diff changeset
2184
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2185 pos += 4; /* YMSG */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2186 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2187 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2188
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2189 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
2190 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2191 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2192
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2193 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2194 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2195
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2196 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2197
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2198 pkt = yahoo_packet_new(0, 0, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2199
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2200 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
3021
18f0e61a6caf [gaim-migrate @ 3034]
Sean Egan <seanegan@gmail.com>
parents: 3020
diff changeset
2201 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
2202 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2203 "Yahoo Service: 0x%02x Status: %d\n",
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
2204 pkt->service, pkt->status);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2205 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2206
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2207 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2208
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2209 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2210 if (yd->rxlen) {
11318
519dc2186438 [gaim-migrate @ 13521]
Stu Tomlinson <stu@nosnilmot.com>
parents: 11303
diff changeset
2211 guchar *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2212 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2213 yd->rxqueue = tmp;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2214 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2215 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2216 yd->rxqueue = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2217 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2218
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2219 yahoo_packet_process(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2220
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2221 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2222 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2223 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2224
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2225 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2226 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2227 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2228 struct yahoo_data *yd;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2229 struct yahoo_packet *pkt;
11076
75be3005640e [gaim-migrate @ 13086]
Mark Doliner <mark@kingant.net>
parents: 11043
diff changeset
2230
5590
011a0a975060 [gaim-migrate @ 5994]
Christian Hammond <chipx86@chipx86.com>
parents: 5583
diff changeset
2231 if (!g_list_find(gaim_connections_get_all(), gc)) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2232 close(source);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2233 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2234 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2235
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2236 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2237 gaim_connection_error(gc, _("Unable to connect."));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2238 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2239 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2240
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2241 yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2242 yd->fd = source;
11076
75be3005640e [gaim-migrate @ 13086]
Mark Doliner <mark@kingant.net>
parents: 11043
diff changeset
2243
11078
12f029b89956 [gaim-migrate @ 13088]
Mark Doliner <mark@kingant.net>
parents: 11077
diff changeset
2244 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, yd->current_status, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2245
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
2246 yahoo_packet_hash_str(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))));
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
2247 yahoo_packet_send_and_free(pkt, yd);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2248
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2249 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2250 }
9370
76f4bffcfb23 [gaim-migrate @ 10178]
Tim Ringenbach <marv@pidgin.im>
parents: 9369
diff changeset
2251
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2252 static void yahoo_got_web_connected(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2253 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2254 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2255 struct yahoo_data *yd;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2256 struct yahoo_packet *pkt;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2257
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2258 if (!g_list_find(gaim_connections_get_all(), gc)) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2259 close(source);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2260 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2261 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2262
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2263 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2264 gaim_connection_error(gc, _("Unable to connect."));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2265 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2266 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2267
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2268 yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2269 yd->fd = source;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2270
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2271 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2272
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
2273 yahoo_packet_hash(pkt, "sss", 0,
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
2274 gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
2275 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
2276 6, yd->auth);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
2277 yahoo_packet_send_and_free(pkt, yd);
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
2278
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2279 g_free(yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2280 gc->inpa = gaim_input_add(yd->fd, GAIM_INPUT_READ, yahoo_pending, gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2281 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2282
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2283 static void yahoo_web_pending(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2284 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2285 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2286 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2287 struct yahoo_data *yd = gc->proto_data;
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2288 char bufread[2048], *i = bufread, *buf = bufread;
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2289 int len;
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2290 GString *s;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2291
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2292 len = read(source, bufread, sizeof(bufread) - 1);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2293 if (len < 0 && errno == EAGAIN)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2294 return;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2295 else if (len <= 0) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2296 gaim_connection_error(gc, _("Unable to read"));
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2297 return;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2298 }
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2299
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2300 if (yd->rxlen > 0 || !g_strstr_len(buf, len, "\r\n\r\n")) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2301 yd->rxqueue = g_realloc(yd->rxqueue, yd->rxlen + len + 1);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2302 memcpy(yd->rxqueue + yd->rxlen, buf, len);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2303 yd->rxlen += len;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2304 i = buf = yd->rxqueue;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2305 len = yd->rxlen;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2306 }
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2307 buf[len] = '\0';
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2308
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2309 if ((strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) &&
8216
dcace041cfb8 [gaim-migrate @ 8939]
Christian Hammond <chipx86@chipx86.com>
parents: 8212
diff changeset
2310 strncmp(buf, "HTTP/1.1 302", strlen("HTTP/1.1 302")))) {
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2311 gaim_connection_error(gc, _("Unable to read"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2312 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2313 }
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2314
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2315 s = g_string_sized_new(len);
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2316
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2317 while ((i = strstr(i, "Set-Cookie: "))) {
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2318 i += strlen("Set-Cookie: ");
8243
217643616a74 [gaim-migrate @ 8966]
Luke Schierer <lschiere@pidgin.im>
parents: 8235
diff changeset
2319 for (;*i != ';' && *i != '\0'; i++)
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2320 g_string_append_c(s, *i);
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2321
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2322 g_string_append(s, "; ");
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2323 }
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2324
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2325 yd->auth = g_string_free(s, FALSE);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2326 gaim_input_remove(gc->inpa);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2327 close(source);
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2328 g_free(yd->rxqueue);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2329 yd->rxqueue = NULL;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2330 yd->rxlen = 0;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2331 /* Now we have our cookies to login with. I'll go get the milk. */
8045
cd3a2cef5112 [gaim-migrate @ 8729]
Sean Egan <seanegan@gmail.com>
parents: 7986
diff changeset
2332 if (gaim_proxy_connect(account, "wcs2.msg.dcn.yahoo.com",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2333 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2334 yahoo_got_web_connected, gc) != 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2335 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2336 return;
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
2337 }
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2338 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2339
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2340 static void yahoo_got_cookies(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2341 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2342 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2343 struct yahoo_data *yd = gc->proto_data;
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2344 int written, total_len;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2345
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2346 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2347 gaim_connection_error(gc, _("Unable to connect."));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2348 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2349 }
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2350
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2351 total_len = strlen(yd->auth) - yd->auth_written;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2352 written = write(source, yd->auth + yd->auth_written, total_len);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2353
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2354 if (written < 0 && errno == EAGAIN)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2355 written = 0;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2356 else if (written <= 0) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2357 g_free(yd->auth);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2358 yd->auth = NULL;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2359 if (gc->inpa)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2360 gaim_input_remove(gc->inpa);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2361 gc->inpa = 0;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2362 gaim_connection_error(gc, _("Unable to connect."));
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2363 return;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2364 }
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2365
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2366 if (written < total_len) {
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2367 yd->auth_written += written;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2368 if (!gc->inpa)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2369 gc->inpa = gaim_input_add(source, GAIM_INPUT_WRITE,
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2370 yahoo_got_cookies, gc);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2371 return;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2372 }
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2373
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2374 g_free(yd->auth);
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2375 yd->auth = NULL;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2376 yd->auth_written = 0;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2377 if (gc->inpa)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2378 gaim_input_remove(gc->inpa);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2379 gc->inpa = gaim_input_add(source, GAIM_INPUT_READ, yahoo_web_pending, gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2380 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2381
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2382 static void yahoo_login_page_hash_iter(const char *key, const char *val, GString *url)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2383 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2384 if (!strcmp(key, "passwd"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2385 return;
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2386 g_string_append_c(url, '&');
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2387 g_string_append(url, key);
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2388 g_string_append_c(url, '=');
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2389 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2390 g_string_append_c(url, '1');
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2391 else if (!strcmp(key, ".challenge"))
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2392 g_string_append(url, val);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2393 else
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
2394 g_string_append(url, gaim_url_encode(val));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2395 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2396
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2397 static GHashTable *yahoo_login_page_hash(const char *buf, size_t len)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2398 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2399 GHashTable *hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2400 const char *c = buf;
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2401 char *d;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2402 char name[64], value[64];
11188
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2403 int count;
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2404 int input_len = strlen("<input ");
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2405 int name_len = strlen("name=\"");
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2406 int value_len = strlen("value=\"");
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2407 while ((len > ((c - buf) + input_len))
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2408 && (c = strstr(c, "<input "))) {
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2409 if (!(c = g_strstr_len(c, len - (c - buf), "name=\"")))
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2410 continue;
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2411 c += name_len;
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2412 count = sizeof(name)-1;
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2413 for (d = name; (len > ((c - buf) + 1)) && *c!='"'
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2414 && count; c++, d++, count--)
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2415 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2416 *d = '\0';
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2417 count = sizeof(value)-1;
11188
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2418 if (!(d = g_strstr_len(c, len - (c - buf), "value=\"")))
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2419 continue;
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2420 d += value_len;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2421 if (strchr(c, '>') < d)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2422 break;
11188
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2423 for (c = d, d = value; (len > ((c - buf) + 1))
12fc7a3fbc88 [gaim-migrate @ 13305]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 11183
diff changeset
2424 && *c!='"' && count; c++, d++, count--)
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2425 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2426 *d = '\0';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2427 g_hash_table_insert(hash, g_strdup(name), g_strdup(value));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2428 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2429 return hash;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2430 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2431
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2432 static void yahoo_login_page_cb(void *user_data, const char *buf, size_t len)
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2433 {
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2434 GaimConnection *gc = (GaimConnection *)user_data;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2435 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2436 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2437 const char *sn = gaim_account_get_username(account);
10740
94cc67130789 [gaim-migrate @ 12342]
Mark Doliner <mark@kingant.net>
parents: 10738
diff changeset
2438 const char *pass = gaim_connection_get_password(gc);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2439 GHashTable *hash = yahoo_login_page_hash(buf, len);
10575
96307e1a47c9 [gaim-migrate @ 11968]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10553
diff changeset
2440 GString *url = g_string_new("GET http://login.yahoo.com/config/login?login=");
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2441 char md5[33], *hashp = md5, *chal;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2442 int i;
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2443 GaimCipher *cipher;
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2444 GaimCipherContext *context;
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
2445 guchar digest[16];
7191
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2446
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2447 url = g_string_append(url, sn);
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2448 url = g_string_append(url, "&passwd=");
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2449
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2450 cipher = gaim_ciphers_find_cipher("md5");
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2451 context = gaim_cipher_context_new(cipher, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2452
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
2453 gaim_cipher_context_append(context, (const guchar *)pass, strlen(pass));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
2454 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2455 for (i = 0; i < 16; ++i) {
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2456 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2457 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2458 }
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2459
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2460 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2461 gaim_cipher_context_reset(context, NULL);
11183
8dca96cbcd64 [gaim-migrate @ 13295]
Mark Doliner <mark@kingant.net>
parents: 11180
diff changeset
2462 gaim_cipher_context_append(context, (const guchar *)chal, strlen(chal));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
2463 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2464 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2465 for (i = 0; i < 16; ++i) {
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2466 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2467 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2468 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2469 /*
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2470 * I dunno why this is here and commented out.. but in case it's needed
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2471 * I updated it..
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2472
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2473 gaim_cipher_context_reset(context, NULL);
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2474 gaim_cipher_context_append(context, md5, strlen(md5));
10687
b256ce6b85b8 [gaim-migrate @ 12235]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10684
diff changeset
2475 gaim_cipher_context_digest(context, sizeof(digest), digest, NULL);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2476 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2477 for (i = 0; i < 16; ++i) {
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2478 g_snprintf(hashp, 3, "%02x", digest[i]);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2479 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2480 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2481 */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2482 g_free(chal);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
2483
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2484 url = g_string_append(url, md5);
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2485 g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url);
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
2486
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2487 url = g_string_append(url, "&.hash=1&.md5=1 HTTP/1.1\r\n"
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2488 "Host: login.yahoo.com\r\n\r\n");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2489 g_hash_table_destroy(hash);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2490 yd->auth = g_string_free(url, FALSE);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2491 if (gaim_proxy_connect(account, "login.yahoo.com", 80, yahoo_got_cookies, gc) != 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2492 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2493 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2494 }
10684
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2495
72a5babfa8b4 [gaim-migrate @ 12231]
Luke Schierer <lschiere@pidgin.im>
parents: 10662
diff changeset
2496 gaim_cipher_context_destroy(context);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2497 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2498
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2499 static void yahoo_server_check(GaimAccount *account)
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2500 {
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2501 const char *server;
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2502
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2503 server = gaim_account_get_string(account, "server", YAHOO_PAGER_HOST);
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2504
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2505 if (strcmp(server, "scs.yahoo.com") == 0)
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2506 gaim_account_set_string(account, "server", YAHOO_PAGER_HOST);
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2507 }
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2508
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2509 static void yahoo_picture_check(GaimAccount *account)
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2510 {
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2511 GaimConnection *gc = gaim_account_get_connection(account);
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11257
diff changeset
2512 char *buddyicon;
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11257
diff changeset
2513
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11257
diff changeset
2514 buddyicon = gaim_buddy_icons_get_full_path(gaim_account_get_buddy_icon(account));
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2515 yahoo_set_buddy_icon(gc, buddyicon);
11303
10066662176a [gaim-migrate @ 13503]
Richard Laager <rlaager@wiktel.com>
parents: 11257
diff changeset
2516 g_free(buddyicon);
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2517 }
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2518
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2519 static int get_yahoo_status_from_gaim_status(GaimStatus *status)
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2520 {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2521 GaimPresence *presence;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2522 const char *status_id;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2523 const char *msg;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2524
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2525 presence = gaim_status_get_presence(status);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2526 status_id = gaim_status_get_id(status);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2527 msg = gaim_status_get_attr_string(status, "message");
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2528
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2529 if (!strcmp(status_id, YAHOO_STATUS_TYPE_AVAILABLE)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2530 if ((msg != NULL) && (*msg != '\0'))
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2531 return YAHOO_STATUS_CUSTOM;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2532 else
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2533 return YAHOO_STATUS_AVAILABLE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2534 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BRB)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2535 return YAHOO_STATUS_BRB;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2536 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_BUSY)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2537 return YAHOO_STATUS_BUSY;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2538 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATHOME)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2539 return YAHOO_STATUS_NOTATHOME;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2540 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTATDESK)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2541 return YAHOO_STATUS_NOTATDESK;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2542 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_NOTINOFFICE)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2543 return YAHOO_STATUS_NOTINOFFICE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2544 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONPHONE)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2545 return YAHOO_STATUS_ONPHONE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2546 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_ONVACATION)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2547 return YAHOO_STATUS_ONVACATION;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2548 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_OUTTOLUNCH)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2549 return YAHOO_STATUS_OUTTOLUNCH;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2550 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_STEPPEDOUT)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2551 return YAHOO_STATUS_STEPPEDOUT;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2552 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_INVISIBLE)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2553 return YAHOO_STATUS_INVISIBLE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2554 } else if (!strcmp(status_id, YAHOO_STATUS_TYPE_AWAY)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2555 return YAHOO_STATUS_CUSTOM;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2556 } else if (gaim_presence_is_idle(presence)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2557 return YAHOO_STATUS_IDLE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2558 } else {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2559 gaim_debug_error("yahoo", "Unexpected GaimStatus!\n");
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2560 return YAHOO_STATUS_AVAILABLE;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2561 }
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2562 }
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2563
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11803
diff changeset
2564 static void yahoo_login(GaimAccount *account) {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2565 GaimConnection *gc = gaim_account_get_connection(account);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2566 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
11837
fa742ad8068c [gaim-migrate @ 14128]
Mark Doliner <mark@kingant.net>
parents: 11803
diff changeset
2567 GaimStatus *status = gaim_account_get_active_status(account);
9041
812e7aa7eafa [gaim-migrate @ 9817]
Tim Ringenbach <marv@pidgin.im>
parents: 9030
diff changeset
2568 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR | GAIM_CONNECTION_NO_URLDESC;
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2569
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2570 gaim_connection_update_progress(gc, _("Connecting"), 1, 2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2571
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8216
diff changeset
2572 gaim_connection_set_display_name(gc, gaim_account_get_username(account));
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8216
diff changeset
2573
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2574 yd->fd = -1;
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2575 yd->txhandler = -1;
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2576 /* TODO: Is there a good grow size for the buffer? */
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2577 yd->txbuf = gaim_circ_buffer_new(0);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2578 yd->friends = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, yahoo_friend_free);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2579 yd->confs = NULL;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2580 yd->conf_id = 2;
11076
75be3005640e [gaim-migrate @ 13086]
Mark Doliner <mark@kingant.net>
parents: 11043
diff changeset
2581
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2582 yd->current_status = get_yahoo_status_from_gaim_status(status);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
2583
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2584 yahoo_server_check(account);
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2585 yahoo_picture_check(account);
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2586
9164
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2587 if (gaim_account_get_bool(account, "yahoojp", FALSE)) {
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2588 yd->jp = TRUE;
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2589 if (gaim_proxy_connect(account,
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2590 gaim_account_get_string(account, "serverjp", YAHOOJP_PAGER_HOST),
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2591 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2592 yahoo_got_connected, gc) != 0)
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2593 {
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2594 gaim_connection_error(gc, _("Connection problem"));
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2595 return;
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2596 }
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2597 } else {
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2598 yd->jp = FALSE;
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2599 if (gaim_proxy_connect(account,
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2600 gaim_account_get_string(account, "server", YAHOO_PAGER_HOST),
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2601 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2602 yahoo_got_connected, gc) != 0)
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2603 {
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2604 gaim_connection_error(gc, _("Connection problem"));
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2605 return;
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
2606 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2607 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2608 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2609
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2610 static void yahoo_close(GaimConnection *gc) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2611 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
9782
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2612 GSList *l;
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2613
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
2614 if (gc->inpa)
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
2615 gaim_input_remove(gc->inpa);
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
2616
9782
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2617 for (l = yd->confs; l; l = l->next) {
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2618 GaimConversation *conv = l->data;
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2619
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2620 yahoo_conf_leave(yd, gaim_conversation_get_name(conv),
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2621 gaim_connection_get_display_name(gc),
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2622 gaim_conv_chat_get_users(GAIM_CONV_CHAT(conv)));
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2623 }
68368058ee03 [gaim-migrate @ 10650]
Tim Ringenbach <marv@pidgin.im>
parents: 9768
diff changeset
2624 g_slist_free(yd->confs);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2625
12841
ab37a4cc477e [gaim-migrate @ 15189]
Richard Laager <rlaager@wiktel.com>
parents: 12798
diff changeset
2626 yd->chat_online = 0;
ab37a4cc477e [gaim-migrate @ 15189]
Richard Laager <rlaager@wiktel.com>
parents: 12798
diff changeset
2627 if (yd->in_chat)
ab37a4cc477e [gaim-migrate @ 15189]
Richard Laager <rlaager@wiktel.com>
parents: 12798
diff changeset
2628 yahoo_c_leave(gc, 1); /* 1 = YAHOO_CHAT_ID */
ab37a4cc477e [gaim-migrate @ 15189]
Richard Laager <rlaager@wiktel.com>
parents: 12798
diff changeset
2629
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2630 g_hash_table_destroy(yd->friends);
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2631 g_free(yd->chat_name);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2632
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2633 g_free(yd->cookie_y);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2634 g_free(yd->cookie_t);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2635
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2636 if (yd->txhandler)
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2637 gaim_input_remove(yd->txhandler);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2638
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2639 gaim_circ_buffer_destroy(yd->txbuf);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2640
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2641 if (yd->fd >= 0)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2642 close(yd->fd);
3720
34c95669952f [gaim-migrate @ 3853]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3642
diff changeset
2643
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2644 g_free(yd->rxqueue);
2687
2d544f48146d [gaim-migrate @ 2700]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2686
diff changeset
2645 yd->rxlen = 0;
13200
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2646 g_free(yd->picture_url);
33bef17125c2 [gaim-migrate @ 15563]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 13106
diff changeset
2647
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2648 if (yd->picture_upload_todo)
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
2649 yahoo_buddy_icon_upload_data_free(yd->picture_upload_todo);
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
2650 if (yd->ycht)
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
2651 ycht_connection_close(yd->ycht);
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
2652
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2653 g_free(yd);
13343
3e87f0c5287d [gaim-migrate @ 15713]
Richard Laager <rlaager@wiktel.com>
parents: 13296
diff changeset
2654 gc->proto_data = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2655 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2656
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2657 static const char *yahoo_list_icon(GaimAccount *a, GaimBuddy *b)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2658 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
2659 return "yahoo";
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2660 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2661
9972
2c7c6bdb938b [gaim-migrate @ 10883]
Mark Doliner <mark@kingant.net>
parents: 9943
diff changeset
2662 static void yahoo_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2663 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2664 int i = 0;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2665 char *emblems[4] = {NULL,NULL,NULL,NULL};
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2666 GaimAccount *account;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2667 GaimConnection *gc;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2668 struct yahoo_data *yd;
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2669 YahooFriend *f;
10126
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2670 GaimPresence *presence;
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2671 GaimStatus *status;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2672
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2673 if (!b || !(account = b->account) || !(gc = gaim_account_get_connection(account)) ||
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
2674 !(yd = gc->proto_data))
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2675 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2676
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2677 f = yahoo_friend_find(gc, b->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2678 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2679 *se = "notauthorized";
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2680 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2681 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2682
10126
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2683 presence = gaim_buddy_get_presence(b);
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2684 status = gaim_presence_get_active_status(presence);
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2685
3c3795562256 [gaim-migrate @ 11163]
Tim Ringenbach <marv@pidgin.im>
parents: 10121
diff changeset
2686 if (gaim_presence_is_online(presence) == FALSE) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2687 *se = "offline";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2688 return;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2689 } else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2690 if (f->away)
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2691 emblems[i++] = "away";
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2692 if (f->sms)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2693 emblems[i++] = "wireless";
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2694 if (yahoo_friend_get_game(f))
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2695 emblems[i++] = "game";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2696 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2697 *se = emblems[0];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2698 *sw = emblems[1];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2699 *nw = emblems[2];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2700 *ne = emblems[3];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2701 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2702
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13041
diff changeset
2703 static const char *yahoo_get_status_string(enum yahoo_status a)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2704 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2705 switch (a) {
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2706 case YAHOO_STATUS_BRB:
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2707 return _("Be Right Back");
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
2708 case YAHOO_STATUS_BUSY:
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
2709 return _("Busy");
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2710 case YAHOO_STATUS_NOTATHOME:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2711 return _("Not at Home");
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2712 case YAHOO_STATUS_NOTATDESK:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2713 return _("Not at Desk");
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2714 case YAHOO_STATUS_NOTINOFFICE:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2715 return _("Not in Office");
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2716 case YAHOO_STATUS_ONPHONE:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2717 return _("On the Phone");
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2718 case YAHOO_STATUS_ONVACATION:
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2719 return _("On Vacation");
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
2720 case YAHOO_STATUS_OUTTOLUNCH:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2721 return _("Out to Lunch");
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
2722 case YAHOO_STATUS_STEPPEDOUT:
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
2723 return _("Stepped Out");
2873
26be84883f91 [gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
2724 case YAHOO_STATUS_INVISIBLE:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2725 return _("Invisible");
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2726 case YAHOO_STATUS_IDLE:
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2727 return _("Idle");
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2728 case YAHOO_STATUS_OFFLINE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2729 return _("Offline");
2879
5fc5123b7098 [gaim-migrate @ 2892]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2878
diff changeset
2730 default:
12467
1b57012eec7b [gaim-migrate @ 14777]
Richard Laager <rlaager@wiktel.com>
parents: 12417
diff changeset
2731 return _("Available");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2732 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2733 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2734
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2735 static void yahoo_initiate_conference(GaimBlistNode *node, gpointer data) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2736
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2737 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2738 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2739
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2740 GHashTable *components;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2741 struct yahoo_data *yd;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2742 int id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2743
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2744 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2745
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2746 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2747 gc = gaim_account_get_connection(buddy->account);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2748 yd = gc->proto_data;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2749 id = yd->conf_id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2750
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2751 components = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2752 g_hash_table_replace(components, g_strdup("room"),
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2753 g_strdup_printf("%s-%d", gaim_connection_get_display_name(gc), id));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2754 g_hash_table_replace(components, g_strdup("topic"), g_strdup("Join my conference..."));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2755 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference"));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2756 yahoo_c_join(gc, components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2757 g_hash_table_destroy(components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2758
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2759 yahoo_c_invite(gc, id, "Join my conference...", buddy->name);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2760 }
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2761
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2762 static void yahoo_presence_settings(GaimBlistNode *node, gpointer data) {
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2763 GaimBuddy *buddy;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2764 GaimConnection *gc;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2765 int presence_val = GPOINTER_TO_INT(data);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2766
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2767 buddy = (GaimBuddy *) node;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2768 gc = gaim_account_get_connection(buddy->account);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2769
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2770 yahoo_friend_update_presence(gc, buddy->name, presence_val);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2771 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2772
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2773 static void yahoo_game(GaimBlistNode *node, gpointer data) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2774
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2775 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2776 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2777
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2778 struct yahoo_data *yd;
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2779 const char *game;
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2780 char *game2;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2781 char *t;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2782 char url[256];
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2783 YahooFriend *f;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2784
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2785 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2786
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2787 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2788 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2789 yd = (struct yahoo_data *) gc->proto_data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2790
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2791 f = yahoo_friend_find(gc, buddy->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2792 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2793 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2794
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2795 game = yahoo_friend_get_game(f);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2796 if (!game)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2797 return;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2798
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2799 t = game2 = g_strdup(strstr(game, "ante?room="));
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2800 while (*t && *t != '\t')
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2801 t++;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2802 *t = 0;
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2803 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game2);
10240
95ca0db2d01d [gaim-migrate @ 11377]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 10209
diff changeset
2804 gaim_notify_uri(gc, url);
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2805 g_free(game2);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2806 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2807
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2808 static char *yahoo_status_text(GaimBuddy *b)
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2809 {
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2810 YahooFriend *f = NULL;
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2811 const char *msg;
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11914
diff changeset
2812 char *msg2;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2813
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2814 f = yahoo_friend_find(b->account->gc, b->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2815 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2816 return g_strdup(_("Not on server list"));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2817
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2818 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2819 case YAHOO_STATUS_AVAILABLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2820 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2821 case YAHOO_STATUS_IDLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2822 if (f->idle == -1)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2823 return g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2824 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2825 case YAHOO_STATUS_CUSTOM:
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2826 if (!(msg = yahoo_friend_get_status_message(f)))
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2827 return NULL;
11920
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11914
diff changeset
2828 msg2 = g_markup_escape_text(msg, strlen(msg));
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11914
diff changeset
2829 gaim_util_chrreplace(msg2, '\n', ' ');
52f27ffe68a5 [gaim-migrate @ 14211]
Mark Doliner <mark@kingant.net>
parents: 11914
diff changeset
2830 return msg2;
9224
3e0cd1c6ddc7 [gaim-migrate @ 10020]
Tim Ringenbach <marv@pidgin.im>
parents: 9221
diff changeset
2831
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2832 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2833 return g_strdup(yahoo_get_status_string(f->status));
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
2834 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2835 }
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2836
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12945
diff changeset
2837 void yahoo_tooltip_text(GaimBuddy *b, GString *str, gboolean full)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
2838 {
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2839 YahooFriend *f;
13106
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13041
diff changeset
2840 char *escaped;
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13041
diff changeset
2841 char *status = NULL;
a0a4b44239e8 [gaim-migrate @ 15468]
Richard Laager <rlaager@wiktel.com>
parents: 13041
diff changeset
2842 const char *presence = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2843
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2844 f = yahoo_friend_find(b->account->gc, b->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2845 if (!f)
8591
f96795b786d2 [gaim-migrate @ 9342]
Mark Doliner <mark@kingant.net>
parents: 8589
diff changeset
2846 status = g_strdup_printf("\n%s", _("Not on server list"));
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2847 else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2848 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2849 case YAHOO_STATUS_CUSTOM:
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2850 if (!yahoo_friend_get_status_message(f))
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12945
diff changeset
2851 return;
9283
66ff39319900 [gaim-migrate @ 10086]
Tim Ringenbach <marv@pidgin.im>
parents: 9281
diff changeset
2852 status = g_strdup(yahoo_friend_get_status_message(f));
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2853 break;
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2854 case YAHOO_STATUS_OFFLINE:
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2855 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2856 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2857 status = g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2858 break;
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4732
diff changeset
2859 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2860
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2861 switch (f->presence) {
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2862 case YAHOO_PRESENCE_ONLINE:
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2863 presence = _("Appear Online");
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2864 break;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2865 case YAHOO_PRESENCE_PERM_OFFLINE:
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2866 presence = _("Appear Permanently Offline");
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2867 break;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2868 case YAHOO_PRESENCE_DEFAULT:
12945
6af3ac33eeea [gaim-migrate @ 15298]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2869 break;
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2870 default:
12945
6af3ac33eeea [gaim-migrate @ 15298]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2871 gaim_debug_error("yahoo", "Unknown presence in yahoo_tooltip_text\n");
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2872 break;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2873 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2874 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2875
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2876 if (status != NULL) {
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2877 escaped = g_markup_escape_text(status, strlen(status));
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12945
diff changeset
2878 g_string_append_printf(str, _("\n<b>%s:</b> %s"), _("Status"), escaped);
10992
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2879 g_free(status);
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2880 g_free(escaped);
2bda44d66641 [gaim-migrate @ 12830]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10989
diff changeset
2881 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2882
12945
6af3ac33eeea [gaim-migrate @ 15298]
Richard Laager <rlaager@wiktel.com>
parents: 12943
diff changeset
2883 if (presence != NULL)
12970
ec9b92104904 [gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents: 12945
diff changeset
2884 g_string_append_printf(str, _("\n<b>%s:</b> %s"),
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2885 _("Presence"), presence);
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2886 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2887
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2888 static void yahoo_addbuddyfrommenu_cb(GaimBlistNode *node, gpointer data)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2889 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2890 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2891 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2892
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2893 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2894
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2895 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2896 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2897
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
2898 yahoo_add_buddy(gc, buddy, NULL);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2899 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2900
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2901
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2902 static void yahoo_chat_goto_menu(GaimBlistNode *node, gpointer data)
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2903 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2904 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2905 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2906
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2907 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2908
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2909 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2910 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2911
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2912 yahoo_chat_goto(gc, buddy->name);
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2913 }
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2914
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2915 static GList *build_presence_submenu(YahooFriend *f, GaimConnection *gc) {
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2916 GList *m = NULL;
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2917 GaimMenuAction *act;
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2918 struct yahoo_data *yd = (struct yahoo_data *) gc->proto_data;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2919
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2920 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2921 if (f->presence != YAHOO_PRESENCE_ONLINE) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2922 act = gaim_menu_action_new(_("Appear Online"),
13021
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2923 GAIM_CALLBACK(yahoo_presence_settings),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2924 GINT_TO_POINTER(YAHOO_PRESENCE_ONLINE),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2925 NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2926 m = g_list_append(m, act);
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2927 } else if (f->presence != YAHOO_PRESENCE_DEFAULT) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2928 act = gaim_menu_action_new(_("Appear Offline"),
13021
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2929 GAIM_CALLBACK(yahoo_presence_settings),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2930 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2931 NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2932 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2933 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2934 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2935
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
2936 if (f->presence == YAHOO_PRESENCE_PERM_OFFLINE) {
13021
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2937 act = gaim_menu_action_new(_("Don't Appear Permanently Offline"),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2938 GAIM_CALLBACK(yahoo_presence_settings),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2939 GINT_TO_POINTER(YAHOO_PRESENCE_DEFAULT),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2940 NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2941 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2942 } else {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2943 act = gaim_menu_action_new(_("Appear Permanently Offline"),
13021
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2944 GAIM_CALLBACK(yahoo_presence_settings),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2945 GINT_TO_POINTER(YAHOO_PRESENCE_PERM_OFFLINE),
eb64b2b26e56 [gaim-migrate @ 15374]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12999
diff changeset
2946 NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2947 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2948 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2949
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2950 return m;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2951 }
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2952
11800
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2953 static void yahoo_doodle_blist_node(GaimBlistNode *node, gpointer data)
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2954 {
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2955 GaimBuddy *b = (GaimBuddy *)node;
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2956 GaimConnection *gc = b->account->gc;
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2957
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2958 yahoo_doodle_initiate(gc, b->name);
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2959 }
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
2960
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2961 static GList *yahoo_buddy_menu(GaimBuddy *buddy)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2962 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2963 GList *m = NULL;
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2964 GaimMenuAction *act;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2965
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2966 GaimConnection *gc = gaim_account_get_connection(buddy->account);
9370
76f4bffcfb23 [gaim-migrate @ 10178]
Tim Ringenbach <marv@pidgin.im>
parents: 9369
diff changeset
2967 struct yahoo_data *yd = gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2968 static char buf2[1024];
9278
2401a9ef74a0 [gaim-migrate @ 10081]
Tim Ringenbach <marv@pidgin.im>
parents: 9277
diff changeset
2969 YahooFriend *f;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2970
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
2971 f = yahoo_friend_find(gc, buddy->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2972
9370
76f4bffcfb23 [gaim-migrate @ 10178]
Tim Ringenbach <marv@pidgin.im>
parents: 9369
diff changeset
2973 if (!f && !yd->wm) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2974 act = gaim_menu_action_new(_("Add Buddy"),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2975 GAIM_CALLBACK(yahoo_addbuddyfrommenu_cb),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2976 NULL, NULL);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2977 m = g_list_append(m, act);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2978
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2979 return m;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2980
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2981 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2982
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2983 if (f && f->status != YAHOO_STATUS_OFFLINE) {
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2984 if (!yd->wm) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2985 act = gaim_menu_action_new(_("Join in Chat"),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2986 GAIM_CALLBACK(yahoo_chat_goto_menu),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2987 NULL, NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2988 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2989 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2990
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2991 act = gaim_menu_action_new(_("Initiate Conference"),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2992 GAIM_CALLBACK(yahoo_initiate_conference),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
2993 NULL, NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2994 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2995
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2996 if (yahoo_friend_get_game(f)) {
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2997 const char *game = yahoo_friend_get_game(f);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2998 char *room;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
2999 char *t;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3000
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3001 if ((room = strstr(game, "&follow="))) {/* skip ahead to the url */
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3002 while (*room && *room != '\t') /* skip to the tab */
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3003 room++;
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3004 t = room++; /* room as now at the name */
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3005 while (*t != '\n')
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3006 t++; /* replace the \n with a space */
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3007 *t = ' ';
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3008 g_snprintf(buf2, sizeof buf2, "%s", room);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3009
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3010 act = gaim_menu_action_new(buf2,
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3011 GAIM_CALLBACK(yahoo_game),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3012 NULL, NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3013 m = g_list_append(m, act);
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3014 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3015 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3016 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3017
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3018 if (f) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3019 act = gaim_menu_action_new(_("Presence Settings"), NULL, NULL,
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3020 build_presence_submenu(f, gc));
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3021 m = g_list_append(m, act);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3022 }
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3023
11800
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
3024 if (f) {
12919
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3025 act = gaim_menu_action_new(_("Start Doodling"),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3026 GAIM_CALLBACK(yahoo_doodle_blist_node),
248b8b39c671 [gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents: 12878
diff changeset
3027 NULL, NULL);
11800
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
3028 m = g_list_append(m, act);
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
3029 }
32bac0647037 [gaim-migrate @ 14091]
Gary Kramlich <grim@reaperworld.com>
parents: 11718
diff changeset
3030
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3031 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3032 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3033
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3034 static GList *yahoo_blist_node_menu(GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3035 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3036 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3037 return yahoo_buddy_menu((GaimBuddy *) node);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3038 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3039 return NULL;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3040 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3041 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3042
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
3043 static void yahoo_act_id(GaimConnection *gc, const char *entry)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3044 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3045 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3046
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3047 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3048 yahoo_packet_hash_str(pkt, 3, entry);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3049 yahoo_packet_send_and_free(pkt, yd);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3050
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
3051 gaim_connection_set_display_name(gc, entry);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3052 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3053
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3054 static void yahoo_show_act_id(GaimPluginAction *action)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3055 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3056 GaimConnection *gc = (GaimConnection *) action->context;
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
3057 gaim_request_input(gc, NULL, _("Active which ID?"), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8620
diff changeset
3058 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL,
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
3059 _("OK"), G_CALLBACK(yahoo_act_id),
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
3060 _("Cancel"), NULL, gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3061 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3062
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3063 static void yahoo_show_chat_goto(GaimPluginAction *action)
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3064 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3065 GaimConnection *gc = (GaimConnection *) action->context;
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3066 gaim_request_input(gc, NULL, _("Join who in chat?"), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8620
diff changeset
3067 "", FALSE, FALSE, NULL,
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3068 _("OK"), G_CALLBACK(yahoo_chat_goto),
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3069 _("Cancel"), NULL, gc);
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3070 }
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3071
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3072 static GList *yahoo_actions(GaimPlugin *plugin, gpointer context) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3073 GList *m = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3074 GaimPluginAction *act;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3075
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3076 act = gaim_plugin_action_new(_("Activate ID..."),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3077 yahoo_show_act_id);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3078 m = g_list_append(m, act);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3079
12243
d3cb077caf3e [gaim-migrate @ 14545]
Richard Laager <rlaager@wiktel.com>
parents: 12216
diff changeset
3080 act = gaim_plugin_action_new(_("Join User in Chat..."),
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3081 yahoo_show_chat_goto);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3082 m = g_list_append(m, act);
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
3083
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3084 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3085 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3086
12216
4d3119205a33 [gaim-migrate @ 14518]
Stu Tomlinson <stu@nosnilmot.com>
parents: 12206
diff changeset
3087 static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, GaimMessageFlags flags)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3088 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3089 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3090 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_MESSAGE, YAHOO_STATUS_OFFLINE, 0);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
3091 char *msg = yahoo_html_to_codes(what);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3092 char *msg2;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3093 gboolean utf8 = TRUE;
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11475
diff changeset
3094 GaimWhiteboard *wb;
9828
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3095 int ret = 1;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3096
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3097 msg2 = yahoo_string_encode(gc, msg, &utf8);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3098
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3099 yahoo_packet_hash(pkt, "ss", 1, gaim_connection_get_display_name(gc), 5, who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3100 if (utf8)
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3101 yahoo_packet_hash_str(pkt, 97, "1");
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3102 yahoo_packet_hash_str(pkt, 14, msg2);
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3103
11644
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
3104 /* If this message is to a user who is also Doodling with the local user,
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
3105 * format the chat packet with the correct IMV information (thanks Yahoo!)
f4e58e94ced3 [gaim-migrate @ 13922]
Mark Doliner <mark@kingant.net>
parents: 11643
diff changeset
3106 */
11506
88d504770c60 [gaim-migrate @ 13751]
Richard Laager <rlaager@wiktel.com>
parents: 11475
diff changeset
3107 wb = gaim_whiteboard_get_session(gc->account, (char*)who);
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3108 if (wb)
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3109 yahoo_packet_hash_str(pkt, 63, "doodle;11");
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3110 else
11801
81806e9241be [gaim-migrate @ 14092]
Gary Kramlich <grim@reaperworld.com>
parents: 11800
diff changeset
3111 yahoo_packet_hash_str(pkt, 63, ";0"); /* IMvironment */
11608
5e3f07172dab [gaim-migrate @ 13879]
Tim Ringenbach <marv@pidgin.im>
parents: 11522
diff changeset
3112
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3113 yahoo_packet_hash_str(pkt, 64, "0"); /* no idea */
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3114 yahoo_packet_hash_str(pkt, 1002, "1"); /* no idea, Yahoo 6 or later only it seems */
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3115 if (!yd->picture_url)
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3116 yahoo_packet_hash_str(pkt, 206, "0"); /* 0 = no picture, 2 = picture, maybe 1 = avatar? */
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3117 else
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3118 yahoo_packet_hash_str(pkt, 206, "2");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3119
9828
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3120 /* We may need to not send any packets over 2000 bytes, but I'm not sure yet. */
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3121 if ((YAHOO_PACKET_HDRLEN + yahoo_packet_length(pkt)) <= 2000)
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3122 yahoo_packet_send(pkt, yd);
9828
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3123 else
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3124 ret = -E2BIG;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3125
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3126 yahoo_packet_free(pkt);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
3127
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
3128 g_free(msg);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3129 g_free(msg2);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
3130
9828
e8334906b2fb [gaim-migrate @ 10699]
Tim Ringenbach <marv@pidgin.im>
parents: 9782
diff changeset
3131 return ret;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3132 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3133
13842
a9ff4499d9ce [gaim-migrate @ 16295]
Mark Doliner <mark@kingant.net>
parents: 13711
diff changeset
3134 static unsigned int yahoo_send_typing(GaimConnection *gc, const char *who, GaimTypingState state)
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3135 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3136 struct yahoo_data *yd = gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
3137 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3138 yahoo_packet_hash(pkt, "ssssss", 49, "TYPING", 1, gaim_connection_get_display_name(gc),
13842
a9ff4499d9ce [gaim-migrate @ 16295]
Mark Doliner <mark@kingant.net>
parents: 13711
diff changeset
3139 14, " ", 13, state == GAIM_TYPING ? "1" : "0",
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3140 5, who, 1002, "1");
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3141
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3142 yahoo_packet_send_and_free(pkt, yd);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3143
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
3144 return 0;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3145 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
3146
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
3147 static void yahoo_session_presence_remove(gpointer key, gpointer value, gpointer data)
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3148 {
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3149 YahooFriend *f = value;
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
3150 if (f && f->presence == YAHOO_PRESENCE_ONLINE)
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
3151 f->presence = YAHOO_PRESENCE_DEFAULT;
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3152 }
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3153
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3154 static void yahoo_set_status(GaimAccount *account, GaimStatus *status)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3155 {
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3156 GaimConnection *gc;
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3157 GaimPresence *presence;
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3158 struct yahoo_data *yd;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3159 struct yahoo_packet *pkt;
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3160 int old_status;
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3161 const char *msg = NULL;
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3162 char *tmp = NULL;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3163 char *conv_msg = NULL;
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3164
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3165 if (!gaim_status_is_active(status))
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3166 return;
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3167
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3168 gc = gaim_account_get_connection(account);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3169 presence = gaim_status_get_presence(status);
10400
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3170 yd = (struct yahoo_data *)gc->proto_data;
6a043ae92db6 [gaim-migrate @ 11631]
Sean Egan <seanegan@gmail.com>
parents: 10394
diff changeset
3171 old_status = yd->current_status;
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3172
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3173 yd->current_status = get_yahoo_status_from_gaim_status(status);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3174
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3175 if (yd->current_status == YAHOO_STATUS_CUSTOM)
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3176 {
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3177 msg = gaim_status_get_attr_string(status, "message");
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3178
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3179 if (gaim_status_is_available(status)) {
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3180 tmp = yahoo_string_encode(gc, msg, NULL);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3181 conv_msg = gaim_markup_strip_html(tmp);
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3182 g_free(tmp);
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3183 } else {
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3184 if ((msg == NULL) || (*msg == '\0'))
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3185 msg = _("Away");
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3186 tmp = yahoo_string_encode(gc, msg, NULL);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3187 conv_msg = gaim_markup_strip_html(tmp);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3188 g_free(tmp);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3189 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3190 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3191
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3192 if (yd->current_status == YAHOO_STATUS_INVISIBLE) {
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3193 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3194 yahoo_packet_hash_str(pkt, 13, "2");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3195 yahoo_packet_send_and_free(pkt, yd);
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3196
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3197 return;
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3198 }
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3199
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3200 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3201 yahoo_packet_hash_int(pkt, 10, yd->current_status);
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
3202
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3203 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3204 yahoo_packet_hash_str(pkt, 19, conv_msg);
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3205 } else {
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3206 yahoo_packet_hash_str(pkt, 19, "");
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3207 }
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3208
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3209 g_free(conv_msg);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3210
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3211 if (gaim_presence_is_idle(presence))
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3212 yahoo_packet_hash_str(pkt, 47, "2");
11972
73777ad45562 [gaim-migrate @ 14265]
Mark Doliner <mark@kingant.net>
parents: 11970
diff changeset
3213 else if (!gaim_status_is_available(status))
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3214 yahoo_packet_hash_str(pkt, 47, "1");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3215
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3216 yahoo_packet_send_and_free(pkt, yd);
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3217
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3218 if (old_status == YAHOO_STATUS_INVISIBLE) {
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3219 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_VISIBLE_TOGGLE, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3220 yahoo_packet_hash_str(pkt, 13, "1");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3221 yahoo_packet_send_and_free(pkt, yd);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3222
12010
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
3223 /* Any per-session presence settings are removed */
b41b75f709e4 [gaim-migrate @ 14303]
Mark Doliner <mark@kingant.net>
parents: 11985
diff changeset
3224 g_hash_table_foreach(yd->friends, yahoo_session_presence_remove, NULL);
10989
b4919e8c634c [gaim-migrate @ 12827]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 10963
diff changeset
3225
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3226 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3227 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3228
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
3229 static void yahoo_set_idle(GaimConnection *gc, int idle)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3230 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3231 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3232 struct yahoo_packet *pkt = NULL;
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
3233 char *msg = NULL, *msg2 = NULL;
13558
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3234 GaimStatus *status = NULL;
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3235
13686
2d31d61f572c [gaim-migrate @ 16089]
Richard Laager <rlaager@wiktel.com>
parents: 13558
diff changeset
3236 if (idle && yd->current_status != YAHOO_STATUS_CUSTOM)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3237 yd->current_status = YAHOO_STATUS_IDLE;
13558
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3238 else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3239 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc)));
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3240 yd->current_status = get_yahoo_status_from_gaim_status(status);
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3241 }
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3242
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3243 pkt = yahoo_packet_new(YAHOO_SERVICE_Y6_STATUS_UPDATE, YAHOO_STATUS_AVAILABLE, 0);
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3244
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3245 yahoo_packet_hash_int(pkt, 10, yd->current_status);
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3246 if (yd->current_status == YAHOO_STATUS_CUSTOM) {
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3247 const char *tmp;
13558
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3248 if (status == NULL)
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3249 status = gaim_presence_get_active_status(gaim_account_get_presence(gaim_connection_get_account(gc)));
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3250 tmp = gaim_status_get_attr_string(status, "message");
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3251 if (tmp != NULL) {
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3252 msg = yahoo_string_encode(gc, tmp, NULL);
11640
c36adfe4dc57 [gaim-migrate @ 13917]
Mark Doliner <mark@kingant.net>
parents: 11635
diff changeset
3253 msg2 = gaim_markup_strip_html(msg);
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3254 yahoo_packet_hash_str(pkt, 19, msg2);
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3255 } else {
13558
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3256 /* get_yahoo_status_from_gaim_status() returns YAHOO_STATUS_CUSTOM for
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3257 * the generic away state (YAHOO_STATUS_TYPE_AWAY) with no message */
a0969be53e17 [gaim-migrate @ 15937]
Evan Schoenberg <evan.s@dreskin.net>
parents: 13461
diff changeset
3258 yahoo_packet_hash_str(pkt, 19, _("Away"));
10504
1a97d5e88d12 [gaim-migrate @ 11796]
Stu Tomlinson <stu@nosnilmot.com>
parents: 10401
diff changeset
3259 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
3260 } else {
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3261 yahoo_packet_hash_str(pkt, 19, "");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3262 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3263
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3264 if (idle)
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3265 yahoo_packet_hash_str(pkt, 47, "2");
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3266 else if (!gaim_presence_is_available(gaim_account_get_presence(gaim_connection_get_account(gc))))
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3267 yahoo_packet_hash_str(pkt, 47, "1");
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3268
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3269 yahoo_packet_send_and_free(pkt, yd);
10373
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3270
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3271 g_free(msg);
35068a87b59d [gaim-migrate @ 11598]
Tim Ringenbach <marv@pidgin.im>
parents: 10246
diff changeset
3272 g_free(msg2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3273 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3274
9979
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3275 static GList *yahoo_status_types(GaimAccount *account)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3276 {
9979
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3277 GaimStatusType *type;
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3278 GList *types = NULL;
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3279
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3280 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AVAILABLE, YAHOO_STATUS_TYPE_AVAILABLE,
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3281 NULL, TRUE, TRUE, FALSE,
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3282 "message", _("Message"),
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3283 gaim_value_new(GAIM_TYPE_STRING), NULL);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3284 types = g_list_append(types, type);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3285
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3286 type = gaim_status_type_new_with_attrs(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_AWAY,
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3287 NULL, TRUE, TRUE, FALSE,
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3288 "message", _("Message"),
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3289 gaim_value_new(GAIM_TYPE_STRING), NULL);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3290 types = g_list_append(types, type);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3291
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3292 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_BRB, _("Be Right Back"), TRUE);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3293 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3294
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3295 type = gaim_status_type_new(GAIM_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_BUSY, _("Busy"), TRUE);
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3296 types = g_list_append(types, type);
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3297
12489
12db50600de5 [gaim-migrate @ 14801]
Mark Doliner <mark@kingant.net>
parents: 12467
diff changeset
3298 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATHOME, _("Not at Home"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3299 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3300
12489
12db50600de5 [gaim-migrate @ 14801]
Mark Doliner <mark@kingant.net>
parents: 12467
diff changeset
3301 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTATDESK, _("Not at Desk"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3302 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3303
12489
12db50600de5 [gaim-migrate @ 14801]
Mark Doliner <mark@kingant.net>
parents: 12467
diff changeset
3304 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_NOTINOFFICE, _("Not in Office"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3305 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3306
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3307 type = gaim_status_type_new(GAIM_STATUS_UNAVAILABLE, YAHOO_STATUS_TYPE_ONPHONE, _("On the Phone"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3308 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3309
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3310 type = gaim_status_type_new(GAIM_STATUS_EXTENDED_AWAY, YAHOO_STATUS_TYPE_ONVACATION, _("On Vacation"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3311 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3312
12489
12db50600de5 [gaim-migrate @ 14801]
Mark Doliner <mark@kingant.net>
parents: 12467
diff changeset
3313 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_OUTTOLUNCH, _("Out to Lunch"), TRUE);
12206
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3314 types = g_list_append(types, type);
d345299ff3bc [gaim-migrate @ 14508]
Luke Schierer <lschiere@pidgin.im>
parents: 12203
diff changeset
3315
12203
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
3316 type = gaim_status_type_new(GAIM_STATUS_AWAY, YAHOO_STATUS_TYPE_STEPPEDOUT, _("Stepped Out"), TRUE);
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
3317 types = g_list_append(types, type);
0aeda1869b32 [gaim-migrate @ 14505]
Luke Schierer <lschiere@pidgin.im>
parents: 12152
diff changeset
3318
11970
8f8b4d1ac26e [gaim-migrate @ 14263]
Mark Doliner <mark@kingant.net>
parents: 11969
diff changeset
3319
12595
3169cd6727ad [gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents: 12489
diff changeset
3320 type = gaim_status_type_new(GAIM_STATUS_INVISIBLE, YAHOO_STATUS_TYPE_INVISIBLE, NULL, TRUE);
9979
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3321 types = g_list_append(types, type);
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3322
12658
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12645
diff changeset
3323 type = gaim_status_type_new(GAIM_STATUS_OFFLINE, YAHOO_STATUS_TYPE_OFFLINE, NULL, TRUE);
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12645
diff changeset
3324 types = g_list_append(types, type);
a0fd3ebcd6fa [gaim-migrate @ 15001]
Mark Doliner <mark@kingant.net>
parents: 12645
diff changeset
3325
9979
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3326 return types;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3327 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3328
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
3329 static void yahoo_keepalive(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3330 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3331 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3332 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3333 yahoo_packet_send_and_free(pkt, yd);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3334
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3335 if (!yd->chat_online)
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3336 return;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3337
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3338 if (yd->wm) {
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3339 ycht_chat_send_keepalive(yd->ycht);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3340 return;
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3341 }
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3342
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3343 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3344 yahoo_packet_hash_str(pkt, 109, gaim_connection_get_display_name(gc));
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3345 yahoo_packet_send_and_free(pkt, yd);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3346 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3347
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3348 /* XXX - What's the deal with GaimGroup *foo? */
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3349 static void yahoo_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *foo)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3350 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3351 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3352 struct yahoo_packet *pkt;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
3353 GaimGroup *g;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3354 char *group = NULL;
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
3355 char *group2 = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3356
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3357 if (!yd->logged_in)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3358 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3359
10963
ad9f6c032092 [gaim-migrate @ 12768]
Mark Doliner <mark@kingant.net>
parents: 10944
diff changeset
3360 if (!yahoo_privacy_check(gc, gaim_buddy_get_name(buddy)))
ad9f6c032092 [gaim-migrate @ 12768]
Mark Doliner <mark@kingant.net>
parents: 10944
diff changeset
3361 return;
ad9f6c032092 [gaim-migrate @ 12768]
Mark Doliner <mark@kingant.net>
parents: 10944
diff changeset
3362
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3363 if (foo)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3364 group = foo->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3365 if (!group) {
12088
980c877bd238 [gaim-migrate @ 14385]
Mark Doliner <mark@kingant.net>
parents: 12010
diff changeset
3366 g = gaim_buddy_get_group(gaim_find_buddy(gc->account, buddy->name));
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3367 if (g)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3368 group = g->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3369 else
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3370 group = "Buddies";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3371 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3372
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
3373 group2 = yahoo_string_encode(gc, group, NULL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3374 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3375 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3376 7, buddy->name, 65, group2, 14, "");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3377 yahoo_packet_send_and_free(pkt, yd);
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
3378 g_free(group2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3379 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3380
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3381 static void yahoo_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3382 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3383 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
3384 struct yahoo_packet *pkt;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3385 GSList *buddies, *l;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3386 GaimGroup *g;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3387 gboolean remove = TRUE;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3388 char *cg;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
3389
13711
967ef719cb62 [gaim-migrate @ 16115]
Richard Laager <rlaager@wiktel.com>
parents: 13705
diff changeset
3390 if (!(yahoo_friend_find(gc, buddy->name)))
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
3391 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
3392
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3393 buddies = gaim_find_buddies(gaim_connection_get_account(gc), buddy->name);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3394 for (l = buddies; l; l = l->next) {
12088
980c877bd238 [gaim-migrate @ 14385]
Mark Doliner <mark@kingant.net>
parents: 12010
diff changeset
3395 g = gaim_buddy_get_group(l->data);
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3396 if (gaim_utf8_strcasecmp(group->name, g->name)) {
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3397 remove = FALSE;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3398 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3399 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3400 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3401
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3402 g_slist_free(buddies);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3403
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
3404 if (remove)
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3405 g_hash_table_remove(yd->friends, buddy->name);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3406
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3407 cg = yahoo_string_encode(gc, group->name, NULL);
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
3408 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3409 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3410 7, buddy->name, 65, cg);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3411 yahoo_packet_send_and_free(pkt, yd);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3412 g_free(cg);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3413 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3414
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3415 static void yahoo_add_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3416 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3417 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3418
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3419 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3420 return;
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
3421 /* It seems to work better without this */
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
3422
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3423 /* if (gc->account->perm_deny != 4)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3424 return; */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3425
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3426 if (!who || who[0] == '\0')
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3427 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3428
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3429 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3430 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3431 7, who, 13, "1");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3432 yahoo_packet_send_and_free(pkt, yd);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3433 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3434
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3435 static void yahoo_rem_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3436 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3437 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3438
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3439 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3440 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3441
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3442 if (!who || who[0] == '\0')
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3443 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3444
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3445 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3446 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 13, "2");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3447 yahoo_packet_send_and_free(pkt, yd);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3448 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3449
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3450 static void yahoo_set_permit_deny(GaimConnection *gc) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3451 GaimAccount *acct;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3452 GSList *deny;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3453
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3454 acct = gc->account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3455
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3456 switch (acct->perm_deny) {
10105
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3457 /* privacy 1 */
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3458 case GAIM_PRIVACY_ALLOW_ALL:
10143
c0ea78153d6f [gaim-migrate @ 11214]
Tim Ringenbach <marv@pidgin.im>
parents: 10141
diff changeset
3459 for (deny = acct->deny;deny;deny = deny->next)
c0ea78153d6f [gaim-migrate @ 11214]
Tim Ringenbach <marv@pidgin.im>
parents: 10141
diff changeset
3460 yahoo_rem_deny(gc, deny->data);
c0ea78153d6f [gaim-migrate @ 11214]
Tim Ringenbach <marv@pidgin.im>
parents: 10141
diff changeset
3461 break;
10105
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3462 /* privacy 3 */
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3463 case GAIM_PRIVACY_ALLOW_USERS:
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3464 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3465 yahoo_rem_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3466 break;
10105
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3467 /* privacy 5 */
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3468 case GAIM_PRIVACY_ALLOW_BUDDYLIST:
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3469 /* privacy 4 */
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3470 case GAIM_PRIVACY_DENY_USERS:
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3471 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3472 yahoo_add_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3473 break;
10105
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3474 /* privacy 2 */
e94f5975a4df [gaim-migrate @ 11135]
Tim Ringenbach <marv@pidgin.im>
parents: 10070
diff changeset
3475 case GAIM_PRIVACY_DENY_ALL:
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3476 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3477 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3478 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3479 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3480
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3481 static gboolean yahoo_unload_plugin(GaimPlugin *plugin)
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3482 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3483 yahoo_dest_colorht();
11033
50224ac8184d [gaim-migrate @ 12919]
Etan Reisner <pidgin@unreliablesource.net>
parents: 10992
diff changeset
3484
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3485 return TRUE;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3486 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3487
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3488 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3489 const char *old_group, const char *new_group)
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3490 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3491 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3492 struct yahoo_packet *pkt;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3493 char *gpn, *gpo;
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3494
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3495 /* Step 0: If they aren't on the server list anyway,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3496 * don't bother letting the server know.
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3497 */
9279
1eaa4d8dcf26 [gaim-migrate @ 10082]
Tim Ringenbach <marv@pidgin.im>
parents: 9278
diff changeset
3498 if (!yahoo_friend_find(gc, who))
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3499 return;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3500
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3501 /* If old and new are the same, we would probably
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3502 * end up deleting the buddy, which would be bad.
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3503 * This might happen because of the charset conversation.
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3504 */
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3505 gpn = yahoo_string_encode(gc, new_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3506 gpo = yahoo_string_encode(gc, old_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3507 if (!strcmp(gpn, gpo)) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3508 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3509 g_free(gpo);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3510 return;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3511 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3512
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3513 /* Step 1: Add buddy to new group. */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3514 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3515 yahoo_packet_hash(pkt, "ssss", 1, gaim_connection_get_display_name(gc),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3516 7, who, 65, gpn, 14, "");
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3517 yahoo_packet_send_and_free(pkt, yd);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3518
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3519 /* Step 2: Remove buddy from old group */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3520 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3521 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc), 7, who, 65, gpo);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3522 yahoo_packet_send_and_free(pkt, yd);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3523 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3524 g_free(gpo);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3525 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3526
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3527 static void yahoo_rename_group(GaimConnection *gc, const char *old_name,
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3528 GaimGroup *group, GList *moved_buddies)
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3529 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3530 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3531 struct yahoo_packet *pkt;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3532 char *gpn, *gpo;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3533
9285
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3534 gpn = yahoo_string_encode(gc, group->name, NULL);
7a8aa87164ae [gaim-migrate @ 10088]
Mark Doliner <mark@kingant.net>
parents: 9284
diff changeset
3535 gpo = yahoo_string_encode(gc, old_name, NULL);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3536 if (!strcmp(gpn, gpo)) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3537 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3538 g_free(gpo);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3539 return;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3540 }
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3541
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3542 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
10394
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3543 yahoo_packet_hash(pkt, "sss", 1, gaim_connection_get_display_name(gc),
45a0a07e8b25 [gaim-migrate @ 11623]
Tim Ringenbach <marv@pidgin.im>
parents: 10392
diff changeset
3544 65, gpo, 67, gpn);
10392
a8f9e5ce4f92 [gaim-migrate @ 11620]
Tim Ringenbach <marv@pidgin.im>
parents: 10386
diff changeset
3545 yahoo_packet_send_and_free(pkt, yd);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3546 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3547 g_free(gpo);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3548 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3549
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
3550 /********************************* Commands **********************************/
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
3551
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3552 static GaimCmdRet
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3553 yahoogaim_cmd_buzz(GaimConversation *c, const gchar *cmd, gchar **args, gchar **error, void *data) {
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3554
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3555 GaimAccount *account = gaim_conversation_get_account(c);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3556 const char *username = gaim_account_get_username(account);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3557
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3558 if (*args && args[0])
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3559 return GAIM_CMD_RET_FAILED;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3560
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3561 gaim_debug(GAIM_DEBUG_INFO, "yahoo",
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3562 "Sending <ding> on account %s to buddy %s.\n", username, c->name);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3563 gaim_conv_im_send(GAIM_CONV_IM(c), "<ding>");
11615
a9c5fcce537b [gaim-migrate @ 13889]
Tim Ringenbach <marv@pidgin.im>
parents: 11608
diff changeset
3564 gaim_conv_im_write(GAIM_CONV_IM(c), "", _("Buzz!!"), GAIM_MESSAGE_NICK|GAIM_MESSAGE_SEND, time(NULL));
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3565 return GAIM_CMD_RET_OK;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3566 }
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3567
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3568 static GaimPlugin *my_protocol = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3569
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3570 static GaimCmdRet
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3571 yahoogaim_cmd_chat_join(GaimConversation *conv, const char *cmd,
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3572 char **args, char **error, void *data)
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3573 {
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3574 GHashTable *comp;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3575 GaimConnection *gc;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3576 struct yahoo_data *yd;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3577 int id;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3578
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3579 if (!args || !args[0])
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3580 return GAIM_CMD_RET_FAILED;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3581
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3582 gc = gaim_conversation_get_gc(conv);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3583 yd = gc->proto_data;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3584 id = yd->conf_id;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3585 gaim_debug(GAIM_DEBUG_INFO, "yahoo",
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3586 "Trying to join %s \n", args[0]);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3587
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3588 comp = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3589 g_hash_table_replace(comp, g_strdup("room"),
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3590 g_strdup_printf("%s", g_ascii_strdown(args[0], strlen(args[0]))));
11077
9f526e2e511e [gaim-migrate @ 13087]
Mark Doliner <mark@kingant.net>
parents: 11076
diff changeset
3591 g_hash_table_replace(comp, g_strdup("type"), g_strdup("Chat"));
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3592
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3593 yahoo_c_join(gc, comp);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3594
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3595 g_hash_table_destroy(comp);
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3596 return GAIM_CMD_RET_OK;
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3597 }
12645
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3598
13041
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3599 static GaimCmdRet
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3600 yahoogaim_cmd_chat_list(GaimConversation *conv, const char *cmd,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3601 char **args, char **error, void *data)
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3602 {
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3603 GaimAccount *account = gaim_conversation_get_account(conv);
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3604 if (*args && args[0])
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3605 return GAIM_CMD_RET_FAILED;
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3606 gaim_roomlist_show_with_account(account);
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3607 return GAIM_CMD_RET_OK;
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3608 }
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3609
12645
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3610 static gboolean yahoo_offline_message(const GaimBuddy *buddy)
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3611 {
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3612 return TRUE;
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3613 }
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3614
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3615 /************************** Plugin Initialization ****************************/
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3616 static void
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3617 yahoogaim_register_commands(void)
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3618 {
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3619 gaim_cmd_register("join", "s", GAIM_CMD_P_PRPL,
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3620 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT |
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3621 GAIM_CMD_FLAG_PRPL_ONLY,
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3622 "prpl-yahoo", yahoogaim_cmd_chat_join,
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3623 _("join &lt;room&gt;: Join a chat room on the Yahoo network"), NULL);
13041
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3624 gaim_cmd_register("list", "", GAIM_CMD_P_PRPL,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3625 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT |
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3626 GAIM_CMD_FLAG_PRPL_ONLY,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3627 "prpl-yahoo", yahoogaim_cmd_chat_list,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3628 _("list: List rooms on the Yahoo network"), NULL);
10121
bde7418a2573 [gaim-migrate @ 11158]
Tim Ringenbach <marv@pidgin.im>
parents: 10119
diff changeset
3629 gaim_cmd_register("buzz", "", GAIM_CMD_P_PRPL,
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3630 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY,
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3631 "prpl-yahoo", yahoogaim_cmd_buzz,
12318
e346a085bb4f [gaim-migrate @ 14622]
Richard Laager <rlaager@wiktel.com>
parents: 12243
diff changeset
3632 _("buzz: Buzz a user to get their attention"), NULL);
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3633 gaim_cmd_register("doodle", "", GAIM_CMD_P_PRPL,
13041
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3634 GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_PRPL_ONLY,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3635 "prpl-yahoo", yahoo_doodle_gaim_cmd_start,
465c7e1dfc7b [gaim-migrate @ 15400]
Richard Laager <rlaager@wiktel.com>
parents: 13021
diff changeset
3636 _("doodle: Request user to start a Doodle session"), NULL);
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3637 }
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3638
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3639 static GaimWhiteboardPrplOps yahoo_whiteboard_prpl_ops =
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3640 {
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3641 yahoo_doodle_start,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3642 yahoo_doodle_end,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3643 yahoo_doodle_get_dimensions,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3644 NULL,
11914
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
3645 yahoo_doodle_get_brush,
2219f4bf4a57 [gaim-migrate @ 14205]
Richard Laager <rlaager@wiktel.com>
parents: 11897
diff changeset
3646 yahoo_doodle_set_brush,
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3647 yahoo_doodle_send_draw_list,
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3648 yahoo_doodle_clear
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3649 };
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3650
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3651 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3652 {
9308
b3bda982996b [gaim-migrate @ 10116]
Sean Egan <seanegan@gmail.com>
parents: 9306
diff changeset
3653 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3654 NULL, /* user_splits */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3655 NULL, /* protocol_options */
9318
01c50436203e [gaim-migrate @ 10126]
Nathan Walp <nwalp@pidgin.im>
parents: 9310
diff changeset
3656 {"png", 96, 96, 96, 96, GAIM_ICON_SCALE_SEND},
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3657 yahoo_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3658 yahoo_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3659 yahoo_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3660 yahoo_tooltip_text,
9979
920f6a5bcb4a [gaim-migrate @ 10890]
Tim Ringenbach <marv@pidgin.im>
parents: 9972
diff changeset
3661 yahoo_status_types,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3662 yahoo_blist_node_menu,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3663 yahoo_c_info,
9768
ea1f457b7fef [gaim-migrate @ 10636]
Luke Schierer <lschiere@pidgin.im>
parents: 9757
diff changeset
3664 yahoo_c_info_defaults,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3665 yahoo_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3666 yahoo_close,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3667 yahoo_send_im,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3668 NULL, /* set info */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3669 yahoo_send_typing,
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3670 yahoo_get_info,
9984
e4a032202d49 [gaim-migrate @ 10895]
Tim Ringenbach <marv@pidgin.im>
parents: 9983
diff changeset
3671 yahoo_set_status,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3672 yahoo_set_idle,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3673 NULL, /* change_passwd*/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3674 yahoo_add_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3675 NULL, /* add_buddies */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3676 yahoo_remove_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3677 NULL, /*remove_buddies */
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
3678 yahoo_add_permit,
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3679 yahoo_add_deny,
10937
ca3e0882d377 [gaim-migrate @ 12721]
Mark Doliner <mark@kingant.net>
parents: 10784
diff changeset
3680 yahoo_rem_permit,
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3681 yahoo_rem_deny,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3682 yahoo_set_permit_deny,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3683 yahoo_c_join,
8562
e3c059c3d92d [gaim-migrate @ 9306]
Luke Schierer <lschiere@pidgin.im>
parents: 8503
diff changeset
3684 NULL, /* reject chat invite */
9917
e74eb0d11f86 [gaim-migrate @ 10809]
Luke Schierer <lschiere@pidgin.im>
parents: 9888
diff changeset
3685 yahoo_get_chat_name,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3686 yahoo_c_invite,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3687 yahoo_c_leave,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3688 NULL, /* chat whisper */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3689 yahoo_c_send,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3690 yahoo_keepalive,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3691 NULL, /* register_user */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3692 NULL, /* get_cb_info */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3693 NULL, /* get_cb_away */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3694 NULL, /* alias_buddy */
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3695 yahoo_change_buddys_group,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3696 yahoo_rename_group,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3697 NULL, /* buddy_free */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3698 NULL, /* convo_closed */
11153
8e600ee6ec61 [gaim-migrate @ 13235]
Mark Doliner <mark@kingant.net>
parents: 11144
diff changeset
3699 gaim_normalize_nocase, /* normalize */
9306
04a3e9e869ee [gaim-migrate @ 10114]
Tim Ringenbach <marv@pidgin.im>
parents: 9292
diff changeset
3700 yahoo_set_buddy_icon,
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3701 NULL, /* void (*remove_group)(GaimConnection *gc, const char *group);*/
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3702 NULL, /* char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who); */
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9466
diff changeset
3703 NULL, /* set_chat_topic */
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9466
diff changeset
3704 NULL, /* find_blist_chat */
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3705 yahoo_roomlist_get_list,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3706 yahoo_roomlist_cancel,
9466
d27156c9c876 [gaim-migrate @ 10291]
Luke Schierer <lschiere@pidgin.im>
parents: 9410
diff changeset
3707 yahoo_roomlist_expand_category,
9475
7a65fdba750f [gaim-migrate @ 10300]
Luke Schierer <lschiere@pidgin.im>
parents: 9466
diff changeset
3708 NULL, /* can_receive_file */
11475
7fab28c991f3 [gaim-migrate @ 13717]
Gary Kramlich <grim@reaperworld.com>
parents: 11338
diff changeset
3709 yahoo_send_file,
12143
cbebda5f019c [gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents: 12138
diff changeset
3710 yahoo_new_xfer,
12645
fc28451f5d96 [gaim-migrate @ 14983]
Richard Laager <rlaager@wiktel.com>
parents: 12600
diff changeset
3711 yahoo_offline_message, /* offline_message */
12600
e856f985a0b9 [gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents: 12595
diff changeset
3712 &yahoo_whiteboard_prpl_ops,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3713 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3714
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3715 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3716 {
9943
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
3717 GAIM_PLUGIN_MAGIC,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
3718 GAIM_MAJOR_VERSION,
f8e395a054e2 [gaim-migrate @ 10835]
Nathan Walp <nwalp@pidgin.im>
parents: 9927
diff changeset
3719 GAIM_MINOR_VERSION,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3720 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3721 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3722 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3723 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3724 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3725 "prpl-yahoo", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3726 "Yahoo", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3727 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3728 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3729 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3730 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3731 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3732 NULL, /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6321
diff changeset
3733 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3734 NULL, /**< load */
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3735 yahoo_unload_plugin, /**< unload */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3736 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3737 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
3738 &prpl_info, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
3739 NULL,
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3740 yahoo_actions
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3741 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3742
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3743 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
3744 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3745 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
3746 GaimAccountOption *option;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3747
9164
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3748 option = gaim_account_option_bool_new(_("Yahoo Japan"), "yahoojp", FALSE);
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3749 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3750
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3751 option = gaim_account_option_string_new(_("Pager server"), "server", YAHOO_PAGER_HOST);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3752 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3753
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3754 option = gaim_account_option_string_new(_("Japan Pager server"), "serverjp", YAHOOJP_PAGER_HOST);
9164
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3755 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3756
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3757 option = gaim_account_option_int_new(_("Pager port"), "port", YAHOO_PAGER_PORT);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3758 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3759
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3760 option = gaim_account_option_string_new(_("File transfer server"), "xfer_host", YAHOO_XFER_HOST);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3761 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3762
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3763 option = gaim_account_option_string_new(_("Japan file transfer server"), "xferjp_host", YAHOOJP_XFER_HOST);
9164
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3764 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
76125b842b23 [gaim-migrate @ 9949]
Tim Ringenbach <marv@pidgin.im>
parents: 9161
diff changeset
3765
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3766 option = gaim_account_option_int_new(_("File transfer port"), "xfer_port", YAHOO_XFER_PORT);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3767 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3768
12152
cda86ce5b026 [gaim-migrate @ 14453]
Richard Laager <rlaager@wiktel.com>
parents: 12143
diff changeset
3769 option = gaim_account_option_string_new(_("Chat room locale"), "room_list_locale", YAHOO_ROOMLIST_LOCALE);
11043
629cbfd1ed6d [gaim-migrate @ 12957]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
3770 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
12999
68db2c40efb2 [gaim-migrate @ 15352]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12994
diff changeset
3771
68db2c40efb2 [gaim-migrate @ 15352]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12994
diff changeset
3772 option = gaim_account_option_bool_new(_("Ignore conference and chatroom invitations"), "ignore_invites", FALSE);
68db2c40efb2 [gaim-migrate @ 15352]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12994
diff changeset
3773 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
68db2c40efb2 [gaim-migrate @ 15352]
Daniel Atallah <daniel.atallah@gmail.com>
parents: 12994
diff changeset
3774
11043
629cbfd1ed6d [gaim-migrate @ 12957]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
3775 #if 0
12152
cda86ce5b026 [gaim-migrate @ 14453]
Richard Laager <rlaager@wiktel.com>
parents: 12143
diff changeset
3776 option = gaim_account_option_string_new(_("Chat room list URL"), "room_list", YAHOO_ROOMLIST_URL);
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3777 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
11043
629cbfd1ed6d [gaim-migrate @ 12957]
Richard Laager <rlaager@wiktel.com>
parents: 11033
diff changeset
3778
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3779 option = gaim_account_option_string_new(_("Yahoo Chat server"), "ycht-server", YAHOO_YCHT_HOST);
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3780 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3781
13705
2f7b356812bc [gaim-migrate @ 16108]
Richard Laager <rlaager@wiktel.com>
parents: 13686
diff changeset
3782 option = gaim_account_option_int_new(_("Yahoo Chat port"), "ycht-port", YAHOO_YCHT_PORT);
9376
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3783 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3784 #endif
3aa848ccf986 [gaim-migrate @ 10184]
Tim Ringenbach <marv@pidgin.im>
parents: 9371
diff changeset
3785
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3786 my_protocol = plugin;
10119
2a2cd2a6f7cf [gaim-migrate @ 11156]
Tim Ringenbach <marv@pidgin.im>
parents: 10105
diff changeset
3787 yahoogaim_register_commands();
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3788 yahoo_init_colorht();
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3789 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3790
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
3791 GAIM_INIT_PLUGIN(yahoo, init_plugin, info);