annotate src/protocols/yahoo/yahoo.c @ 9041:812e7aa7eafa

[gaim-migrate @ 9817] nosnilmot wrote: " Yahoo & MSN support a subset of formatting which does not include sending descriptions with links. This patch adds a connection flag GAIM_CONNECTION_NO_URLDESC to allow prpls to specify this limitation (and modifies Yahoo & MSN to do so) It also adds GTK_IMHTML_LINKDESC to the GtkIMHtmlButtons enum (I pondered over this, then realized it's referred to as "format_functions" in some places, so probably could be renamed to GtkIMHtmlOptions or something) This combination allows the GtkIMHtmlToolbar to intelligently ask for only a URL if a description is not supported. One slightly unfortunate side effect is it makes bug 955538 much more prominent on Yahoo" committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sun, 23 May 2004 21:40:58 +0000
parents 7ab20f829190
children c6d32e1c0120
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 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
23 #include "internal.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
24
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
25 #include "account.h"
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
26 #include "accountopt.h"
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
27 #include "blist.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
28 #include "debug.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
29 #include "notify.h"
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
30 #include "privacy.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
31 #include "prpl.h"
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
32 #include "proxy.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
33 #include "request.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
34 #include "server.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
35 #include "util.h"
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
36
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
37 #include "sha.h"
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
38 #include "yahoo.h"
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
39 #include "yahoochat.h"
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
40 #include "yahoo_auth.h"
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
41 #include "yahoo_filexfer.h"
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
42 #include "md5.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
43
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
44 extern char *yahoo_crypt(const char *, const char *);
2795
536bb833fdeb [gaim-migrate @ 2808]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2786
diff changeset
45
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
46 typedef struct
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
47 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
48 GaimConnection *gc;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
49 char *name;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
50 } YahooGetInfoData;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
51
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
52
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
53 /* #define YAHOO_DEBUG */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
6791
9927df765fae [gaim-migrate @ 7330]
Luke Schierer <lschiere@pidgin.im>
parents: 6787
diff changeset
55 static void yahoo_add_buddy(GaimConnection *gc, const char *who, GaimGroup *);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
56
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
57 static struct yahoo_friend *yahoo_friend_new(void)
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
58 {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
59 struct yahoo_friend *ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
60
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
61 ret = g_new0(struct yahoo_friend, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
62 ret->status = YAHOO_STATUS_OFFLINE;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
63
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
64 return ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
65 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
66
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
67 static void yahoo_friend_free(gpointer p)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
68 {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
69 struct yahoo_friend *f = p;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
70 if (f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
71 g_free(f->msg);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
72 if (f->game)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
73 g_free(f->game);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
74 g_free(f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
75 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
76
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
77 struct yahoo_packet *yahoo_packet_new(enum yahoo_service service, enum yahoo_status status, int id)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
78 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
79 struct yahoo_packet *pkt = g_new0(struct yahoo_packet, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
80
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
81 pkt->service = service;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
82 pkt->status = status;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
83 pkt->id = id;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
84
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
85 return pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
86 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
87
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
88 void yahoo_packet_hash(struct yahoo_packet *pkt, int key, const char *value)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
89 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
90 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 pair->key = key;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92 pair->value = g_strdup(value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 pkt->hash = g_slist_append(pkt->hash, pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
96 int yahoo_packet_length(struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 GSList *l;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
100 int len = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
101
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 int tmp = pair->key;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 do {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107 tmp /= 10;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 len++;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 } while (tmp);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 len += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111 len += strlen(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 len += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 return len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 static void yahoo_packet_read(struct yahoo_packet *pkt, guchar *data, int len)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 while (pos + 1 < len) {
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
124 char key[64], *value = NULL, *esc;
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
125 int accept;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 int x;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
127
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
128 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
129
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
130 x = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 while (pos + 1 < len) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 break;
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
134 if (x >= sizeof(key)-1) {
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
135 x++;
8357
1f56ea865926 [gaim-migrate @ 9081]
Luke Schierer <lschiere@pidgin.im>
parents: 8349
diff changeset
136 pos++;
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
137 continue;
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
138 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 key[x++] = data[pos++];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 }
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
141 if (x >= sizeof(key)-1) {
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
142 x = 0;
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
143 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 key[x] = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 pair->key = strtol(key, NULL, 10);
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
147 accept = x; /* if x is 0 there was no key, so don't accept it */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
149 if (len - pos + 1 <= 0) {
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
150 /* Truncated. Garbage or something. */
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
151 accept = 0;
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
152 }
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
153
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
154 if (accept) {
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
155 value = g_malloc(len - pos + 1);
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
156 x = 0;
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
157 while (pos + 1 < len) {
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
158 if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
159 break;
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
160 value[x++] = data[pos++];
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
161 }
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
162 value[x] = 0;
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
163 pair->value = g_strdup(value);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
164 g_free(value);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
165 pkt->hash = g_slist_append(pkt->hash, pair);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
166 esc = g_strescape(pair->value, NULL);
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
167 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
168 "Key: %d \tValue: %s\n", pair->key, esc);
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
169 g_free(esc);
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
170 } else {
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
171 g_free(pair);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
172 }
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
173 pos += 2;
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
174
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
175 /* Skip over garbage we've noticed in the mail notifications */
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
176 if (data[0] == '9' && data[pos] == 0x01)
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
177 pos++;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
178 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
179 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
180
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
181 void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
182 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
183 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
184 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
185
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
186 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
187 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
188 guchar buf[100];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
189
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
190 g_snprintf(buf, sizeof(buf), "%d", pair->key);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
191 strcpy(data + pos, buf);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
192 pos += strlen(buf);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
193 data[pos++] = 0xc0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
194 data[pos++] = 0x80;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
195
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
196 strcpy(data + pos, pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
197 pos += strlen(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
198 data[pos++] = 0xc0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
199 data[pos++] = 0x80;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
200
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
201 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
202 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
203 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
204
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
205 static void yahoo_packet_dump(guchar *data, int len)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207 #ifdef YAHOO_DEBUG
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 int i;
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
209
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
210 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
211
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 for (i = 0; i + 1 < len; i += 2) {
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
213 if ((i % 16 == 0) && i) {
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
214 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
215 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
216 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
217
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
218 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02x%02x ", data[i], data[i + 1]);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 if (i < len)
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
221 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02x", data[i]);
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
222
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
223 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
224 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
225
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226 for (i = 0; i < len; i++) {
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
227 if ((i % 16 == 0) && i) {
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
228 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
229 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
230 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
231
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
232 if (g_ascii_isprint(data[i]))
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
233 gaim_debug(GAIM_DEBUG_MISC, NULL, "%c ", data[i]);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 else
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
235 gaim_debug(GAIM_DEBUG_MISC, NULL, ". ");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
236 }
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
237
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
238 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
239 #endif
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
240 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
241
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
242 int yahoo_send_packet(struct yahoo_data *yd, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
243 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
244 int pktlen = yahoo_packet_length(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
245 int len = YAHOO_PACKET_HDRLEN + pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
246 int ret;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
247
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 guchar *data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
249 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
250
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
251 if (yd->fd < 0)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
252 return -1;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
253
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
254 data = g_malloc0(len + 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
255
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 memcpy(data + pos, "YMSG", 4); pos += 4;
3467
79e0d2f8ad2b [gaim-migrate @ 3517]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
257 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 pos += yahoo_put16(data + pos, 0x0000);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
259 pos += yahoo_put16(data + pos, pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
260 pos += yahoo_put16(data + pos, pkt->service);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 pos += yahoo_put32(data + pos, pkt->status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 pos += yahoo_put32(data + pos, pkt->id);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
264 yahoo_packet_write(pkt, data + pos);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
265
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 yahoo_packet_dump(data, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 ret = write(yd->fd, data, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 g_free(data);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
269
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
270 return ret;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
273 void yahoo_packet_free(struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275 while (pkt->hash) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 struct yahoo_pair *pair = pkt->hash->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277 g_free(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 g_free(pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
279 pkt->hash = g_slist_remove(pkt->hash, pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 g_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
284 static void yahoo_update_status(GaimConnection *gc, const char *name, struct yahoo_friend *f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
285 {
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
286 int online = 1;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
287
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
288 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
289 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
290
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
291 if (f->status == YAHOO_STATUS_OFFLINE)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
292 online = 0;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
293
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
294 serv_got_update(gc, name, online, 0, 0, f->idle, f->away ? UC_UNAVAILABLE : 0);
6784
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
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
297 static void yahoo_process_status(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 struct yahoo_data *yd = gc->proto_data;
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
300 GaimAccount *account = gaim_connection_get_account(gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 GSList *l = pkt->hash;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
302 struct yahoo_friend *f = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 char *name = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
304
7892
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
305 if (pkt->service == YAHOO_SERVICE_LOGOFF && pkt->status == -1) {
8383
ae15e717ca75 [gaim-migrate @ 9111]
Luke Schierer <lschiere@pidgin.im>
parents: 8375
diff changeset
306 gc->wants_to_die = TRUE;
7892
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
307 gaim_connection_error(gc, _("You have been logged off as you have logged in on a different machine or device."));
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
308 return;
0d7b5d7cb5c7 [gaim-migrate @ 8552]
Luke Schierer <lschiere@pidgin.im>
parents: 7883
diff changeset
309 }
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
310
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
311 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
312 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
313
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
314 switch (pair->key) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
315 case 0: /* we won't actually do anything with this */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
316 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
317 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
318 if (!yd->logged_in) {
7664
e4264f71fac7 [gaim-migrate @ 8308]
Luke Schierer <lschiere@pidgin.im>
parents: 7651
diff changeset
319 gaim_connection_set_display_name(gc, pair->value);
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
320 gaim_connection_set_state(gc, GAIM_CONNECTED);
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
321 serv_finish_login(gc);
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
322 yd->logged_in = TRUE;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
323
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
324 /* 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
325 *
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
326 * 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
327 * requested
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
328 *
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
329 * do_import(gc, NULL);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
330 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
331 * yahoo_send_packet(yd, newpkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
332 * yahoo_packet_free(newpkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
333 */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
334
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
335 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
336 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
337 case 8: /* how many online buddies we have */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
338 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339 case 7: /* the current buddy */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
340 name = pair->value;
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
341 f = g_hash_table_lookup(yd->friends, gaim_normalize(account, name));
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
342 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
343 f = yahoo_friend_new();
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
344 g_hash_table_insert(yd->friends, g_strdup(gaim_normalize(account, name)), f);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
345 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
346 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
347 case 10: /* state */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
348 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
349 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
350
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
351 f->status = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
352 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
353 f->away = 1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
354 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
355 f->away = 0;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
356 if (f->status == YAHOO_STATUS_IDLE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
357 f->idle = time(NULL);
6804
3ef17670e69f [gaim-migrate @ 7344]
Luke Schierer <lschiere@pidgin.im>
parents: 6796
diff changeset
358 else
3ef17670e69f [gaim-migrate @ 7344]
Luke Schierer <lschiere@pidgin.im>
parents: 6796
diff changeset
359 f->idle = 0;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
360 if (f->status != YAHOO_STATUS_CUSTOM) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
361 g_free(f->msg);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
362 f->msg = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
363 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
364
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
365 f->sms = 0;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
366 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
367 case 19: /* custom message */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
368 if (f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
369 if (f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
370 g_free(f->msg);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
371 f->msg = yahoo_string_decode(gc, pair->value, FALSE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
372 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
373 break;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
374 case 11: /* this is the buddy's session id */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
375 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
376 case 17: /* in chat? */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
377 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
378 case 47: /* is custom status away or not? 2=idle*/
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
379 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
380 break;
8441
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
381
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
382 /* I have no idea what it means when this is
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
383 * set when someone's available, but it doesn't
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
384 * mean idle. */
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
385 if (f->status == YAHOO_STATUS_AVAILABLE)
ea999c4a9a11 [gaim-migrate @ 9171]
Luke Schierer <lschiere@pidgin.im>
parents: 8383
diff changeset
386 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
387 f->away = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
388 if (f->away == 2)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
389 f->idle = time(NULL);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
390 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
391 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
392 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
393 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
394
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
395 if (f->idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
396 f->idle = -1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
397 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
398 case 137: /* usually idle time in seconds, sometimes login time */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
399 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
400 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
401
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
402 if (f->status != YAHOO_STATUS_AVAILABLE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
403 f->idle = time(NULL) - strtol(pair->value, NULL, 10);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
404 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
405 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
406 if (strtol(pair->value, NULL, 10) == 0) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
407 if (f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
408 f->status = YAHOO_STATUS_OFFLINE;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4731
diff changeset
409 serv_got_update(gc, name, 0, 0, 0, 0, 0);
2807
f01e6a425136 [gaim-migrate @ 2820]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2805
diff changeset
410 break;
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
411 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
412
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
413 if (f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
414 yahoo_update_status(gc, name, f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
415 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
416 case 60: /* SMS */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
417 if (f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
418 f->sms = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
419 yahoo_update_status(gc, name, f);
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
420 }
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
421 break;
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2951
diff changeset
422 case 16: /* Custom error message */
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
423 {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
424 char *tmp = yahoo_string_decode(gc, pair->value, TRUE);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
425 gaim_notify_error(gc, NULL, tmp, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
426 g_free(tmp);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
427 }
2951
b74f4f7165a1 [gaim-migrate @ 2964]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
428 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
429 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
430 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
431 "Unknown status key %d\n", pair->key);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
432 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
433 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
434
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
436 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
437 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
439 static void yahoo_do_group_check(GaimAccount *account, GHashTable *ht, const char *name, const char *group,
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
440 gboolean *export)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
441 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
442 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
443 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
444 GSList *list, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
445 gboolean onlist = 0;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
446 char *oname = NULL;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
447
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
448 char **oname_p = &oname;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
449 GSList **list_p = &list;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
450
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
451 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
452 list = gaim_find_buddies(account, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
453 else
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
454 g_hash_table_steal(ht, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
455
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
456 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
457 b = i->data;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
458 g = gaim_find_buddys_group(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
459 if (!gaim_utf8_strcasecmp(group, g->name)) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
460 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
461 "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
462 list = g_slist_delete_link(list, i);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
463 onlist = 1;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
464 break;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
465 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
466 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
467
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
468 if (!onlist) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
469 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
470 "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
471 if (!(g = gaim_find_group(group))) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
472 g = gaim_group_new(group);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
473 gaim_blist_add_group(g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
474 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
475 b = gaim_buddy_new(account, name, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
476 gaim_blist_add_buddy(b, NULL, g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
477 *export = TRUE;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
478 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
479
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
480 if (list) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
481 if (!oname)
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
482 oname = g_strdup(gaim_normalize(account, name));
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
483 g_hash_table_insert(ht, oname, list);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
484 } else if (oname)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
485 g_free(oname);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
486 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
487
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
488 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
489 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
490 char *name = key;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
491 GSList *list = value, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
492 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
493 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
494 gboolean *export = user_data;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
495
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
496 if (list)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
497 *export = TRUE;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
498
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
499 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
500 b = i->data;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
501 g = gaim_find_buddys_group(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
502 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
503 gaim_blist_remove_buddy(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
504 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
505 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
506
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
507 static char *_getcookie(char *rawcookie)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
508 {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
509 char *cookie = NULL;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
510 char *tmpcookie;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
511 char *cookieend;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
512
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
513 if (strlen(rawcookie) < 2)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
514 return NULL;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
515 tmpcookie = g_strdup(rawcookie+2);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
516 cookieend = strchr(tmpcookie, ';');
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
517
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
518 if (cookieend)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
519 *cookieend = '\0';
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
520
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
521 cookie = g_strdup(tmpcookie);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
522 g_free(tmpcookie);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
523
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
524 return cookie;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
525 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
526
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
527 static void yahoo_process_cookie(struct yahoo_data *yd, char *c)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
528 {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
529 if (c[0] == 'Y') {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
530 if (yd->cookie_y)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
531 g_free(yd->cookie_y);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
532 yd->cookie_y = _getcookie(c);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
533 } else if (c[0] == 'T') {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
534 if (yd->cookie_t)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
535 g_free(yd->cookie_t);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
536 yd->cookie_t = _getcookie(c);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
537 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
538 }
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
539
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
540 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
541 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
542 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
543 gboolean export = FALSE;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
544 gboolean got_serv_list = FALSE;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
545 GaimBuddy *b;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
546 GaimGroup *g;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
547 struct yahoo_friend *f = NULL;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
548 GaimAccount *account = gaim_connection_get_account(gc);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
549 struct yahoo_data *yd = gc->proto_data;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
550 GHashTable *ht;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
551
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
552 char **lines;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
553 char **split;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
554 char **buddies;
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
555 char **tmp, **bud, *norm_bud;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
556 char *grp = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
557
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
558 if (pkt->id)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
559 yd->session_id = pkt->id;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
560
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
561 while (l) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
562 struct yahoo_pair *pair = l->data;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
563 l = l->next;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
564
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
565 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
566 case 87:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
567 if (!yd->tmp_serv_blist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
568 yd->tmp_serv_blist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
569 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
570 g_string_append(yd->tmp_serv_blist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
571 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
572 case 88:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
573 if (!yd->tmp_serv_ilist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
574 yd->tmp_serv_ilist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
575 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
576 g_string_append(yd->tmp_serv_ilist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
577 break;
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
578 case 59: /* cookies, yum */
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
579 yahoo_process_cookie(yd, pair->value);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
580 break;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
581 }
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
582 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
583
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
584 if (pkt->status != 0)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
585 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
586
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
587 if (yd->tmp_serv_blist) {
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
588 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
589
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
590 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
591 for (tmp = lines; *tmp; tmp++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
592 split = g_strsplit(*tmp, ":", 2);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
593 if (!split)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
594 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
595 if (!split[0] || !split[1]) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
596 g_strfreev(split);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
597 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
598 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
599 grp = yahoo_string_decode(gc, split[0], FALSE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
600 buddies = g_strsplit(split[1], ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
601 for (bud = buddies; bud && *bud; bud++) {
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
602 norm_bud = g_strdup(gaim_normalize(account, *bud));
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
603 if (!(f = g_hash_table_lookup(yd->friends, norm_bud))) {
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
604 f = yahoo_friend_new();
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
605 g_hash_table_insert(yd->friends, g_strdup(norm_bud), f);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
606 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
607 if (!(b = gaim_find_buddy(account, norm_bud))) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
608 if (!(g = gaim_find_group(grp))) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
609 g = gaim_group_new(grp);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
610 gaim_blist_add_group(g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
611 }
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
612 b = gaim_buddy_new(account, norm_bud, NULL);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
613 gaim_blist_add_buddy(b, NULL, g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
614 export = TRUE;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
615 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
616
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
617 yahoo_do_group_check(account, ht, norm_bud, grp, &export);
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
618 g_free(norm_bud);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
619 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
620 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
621 g_strfreev(split);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
622 g_free(grp);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
623 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
624 g_strfreev(lines);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
625
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
626 g_string_free(yd->tmp_serv_blist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
627 yd->tmp_serv_blist = NULL;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
628 g_hash_table_foreach(ht, yahoo_do_group_cleanup, &export);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
629 g_hash_table_destroy(ht);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
630 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
631
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
632
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
633 if (yd->tmp_serv_ilist) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
634 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
635 for (bud = buddies; bud && *bud; bud++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
636 /* The server is already ignoring the user */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
637 got_serv_list = TRUE;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
638 gaim_privacy_deny_add(gc->account, *bud, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
639 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
640 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
641
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
642 g_string_free(yd->tmp_serv_ilist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
643 yd->tmp_serv_ilist = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
644 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
645
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
646 if (got_serv_list) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
647 gc->account->perm_deny = 4;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
648 serv_set_permit_deny(gc);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
649 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
650 if (export)
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
651 gaim_blist_save();
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
652 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
653
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
654 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
655 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
656 char *msg = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
657 char *from = NULL;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
658 char *stat = NULL;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
659 char *game = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
660 struct yahoo_friend *f = NULL;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
661 GSList *l = pkt->hash;
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
662 GaimAccount *account = gaim_connection_get_account(gc);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
663 struct yahoo_data *yd = (struct yahoo_data*) gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
664
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
665 while (l) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
666 struct yahoo_pair *pair = l->data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
667 if (pair->key == 4)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
668 from = pair->value;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
669 if (pair->key == 49)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
670 msg = pair->value;
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
671 if (pair->key == 13)
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
672 stat = pair->value;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
673 if (pair->key == 14)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
674 game = pair->value;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
675 l = l->next;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
676 }
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
677
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
678 if (!from || !msg)
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
679 return;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
680
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
681 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))) {
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
682 if (*stat == '1')
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
683 serv_got_typing(gc, from, 0, GAIM_TYPING);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
684 else
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
685 serv_got_typing_stopped(gc, from);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
686 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) {
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
687 GaimBuddy *bud = gaim_find_buddy(gc->account, from);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
688
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
689 if (!bud) {
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
690 gaim_debug(GAIM_DEBUG_WARNING, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
691 "%s is playing a game, and doesn't want "
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
692 "you to know.\n", from);
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
693 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
694
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
695 f = g_hash_table_lookup(yd->friends, gaim_normalize(account, from));
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
696 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
697 return; /* if they're not on the list, don't bother */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
698
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
699 if (f->game) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
700 g_free(f->game);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
701 f->game = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
702 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
703
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
704 if (*stat == '1') {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
705 f->game = g_strdup(game);
3020
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3019
diff changeset
706 if (bud)
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
707 yahoo_update_status(gc, from, f);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
708 }
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
709 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
710 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
711
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
712
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
713 struct _yahoo_im {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
714 char *from;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
715 int time;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
716 int utf8;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
717 char *msg;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
718 };
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
719
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
720 static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
721 {
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
722 GSList *l = pkt->hash;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
723 GSList *list = NULL;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
724 struct _yahoo_im *im = NULL;
6069
5ca86172352a [gaim-migrate @ 6519]
Luke Schierer <lschiere@pidgin.im>
parents: 6061
diff changeset
725
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
726 if (pkt->status <= 1 || pkt->status == 5) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
727 while (l) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
728 struct yahoo_pair *pair = l->data;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
729 if (pair->key == 4) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
730 im = g_new0(struct _yahoo_im, 1);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
731 list = g_slist_append(list, im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
732 im->from = pair->value;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
733 im->time = time(NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
734 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
735 if (pair->key == 97)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
736 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
737 im->utf8 = strtol(pair->value, NULL, 10);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
738 if (pair->key == 15)
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
739 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
740 im->time = strtol(pair->value, NULL, 10);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
741 if (pair->key == 14) {
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
742 if (im)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
743 im->msg = pair->value;
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
744 }
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
745 l = l->next;
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
746 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
747 } else if (pkt->status == 2) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
748 gaim_notify_error(gc, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
749 _("Your Yahoo! message did not get sent."), NULL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
750 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
751
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
752 for (l = list; l; l = l->next) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
753 char *m, *m2;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
754 im = l->data;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
755
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
756 if (!im->from || !im->msg) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
757 g_free(im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
758 continue;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
759 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
760
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
761 m = yahoo_string_decode(gc, im->msg, im->utf8);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
762 gaim_str_strip_cr(m);
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
763
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
764 if (!strcmp(m, "<ding>")) {
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
765 GaimConversation *c = gaim_conversation_new(GAIM_CONV_IM,
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
766 gaim_connection_get_account(gc), im->from);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
767 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
768 im->time);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
769 g_free(m);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
770 g_free(im);
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
771 continue;
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
772 }
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
773
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
774 m2 = yahoo_codes_to_html(m);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
775 g_free(m);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
776 serv_got_im(gc, im->from, m2, 0, im->time);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
777 g_free(m2);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
778 g_free(im);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
779 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
780 g_slist_free(list);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
781 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
782
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
783 static void yahoo_process_sysmessage(GaimConnection *gc, struct yahoo_packet *pkt)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
784 {
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
785 GSList *l = pkt->hash;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
786 char *prim, *me = NULL, *msg = NULL;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
787
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
788 while (l) {
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
789 struct yahoo_pair *pair = l->data;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
790
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
791 if (pair->key == 5)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
792 me = pair->value;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
793 if (pair->key == 14)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
794 msg = pair->value;
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 l = l->next;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
797 }
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
798
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
799 if (!msg)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
800 return;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
801
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
802 prim = g_strdup_printf(_("Yahoo! system message for %s:"),
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
803 me?me:gaim_connection_get_display_name(gc));
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
804 gaim_notify_info(NULL, NULL, prim, msg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
805 g_free(prim);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
806 }
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
807
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
808 static void yahoo_buddy_added_us(GaimConnection *gc, struct yahoo_packet *pkt) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 char *id = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 char *who = NULL;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
811 char *msg = NULL, *tmpmsg = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
812 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
813
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
814 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
815 struct yahoo_pair *pair = l->data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
816
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
817 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
818 case 1:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
819 id = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
820 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
821 case 3:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
822 who = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
823 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
824 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
825 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
826 case 14:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
827 msg = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
828 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
829 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
830 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
831 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
832
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
833 if (id) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
834 if (msg)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
835 tmpmsg = yahoo_string_decode(gc, msg, FALSE);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
836 gaim_account_notify_added(gc->account, id, who, NULL, tmpmsg);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
837 if (tmpmsg)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
838 g_free(tmpmsg);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
839 }
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
840 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
841
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
842 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
843 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
844 char *who = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
845 char *msg = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
846 GSList *l = pkt->hash;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
847 GString *buf = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
848 struct yahoo_data *yd = gc->proto_data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
849
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
850 while (l) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
851 struct yahoo_pair *pair = l->data;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
852
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
853 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
854 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
855 who = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
856 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
857 case 14:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
858 msg = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
859 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
860 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
861 l = l->next;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
862 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
863
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
864 if (who) {
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
865 char *msg2;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
866 buf = g_string_sized_new(0);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
867 if (!msg) {
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
868 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
869 } else {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
870 msg2 = yahoo_string_decode(gc, msg, FALSE);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
871 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
872 g_free(msg2);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
873 }
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
874 gaim_notify_info(gc, NULL, _("Add buddy rejected"), buf->str);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
875 g_string_free(buf, TRUE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
876 g_hash_table_remove(yd->friends, who);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
877 serv_got_update(gc, who, 0, 0, 0, 0, 0);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
878 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
879 }
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 static void yahoo_process_contact(GaimConnection *gc, struct yahoo_packet *pkt)
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
882 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
883
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
884
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
885 switch (pkt->status) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
886 case 1:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
887 yahoo_process_status(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
888 return;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
889 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
890 yahoo_buddy_added_us(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
891 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
892 case 7:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
893 yahoo_buddy_denied_our_add(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
894 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
895 default:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
896 break;
2683
4836eae8dd8c [gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2682
diff changeset
897 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
898 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
899
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
900 #define OUT_CHARSET "utf-8"
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
901
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
902 static char *yahoo_decode(const char *text)
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
903 {
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
904 char *converted;
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
905 char *n, *new;
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
906 const char *end, *p;
8616
aa815d1a996d [gaim-migrate @ 9367]
Ethan Blanton <elb@pidgin.im>
parents: 8591
diff changeset
907 int i, k;
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
908
7771
a481ffe303d2 [gaim-migrate @ 8416]
Nathan Walp <nwalp@pidgin.im>
parents: 7747
diff changeset
909 n = new = g_malloc(strlen (text) + 1);
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
910 end = text + strlen(text);
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
911
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
912 for (p = text; p < end; p++, n++) {
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
913 if (*p == '\\') {
8620
e67f0f3aebb8 [gaim-migrate @ 9371]
Ethan Blanton <elb@pidgin.im>
parents: 8617
diff changeset
914 k = 0;
8616
aa815d1a996d [gaim-migrate @ 9367]
Ethan Blanton <elb@pidgin.im>
parents: 8591
diff changeset
915 sscanf(p + 1, "%3o%n\n", &i, &k);
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
916 *n = i;
8617
9bd849b376b4 [gaim-migrate @ 9368]
Ethan Blanton <elb@pidgin.im>
parents: 8616
diff changeset
917 p += k;
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
918 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
919 else
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
920 *n = *p;
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
921 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
922
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
923 *n = '\0';
8125
abbfed0b0050 [gaim-migrate @ 8829]
Nathan Walp <nwalp@pidgin.im>
parents: 8118
diff changeset
924
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
925 converted = g_convert(new, n - new, OUT_CHARSET, "iso-8859-1", NULL, NULL, NULL);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
926 g_free(new);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
927
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
928 return converted;
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
929 }
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
930
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
931 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
932 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
933 GaimAccount *account = gaim_connection_get_account(gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
934 char *who = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
935 char *email = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
936 char *subj = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
937 int count = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
938 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
939
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
940 if (!gaim_account_get_check_mail(account))
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
941 return;
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
942
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
943 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
944 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
945 if (pair->key == 9)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
946 count = strtol(pair->value, NULL, 10);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
947 else if (pair->key == 43)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
948 who = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
949 else if (pair->key == 42)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
950 email = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
951 else if (pair->key == 18)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
952 subj = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
953 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
954 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
955
4001
9178da61c19f [gaim-migrate @ 4201]
Luke Schierer <lschiere@pidgin.im>
parents: 3996
diff changeset
956 if (who && subj && email && *email) {
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
957 char *dec_who = yahoo_decode(who);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
958 char *dec_subj = yahoo_decode(subj);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
959 char *from = g_strdup_printf("%s (%s)", dec_who, email);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
960
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
961 gaim_notify_email(gc, dec_subj, from, gaim_account_get_username(account),
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
962 "http://mail.yahoo.com/", NULL, NULL);
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
963
7747
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
964 g_free(dec_who);
3906c0957d4f [gaim-migrate @ 8392]
Luke Schierer <lschiere@pidgin.im>
parents: 7696
diff changeset
965 g_free(dec_subj);
2850
cbe6a1e63a72 [gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2813
diff changeset
966 g_free(from);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
967 } else if (count > 0) {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
968 const char *to = gaim_account_get_username(account);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
969 const char *url = "http://mail.yahoo.com/";
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
970
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
971 gaim_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url,
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
972 NULL, NULL);
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
973 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
974 }
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
975 /* 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
976 char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
977
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
978 /* 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
979 * in util.c, but it has a bug I don't feel like finding right now ;) */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
980 void to_y64(unsigned char *out, const unsigned char *in, int inlen)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
981 /* 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
982 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
983 for (; inlen >= 3; inlen -= 3)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
984 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
985 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
986 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
987 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
988 *out++ = base64digits[in[2] & 0x3f];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
989 in += 3;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
990 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
991 if (inlen > 0)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
992 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
993 unsigned char fragment;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
994
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
995 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
996 fragment = (in[0] << 4) & 0x30;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
997 if (inlen > 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
998 fragment |= in[1] >> 4;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
999 *out++ = base64digits[fragment];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1000 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1001 *out++ = '-';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1002 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1003 *out = '\0';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1004 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1005
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1006 static void yahoo_process_auth_old(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1007 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1008 struct yahoo_packet *pack;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1009 GaimAccount *account = gaim_connection_get_account(gc);
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
1010 const char *name = gaim_normalize(account, gaim_account_get_username(account));
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1011 const char *pass = gaim_account_get_password(account);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1012 struct yahoo_data *yd = gc->proto_data;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1013
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1014 /* 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
1015 * will soon do so in the rest of the world.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1016 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1017 * 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
1018 * 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
1019 * crypt() was. The only purpose this scheme could serve is to prevent third
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1020 * part clients from connecting to their servers.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1021 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1022 * Sorry, Yahoo.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1023 */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1024
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1025 md5_byte_t result[16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1026 md5_state_t ctx;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1027
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1028 char *crypt_result;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1029 char password_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1030 char crypt_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1031 char *hash_string_p = g_malloc(50 + strlen(name));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1032 char *hash_string_c = g_malloc(50 + strlen(name));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1033
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1034 char checksum;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1035
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1036 int sv;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1037
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1038 char result6[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1039 char result96[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1040
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1041 sv = seed[15];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1042 sv = sv % 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1043
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1044 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1045 md5_append(&ctx, pass, strlen(pass));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1046 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1047 to_y64(password_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1048
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1049 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1050 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1051 md5_append(&ctx, crypt_result, strlen(crypt_result));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1052 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1053 to_y64(crypt_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1054
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1055 switch (sv) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1056 case 1:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1057 case 6:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1058 checksum = seed[seed[9] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1059 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1060 "%c%s%s%s", checksum, name, seed, password_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1061 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1062 "%c%s%s%s", checksum, name, seed, crypt_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1063 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1064 case 2:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1065 case 7:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1066 checksum = seed[seed[15] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1067 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1068 "%c%s%s%s", checksum, seed, password_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1069 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1070 "%c%s%s%s", checksum, seed, crypt_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1071 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1072 case 3:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1073 checksum = seed[seed[1] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1074 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1075 "%c%s%s%s", checksum, name, password_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1076 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1077 "%c%s%s%s", checksum, name, crypt_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1078 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1079 case 4:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1080 checksum = seed[seed[3] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1081 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1082 "%c%s%s%s", checksum, password_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1083 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1084 "%c%s%s%s", checksum, crypt_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1085 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1086 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1087 case 5:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1088 checksum = seed[seed[7] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1089 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1090 "%c%s%s%s", checksum, password_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1091 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1092 "%c%s%s%s", checksum, crypt_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1093 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1094 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1095
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1096 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1097 md5_append(&ctx, hash_string_p, strlen(hash_string_p));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1098 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1099 to_y64(result6, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1100
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1101 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1102 md5_append(&ctx, hash_string_c, strlen(hash_string_c));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1103 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1104 to_y64(result96, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1105
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1106 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1107 yahoo_packet_hash(pack, 0, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1108 yahoo_packet_hash(pack, 6, result6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1109 yahoo_packet_hash(pack, 96, result96);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1110 yahoo_packet_hash(pack, 1, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1111
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1112 yahoo_send_packet(yd, pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1113
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1114 g_free(hash_string_p);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1115 g_free(hash_string_c);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1116
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1117 yahoo_packet_free(pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1118
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1119 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1120
6998
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
1121 /* 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
1122 * and sending the fix! Thanks guys. */
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
1123
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1124 static void yahoo_process_auth_new(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1125 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1126 struct yahoo_packet *pack = NULL;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1127 GaimAccount *account = gaim_connection_get_account(gc);
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
1128 const char *name = gaim_normalize(account, gaim_account_get_username(account));
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1129 const char *pass = gaim_account_get_password(account);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1130 struct yahoo_data *yd = gc->proto_data;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1131
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1132 md5_byte_t result[16];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1133 md5_state_t ctx;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1134
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1135 SHA_CTX ctx1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1136 SHA_CTX ctx2;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1137
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1138 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1139 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1140
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1141 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1142 char *operand_lookup = "+|&%/*^-";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1143 char *delimit_lookup = ",;";
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1144
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1145 char *password_hash = (char *)g_malloc(25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1146 char *crypt_hash = (char *)g_malloc(25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1147 char *crypt_result = NULL;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1148
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1149 char pass_hash_xor1[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1150 char pass_hash_xor2[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1151 char crypt_hash_xor1[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1152 char crypt_hash_xor2[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1153 char resp_6[100];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1154 char resp_96[100];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1155
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1156 unsigned char digest1[20];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1157 unsigned char digest2[20];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1158 unsigned char comparison_src[20];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1159 unsigned char magic_key_char[4];
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
1160 const unsigned char *magic_ptr;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1161
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1162 unsigned int magic[64];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1163 unsigned int magic_work = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1164 unsigned int magic_4 = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1165
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1166 int x;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1167 int y;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1168 int cnt = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1169 int magic_cnt = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1170 int magic_len;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1171
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1172 memset(password_hash, 0, 25);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1173 memset(crypt_hash, 0, 25);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1174 memset(&pass_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1175 memset(&pass_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1176 memset(&crypt_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1177 memset(&crypt_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1178 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1179 memset(&digest2, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1180 memset(&magic, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1181 memset(&resp_6, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1182 memset(&resp_96, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1183 memset(&magic_key_char, 0, 4);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1184 memset(&comparison_src, 0, 20);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1185
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1186 /*
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1187 * 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
1188 * 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
1189 */
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1190
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1191 magic_ptr = seed;
8375
1556970088d4 [gaim-migrate @ 9102]
Luke Schierer <lschiere@pidgin.im>
parents: 8357
diff changeset
1192
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1193 while (*magic_ptr != (int)NULL) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1194 char *loc;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1195
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1196 /* Ignore parentheses.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1197 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1198
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1199 if (*magic_ptr == '(' || *magic_ptr == ')') {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1200 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1201 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1202 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1203
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1204 /* Characters and digits verify against the challenge lookup.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1205 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1206
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1207 if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1208 loc = strchr(challenge_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1209 if (!loc) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1210 /* SME XXX Error - disconnect here */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1211 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1212
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1213 /* Get offset into lookup table and shl 3.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1214 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1215
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1216 magic_work = loc - challenge_lookup;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1217 magic_work <<= 3;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1218
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1219 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1220 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1221 } else {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1222 unsigned int local_store;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1223
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1224 loc = strchr(operand_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1225 if (!loc) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1226 /* SME XXX Disconnect */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1227 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1228
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1229 local_store = loc - operand_lookup;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1230
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1231 /* Oops; how did this happen?
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1232 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1233
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1234 if (magic_cnt >= 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1235 break;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1236
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1237 magic[magic_cnt++] = magic_work | local_store;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1238 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1239 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1240 }
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1241 }
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1242
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1243 magic_len = magic_cnt;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1244 magic_cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1245
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1246 /* Magic: Phase 2. Take generated magic value and sprinkle fairy dust on the values.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1247 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1248
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1249 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
1250 unsigned char byte1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1251 unsigned char byte2;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1252
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1253 /* Bad. Abort.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1254 */
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1255
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1256 if ((magic_cnt + 1 > magic_len) || (magic_cnt > magic_len))
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1257 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1258
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1259 byte1 = magic[magic_cnt];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1260 byte2 = magic[magic_cnt+1];
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1261
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1262 byte1 *= 0xcd;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1263 byte1 ^= byte2;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1264
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1265 magic[magic_cnt+1] = byte1;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1266 }
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1267
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1268 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1269 * 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
1270 * 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
1271 * 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
1272 * 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
1273 *
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 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1276
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1277 magic_cnt = 1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1278 x = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1279
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1280 do {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1281 unsigned int bl = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1282 unsigned int cl = magic[magic_cnt++];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1283
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1284 if (magic_cnt >= magic_len)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1285 break;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1286
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1287 if (cl > 0x7F) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1288 if (cl < 0xe0)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1289 bl = cl = (cl & 0x1f) << 6;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1290 else {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1291 bl = magic[magic_cnt++];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1292 cl = (cl & 0x0f) << 6;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1293 bl = ((bl & 0x3f) + cl) << 6;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1294 }
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1295
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1296 cl = magic[magic_cnt++];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1297 bl = (cl & 0x3f) + bl;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1298 } else
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1299 bl = cl;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1300
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1301 comparison_src[x++] = (bl & 0xff00) >> 8;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1302 comparison_src[x++] = bl & 0xff;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1303 } while (x < 20);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1304
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1305 /* First four bytes are magic key.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1306 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1307
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1308 memcpy(&magic_key_char[0], comparison_src, 4);
8482
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1309 magic_4 = magic_key_char[0] | (magic_key_char[1]<<8) | (magic_key_char[2]<<16) | (magic_key_char[3]<<24);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1310
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1311 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1312 * 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
1313 * loop values until we match our previous buffer.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1314 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1315
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1316 for (x = 0; x < 65535; x++) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1317 int leave = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1318
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1319 for (y = 0; y < 5; y++) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1320 md5_byte_t result[16];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1321 md5_state_t ctx;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1322
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1323 unsigned char test[3];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1324
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1325 memset(&result, 0, 16);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1326 memset(&test, 0, 3);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1327
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1328 /* Calculate buffer.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1329 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1330
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1331 test[0] = x;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1332 test[1] = x >> 8;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1333 test[2] = y;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1334
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1335 md5_init(&ctx);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1336 md5_append(&ctx, magic_key_char, 4);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1337 md5_append(&ctx, test, 3);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1338 md5_finish(&ctx, result);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1339
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1340 if (!memcmp(result, comparison_src+4, 16)) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1341 leave = 1;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1342 break;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1343 }
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1344 }
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1345
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1346 if (leave == 1)
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1347 break;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1348 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1349
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1350 /* If y != 0, we need some help.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1351 */
6986
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 if (y != 0) {
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1354 unsigned int updated_key;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1355
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1356 /* Update magic stuff. Call it twice because Yahoo's encryption is super bad ass.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1357 */
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1358
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1359 updated_key = yahoo_auth_finalCountdown(magic_4, 0x60, y, x);
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1360 updated_key = yahoo_auth_finalCountdown(updated_key, 0x60, y, x);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1361
8482
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1362 magic_key_char[0] = updated_key & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1363 magic_key_char[1] = (updated_key >> 8) & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1364 magic_key_char[2] = (updated_key >> 16) & 0xff;
791c05d1679d [gaim-migrate @ 9215]
Ethan Blanton <elb@pidgin.im>
parents: 8441
diff changeset
1365 magic_key_char[3] = (updated_key >> 24) & 0xff;
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1366 }
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1367
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1368 /* Get password and crypt hashes as per usual.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1369 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1370
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1371 md5_init(&ctx);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1372 md5_append(&ctx, pass, strlen(pass));
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1373 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1374 to_y64(password_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1375
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1376 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1377 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1378 md5_append(&ctx, crypt_result, strlen(crypt_result));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1379 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1380 to_y64(crypt_hash, result, 16);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1381
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1382 /* Our first authentication response is based off of the password hash.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1383 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1384
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1385 for (x = 0; x < (int)strlen(password_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1386 pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1387
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1388 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1389 memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1390
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1391 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1392
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1393 for (x = 0; x < (int)strlen(password_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1394 pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1395
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1396 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1397 memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1398
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1399 shaInit(&ctx1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1400 shaInit(&ctx2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1401
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1402 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1403 * 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
1404 * which we previously extrapolated from our challenge.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1405 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1406
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1407 shaUpdate(&ctx1, pass_hash_xor1, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1408 shaUpdate(&ctx1, magic_key_char, 4);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1409 shaFinal(&ctx1, digest1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1410
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1411 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1412 * 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
1413 * of the first context.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1414 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1415
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1416 shaUpdate(&ctx2, pass_hash_xor2, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1417 shaUpdate(&ctx2, digest1, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1418 shaFinal(&ctx2, digest2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1419
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1420 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1421 * 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
1422 * our first authentication response.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1423 */
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1424
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1425 for (x = 0; x < 20; x += 2) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1426 unsigned int val = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1427 unsigned int lookup = 0;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1428
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1429 char byte[6];
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1430
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1431 memset(&byte, 0, 6);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1432
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1433 /* First two bytes of digest stuffed together.
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1434 */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1435
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1436 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1437 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1438 val += digest2[x+1];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1439
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1440 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1441 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1442 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1443 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1444 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1445 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1446 strcat(resp_6, "=");
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1447
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1448 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1449 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1450 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1451 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1452 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1453 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1454
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1455 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1456 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1457 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1458 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1459 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1460 strcat(resp_6, byte);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1461
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1462 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1463 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1464 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1465 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1466 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1467 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1468
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1469 /* Our second authentication response is based off of the crypto hash.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1470 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1471
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1472 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1473 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1474 memset(&digest2, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1475
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1476 for (x = 0; x < (int)strlen(crypt_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1477 crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1478
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1479 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1480 memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt);
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1481
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1482 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1483
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1484 for (x = 0; x < (int)strlen(crypt_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1485 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1486
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1487 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1488 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1489
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1490 shaInit(&ctx1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1491 shaInit(&ctx2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1492
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1493 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1494 * 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
1495 * which we previously extrapolated from our challenge.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1496 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1497
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1498 shaUpdate(&ctx1, crypt_hash_xor1, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1499 shaUpdate(&ctx1, magic_key_char, 4);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1500 shaFinal(&ctx1, digest1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1501
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1502 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1503 * 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
1504 * of the first context.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1505 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1506
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1507 shaUpdate(&ctx2, crypt_hash_xor2, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1508 shaUpdate(&ctx2, digest1, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1509 shaFinal(&ctx2, digest2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1510
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1511 /*
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1512 * 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
1513 * our first authentication response.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1514 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1515
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1516 for (x = 0; x < 20; x += 2) {
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1517 unsigned int val = 0;
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1518 unsigned int lookup = 0;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1519
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1520 char byte[6];
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1521
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1522 memset(&byte, 0, 6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1523
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1524 /* First two bytes of digest stuffed together.
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1525 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1526
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1527 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1528 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1529 val += digest2[x+1];
8349
f1ca7e06e8de [gaim-migrate @ 9073]
Sean Egan <seanegan@gmail.com>
parents: 8243
diff changeset
1530
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1531 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1532 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1533 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1534 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1535 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1536 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1537 strcat(resp_96, "=");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1538
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1539 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1540 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1541 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1542 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1543 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1544 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1545
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1546 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1547 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1548 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1549 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1550 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1551 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1552
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1553 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1554 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1555 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1556 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1557 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1558 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1559
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1560 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1561 yahoo_packet_hash(pack, 0, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1562 yahoo_packet_hash(pack, 6, resp_6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1563 yahoo_packet_hash(pack, 96, resp_96);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1564 yahoo_packet_hash(pack, 1, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1565 yahoo_send_packet(yd, pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1566 yahoo_packet_free(pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1567
7424
c8b4a617ee5b [gaim-migrate @ 8026]
Ethan Blanton <elb@pidgin.im>
parents: 7423
diff changeset
1568 g_free(password_hash);
c8b4a617ee5b [gaim-migrate @ 8026]
Ethan Blanton <elb@pidgin.im>
parents: 7423
diff changeset
1569 g_free(crypt_hash);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1570 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1571
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1572 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
1573 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1574 char *seed = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1575 char *sn = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1576 GSList *l = pkt->hash;
7010
eb3ed649252e [gaim-migrate @ 7573]
Sean Egan <seanegan@gmail.com>
parents: 6998
diff changeset
1577 int m = 0;
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1578 gchar *buf;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1579
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1580
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1581 while (l) {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1582 struct yahoo_pair *pair = l->data;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1583 if (pair->key == 94)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1584 seed = pair->value;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1585 if (pair->key == 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1586 sn = pair->value;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1587 if (pair->key == 13)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1588 m = atoi(pair->value);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1589 l = l->next;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1590 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1591
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1592 if (seed) {
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1593 switch (m) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1594 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1595 yahoo_process_auth_old(gc, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1596 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1597 case 1:
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1598 yahoo_process_auth_new(gc, seed);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1599 break;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1600 default:
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1601 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
1602 "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
1603 "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
1604 gaim_notify_error(gc, "", _("Failed Yahoo! Authentication"),
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1605 buf);
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1606 g_free(buf);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1607 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
1608 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1609 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1610 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1611
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1612 static void ignore_buddy(GaimBuddy *b) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1613 GaimGroup *g;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1614 GaimConversation *c;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1615 GaimAccount *account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1616 gchar *name;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1617
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1618 if (!b)
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1619 return;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1620
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1621 g = gaim_find_buddys_group(b);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1622 name = g_strdup(b->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1623 account = b->account;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1624
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1625 gaim_debug(GAIM_DEBUG_INFO, "blist",
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1626 "Removing '%s' from buddy list.\n", b->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1627 serv_remove_buddy(account->gc, name, g->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1628 gaim_blist_remove_buddy(b);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1629
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1630 serv_add_deny(account->gc, name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1631 gaim_blist_save();
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1632
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1633 c = gaim_find_conversation_with_account(name, account);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1634
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1635 if (c != NULL)
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1636 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1637
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1638 g_free(name);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1639 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1640
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1641 static void keep_buddy(GaimBuddy *b) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1642 gaim_privacy_deny_remove(b->account, b->name, 1);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1643 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1644
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1645 static void yahoo_process_ignore(GaimConnection *gc, struct yahoo_packet *pkt) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1646 GaimBuddy *b;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1647 GSList *l;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1648 gchar *who = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1649 gchar *sn = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1650 gchar buf[BUF_LONG];
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1651 gint ignore = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1652 gint status = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1653
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1654 for (l = pkt->hash; l; l = l->next) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1655 struct yahoo_pair *pair = l->data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1656 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1657 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1658 who = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1659 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1660 case 1:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1661 sn = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1662 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1663 case 13:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1664 ignore = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1665 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1666 case 66:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1667 status = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1668 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1669 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1670 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1671 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1672 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1673
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1674 switch (status) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1675 case 12:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1676 b = gaim_find_buddy(gc->account, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1677 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
1678 "user is on your buddy list. Clicking \"Yes\" "
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1679 "will remove and ignore the buddy."), who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1680 gaim_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, b,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1681 G_CALLBACK(ignore_buddy),
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1682 G_CALLBACK(keep_buddy));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1683 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1684 case 2:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1685 case 3:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1686 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1687 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1688 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1689 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1690 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1691
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1692 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1693 {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1694 GSList *l = pkt->hash;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1695 int err = 0;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1696 char *msg;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1697 char *url = NULL;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1698 char *fullmsg;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1699
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1700 while (l) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1701 struct yahoo_pair *pair = l->data;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1702
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1703 if (pair->key == 66)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1704 err = strtol(pair->value, NULL, 10);
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1705 if (pair->key == 20)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1706 url = pair->value;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1707
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1708 l = l->next;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1709 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1710
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1711 switch (err) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1712 case 3:
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1713 msg = g_strdup(_("Invalid username."));
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1714 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1715 case 13:
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1716 msg = g_strdup(_("Incorrect password."));
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1717 break;
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1718 case 14:
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1719 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
1720 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1721 default:
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1722 msg = g_strdup_printf(_("Unknown error number %d."), err);
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1723 }
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1724
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1725 if (url)
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1726 fullmsg = g_strdup_printf("%s\n%s", msg, url);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1727 else
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1728 fullmsg = g_strdup(msg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1729
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1730 gaim_connection_error(gc, fullmsg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1731 g_free(msg);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1732 g_free(fullmsg);
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1733 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1734
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1735 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1736 {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1737 int err = 0;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1738 char *who = NULL;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1739 char *group = NULL;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1740 char *decoded_group;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1741 char *buf;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1742 struct yahoo_friend *f;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1743 struct yahoo_data *yd = gc->proto_data;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1744 GSList *l = pkt->hash;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1745
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1746 while (l) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1747 struct yahoo_pair *pair = l->data;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1748
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1749 switch (pair->key) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1750 case 66:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1751 err = strtol(pair->value, NULL, 10);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1752 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1753 case 7:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1754 who = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1755 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1756 case 65:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1757 group = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1758 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1759 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1760
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1761 l = l->next;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1762 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1763
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1764 if (!who)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1765 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1766 if (!group)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1767 group = "";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1768
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1769 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
1770 if (!g_hash_table_lookup(yd->friends, gaim_normalize(gaim_connection_get_account(gc), who))) {
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1771 f = yahoo_friend_new();
7823
35cd3ef34fb0 [gaim-migrate @ 8475]
Luke Schierer <lschiere@pidgin.im>
parents: 7771
diff changeset
1772 g_hash_table_insert(yd->friends, g_strdup(gaim_normalize(gaim_connection_get_account(gc), who)), f);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1773 yahoo_update_status(gc, who, f);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1774 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1775 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1776 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1777
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1778 decoded_group = yahoo_string_decode(gc, group, FALSE);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1779 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
1780 who, decoded_group, gaim_connection_get_display_name(gc));
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1781 gaim_notify_error(gc, NULL, _("Could not add buddy to server list"), buf);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1782 g_free(buf);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
1783 g_free(decoded_group);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1784 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1785
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1786 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1787 {
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1788 switch (pkt->service) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1789 case YAHOO_SERVICE_LOGON:
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
1790 case YAHOO_SERVICE_LOGOFF:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1791 case YAHOO_SERVICE_ISAWAY:
2737
f61c1f3a6afa [gaim-migrate @ 2750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2724
diff changeset
1792 case YAHOO_SERVICE_ISBACK:
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1793 case YAHOO_SERVICE_GAMELOGON:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1794 case YAHOO_SERVICE_GAMELOGOFF:
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
1795 case YAHOO_SERVICE_CHATLOGON:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
1796 case YAHOO_SERVICE_CHATLOGOFF:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1797 yahoo_process_status(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1798 break;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1799 case YAHOO_SERVICE_NOTIFY:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1800 yahoo_process_notify(gc, pkt);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1801 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1802 case YAHOO_SERVICE_MESSAGE:
2786
318f846120e2 [gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2772
diff changeset
1803 case YAHOO_SERVICE_GAMEMSG:
5939
3014de25a8a4 [gaim-migrate @ 6379]
Luke Schierer <lschiere@pidgin.im>
parents: 5921
diff changeset
1804 case YAHOO_SERVICE_CHATMSG:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1805 yahoo_process_message(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1806 break;
7865
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1807 case YAHOO_SERVICE_SYSMESSAGE:
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1808 yahoo_process_sysmessage(gc, pkt);
1d2e9482e195 [gaim-migrate @ 8519]
Luke Schierer <lschiere@pidgin.im>
parents: 7829
diff changeset
1809 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1810 case YAHOO_SERVICE_NEWMAIL:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1811 yahoo_process_mail(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1812 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1813 case YAHOO_SERVICE_NEWCONTACT:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1814 yahoo_process_contact(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1815 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1816 case YAHOO_SERVICE_AUTHRESP:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1817 yahoo_process_authresp(gc, pkt);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1818 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1819 case YAHOO_SERVICE_LIST:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1820 yahoo_process_list(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1821 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1822 case YAHOO_SERVICE_AUTH:
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1823 yahoo_process_auth(gc, pkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1824 break;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1825 case YAHOO_SERVICE_ADDBUDDY:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1826 yahoo_process_addbuddy(gc, pkt);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1827 break;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1828 case YAHOO_SERVICE_IGNORECONTACT:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1829 yahoo_process_ignore(gc, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1830 break;
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1831 case YAHOO_SERVICE_CONFINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1832 case YAHOO_SERVICE_CONFADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1833 yahoo_process_conference_invite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1834 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1835 case YAHOO_SERVICE_CONFDECLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1836 yahoo_process_conference_decline(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1837 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1838 case YAHOO_SERVICE_CONFLOGON:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1839 yahoo_process_conference_logon(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1840 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1841 case YAHOO_SERVICE_CONFLOGOFF:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1842 yahoo_process_conference_logoff(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1843 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1844 case YAHOO_SERVICE_CONFMSG:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1845 yahoo_process_conference_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1846 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1847 case YAHOO_SERVICE_CHATONLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1848 yahoo_process_chat_online(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1849 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1850 case YAHOO_SERVICE_CHATLOGOUT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1851 yahoo_process_chat_logout(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1852 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1853 case YAHOO_SERVICE_CHATGOTO:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1854 yahoo_process_chat_goto(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1855 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1856 case YAHOO_SERVICE_CHATJOIN:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1857 yahoo_process_chat_join(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1858 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1859 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1860 case YAHOO_SERVICE_CHATEXIT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1861 yahoo_process_chat_exit(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1862 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1863 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
1864 case YAHOO_SERVICE_CHATADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1865 yahoo_process_chat_addinvite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1866 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1867 case YAHOO_SERVICE_COMMENT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1868 yahoo_process_chat_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1869 break;
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
1870 case YAHOO_SERVICE_P2PFILEXFER:
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
1871 case YAHOO_SERVICE_FILETRANSFER:
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
1872 yahoo_process_filetransfer(gc, pkt);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
1873 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1874 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1875 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1876 "Unhandled service 0x%02x\n", pkt->service);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1877 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1878 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1879 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1880
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1881 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1882 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1883 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1884 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1885 char buf[1024];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1886 int len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1887
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1888 len = read(yd->fd, buf, sizeof(buf));
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1889
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1890 if (len <= 0) {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
1891 gaim_connection_error(gc, _("Unable to read"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1892 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1893 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1894
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1895 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1896 memcpy(yd->rxqueue + yd->rxlen, buf, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1897 yd->rxlen += len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1898
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1899 while (1) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1900 struct yahoo_packet *pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1901 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1902 int pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1903
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1904 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1905 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1906
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1907 pos += 4; /* YMSG */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1908 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1909 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1910
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1911 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1912 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1913 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1914
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1915 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1916 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1917
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1918 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1919
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1920 pkt = yahoo_packet_new(0, 0, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1921
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1922 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
3021
18f0e61a6caf [gaim-migrate @ 3034]
Sean Egan <seanegan@gmail.com>
parents: 3020
diff changeset
1923 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1924 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1925 "Yahoo Service: 0x%02x Status: %d\n",
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1926 pkt->service, pkt->status);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1927 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1928
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1929 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1930
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1931 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1932 if (yd->rxlen) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1933 char *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1934 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1935 yd->rxqueue = tmp;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1936 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1937 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1938 yd->rxqueue = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1939 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1940
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1941 yahoo_packet_process(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1942
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1943 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1944 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1945 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1946
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1947 #ifndef YAHOO_WEBMESSENGER
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1948 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1949 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1950 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1951 struct yahoo_data *yd;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1952 struct yahoo_packet *pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1953
5590
011a0a975060 [gaim-migrate @ 5994]
Christian Hammond <chipx86@chipx86.com>
parents: 5583
diff changeset
1954 if (!g_list_find(gaim_connections_get_all(), gc)) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1955 close(source);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1956 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1957 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1958
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1959 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
1960 gaim_connection_error(gc, _("Unable to connect."));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1961 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1962 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1963
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1964 yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1965 yd->fd = source;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1966
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1967 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1968
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
1969 yahoo_packet_hash(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1970 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1971
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1972 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1973
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1974 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
1975 }
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1976 #endif
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1977
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1978 #ifdef YAHOO_WEBMESSENGER
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1979 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
1980 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1981 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1982 struct yahoo_data *yd;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1983 struct yahoo_packet *pkt;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1984
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1985 if (!g_list_find(gaim_connections_get_all(), gc)) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1986 close(source);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1987 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1988 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1989
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1990 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
1991 gaim_connection_error(gc, _("Unable to connect."));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1992 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1993 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1994
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1995 yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1996 yd->fd = source;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1997
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1998 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1999
7261
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
2000 yahoo_packet_hash(pkt, 0, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))));
1930e3d00ecd [gaim-migrate @ 7838]
Nathan Walp <nwalp@pidgin.im>
parents: 7209
diff changeset
2001 yahoo_packet_hash(pkt, 1, gaim_normalize(gc->account, gaim_account_get_username(gaim_connection_get_account(gc))));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2002 yahoo_packet_hash(pkt, 6, yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2003 yahoo_send_packet(yd, pkt);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2004
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2005 yahoo_packet_free(pkt);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2006 g_free(yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2007 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
2008 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2009
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2010 static void yahoo_web_pending(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2011 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2012 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2013 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2014 struct yahoo_data *yd = gc->proto_data;
8243
217643616a74 [gaim-migrate @ 8966]
Luke Schierer <lschiere@pidgin.im>
parents: 8235
diff changeset
2015 char buf[2048], *i = buf;
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2016 int len;
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2017 GString *s;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2018
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2019 len = read(source, buf, sizeof(buf)-1);
8216
dcace041cfb8 [gaim-migrate @ 8939]
Christian Hammond <chipx86@chipx86.com>
parents: 8212
diff changeset
2020 if (len <= 0 || (strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302")) &&
dcace041cfb8 [gaim-migrate @ 8939]
Christian Hammond <chipx86@chipx86.com>
parents: 8212
diff changeset
2021 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
2022 gaim_connection_error(gc, _("Unable to read"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2023 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2024 }
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2025
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2026 s = g_string_sized_new(len);
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2027 buf[sizeof(buf)-1] = '\0';
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2028
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2029 while ((i = strstr(i, "Set-Cookie: "))) {
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2030 i += strlen("Set-Cookie: ");
8243
217643616a74 [gaim-migrate @ 8966]
Luke Schierer <lschiere@pidgin.im>
parents: 8235
diff changeset
2031 for (;*i != ';' && *i != '\0'; i++)
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2032 g_string_append_c(s, *i);
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2033
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2034 g_string_append(s, "; ");
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2035 }
8161
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2036
d5dbb02d2837 [gaim-migrate @ 8873]
Luke Schierer <lschiere@pidgin.im>
parents: 8125
diff changeset
2037 yd->auth = g_string_free(s, FALSE);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2038 gaim_input_remove(gc->inpa);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2039 close(source);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2040 /* 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
2041 if (gaim_proxy_connect(account, "wcs2.msg.dcn.yahoo.com",
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2042 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2043 yahoo_got_web_connected, gc) != 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2044 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2045 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2046 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2047 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2048
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2049 static void yahoo_got_cookies(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2050 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2051 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2052 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2053 if (source < 0) {
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2054 gaim_connection_error(gc, _("Unable to connect."));
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2055 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2056 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2057 write(source, yd->auth, strlen(yd->auth));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2058 g_free(yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2059 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
2060 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2061
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2062 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
2063 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2064 if (!strcmp(key, "passwd"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2065 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2066 url = g_string_append_c(url, '&');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2067 url = g_string_append(url, key);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2068 url = g_string_append_c(url, '=');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2069 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2070 url = g_string_append_c(url, '1');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2071 else if (!strcmp(key, ".challenge"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2072 url = g_string_append(url, val);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2073 else
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2074 url = g_string_append(url, gaim_url_encode(val));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2075 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2076
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2077 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
2078 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2079 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
2080 const char *c = buf;
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2081 char *d;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2082 char name[64], value[64];
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2083 int count = sizeof(name)-1;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2084 while ((c < (buf + len)) && (c = strstr(c, "<input "))) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2085 c = strstr(c, "name=\"") + strlen("name=\"");
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2086 for (d = name; *c!='"' && count; c++, d++, count--)
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2087 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2088 *d = '\0';
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2089 count = sizeof(value)-1;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2090 d = strstr(c, "value=\"") + strlen("value=\"");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2091 if (strchr(c, '>') < d)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2092 break;
8118
52089b055c12 [gaim-migrate @ 8822]
Luke Schierer <lschiere@pidgin.im>
parents: 8113
diff changeset
2093 for (c = d, d = value; *c!='"' && count; c++, d++, count--)
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2094 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2095 *d = '\0';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2096 g_hash_table_insert(hash, g_strdup(name), g_strdup(value));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2097 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2098 return hash;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2099 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2100
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2101 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
2102 {
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2103 GaimConnection *gc = (GaimConnection *)user_data;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2104 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2105 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2106 const char *sn = gaim_account_get_username(account);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2107 const char *pass = gaim_account_get_password(account);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2108 GHashTable *hash = yahoo_login_page_hash(buf, len);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2109 GString *url = g_string_new("GET /config/login?login=");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2110 char md5[33], *hashp = md5, *chal;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2111 int i;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2112 md5_byte_t result[16];
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2113 md5_state_t ctx;
7191
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2114
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2115 url = g_string_append(url, sn);
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2116 url = g_string_append(url, "&passwd=");
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
2117
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2118 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2119 md5_append(&ctx, pass, strlen(pass));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2120 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2121 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2122 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2123 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2124 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2125 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2126 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2127 md5_append(&ctx, chal, strlen(chal));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2128 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2129 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2130 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2131 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2132 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2133 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2134 /*
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2135 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2136 md5_append(&ctx, md5, strlen(md5));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2137 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2138 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2139 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2140 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2141 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2142 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2143 */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2144 g_free(chal);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2145
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2146 url = g_string_append(url, md5);
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2147 g_hash_table_foreach(hash, (GHFunc)yahoo_login_page_hash_iter, url);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2148
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2149 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
2150 "Host: login.yahoo.com\r\n\r\n");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2151 g_hash_table_destroy(hash);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2152 yd->auth = g_string_free(url, FALSE);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2153 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
2154 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2155 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2156 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2157 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2158
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2159 #endif /* YAHOO_WEBMESSENGER */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2160
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2161 #ifndef YAHOO_WEBMESSENGER
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2162 static void yahoo_server_check(GaimAccount *account)
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2163 {
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2164 const char *server;
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2165
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2166 server = gaim_account_get_string(account, "server", YAHOO_PAGER_HOST);
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2167
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2168 if (strcmp(server, "scs.yahoo.com") == 0)
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2169 gaim_account_set_string(account, "server", YAHOO_PAGER_HOST);
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2170 }
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2171 #endif
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2172
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2173 static void yahoo_login(GaimAccount *account) {
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2174 GaimConnection *gc = gaim_account_get_connection(account);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2175 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2176
9041
812e7aa7eafa [gaim-migrate @ 9817]
Tim Ringenbach <marv@pidgin.im>
parents: 9030
diff changeset
2177 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
2178
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2179 gaim_connection_update_progress(gc, _("Connecting"), 1, 2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2180
8235
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8216
diff changeset
2181 gaim_connection_set_display_name(gc, gaim_account_get_username(account));
63c7a16a2c09 [gaim-migrate @ 8958]
Mark Doliner <mark@kingant.net>
parents: 8216
diff changeset
2182
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2183 yd->fd = -1;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2184 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
2185 yd->confs = NULL;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2186 yd->conf_id = 2;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2187
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2188 #ifndef YAHOO_WEBMESSENGER
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2189
7883
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2190 yahoo_server_check(account);
30ed1fc892aa [gaim-migrate @ 8537]
Luke Schierer <lschiere@pidgin.im>
parents: 7878
diff changeset
2191
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2192 if (gaim_proxy_connect(account,
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2193 gaim_account_get_string(account, "server", YAHOO_PAGER_HOST),
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2194 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2195 yahoo_got_connected, gc) != 0)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2196 {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
2197 gaim_connection_error(gc, _("Connection problem"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2198 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2199 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2200
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2201 #else
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2202 gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE,
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
2203 yahoo_login_page_cb, gc);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
2204 #endif
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2205
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
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2208 static void yahoo_close(GaimConnection *gc) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2209 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2210
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2211 g_hash_table_destroy(yd->friends);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2212 g_slist_free(yd->confs);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2213 if (yd->chat_name)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2214 g_free(yd->chat_name);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2215
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2216 if (yd->cookie_y)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2217 g_free(yd->cookie_y);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2218 if (yd->cookie_t)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2219 g_free(yd->cookie_t);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2220
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2221 if (yd->fd >= 0)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2222 close(yd->fd);
3720
34c95669952f [gaim-migrate @ 3853]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3642
diff changeset
2223
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2224 if (yd->rxqueue)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2225 g_free(yd->rxqueue);
2687
2d544f48146d [gaim-migrate @ 2700]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2686
diff changeset
2226 yd->rxlen = 0;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2227 if (gc->inpa)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2228 gaim_input_remove(gc->inpa);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2229 g_free(yd);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2230 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2231
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2232 static const char *yahoo_list_icon(GaimAccount *a, GaimBuddy *b)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2233 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
2234 return "yahoo";
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2235 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2236
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2237 static void yahoo_list_emblems(GaimBuddy *b, char **se, char **sw, char **nw, char **ne)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2238 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2239 int i = 0;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2240 char *emblems[4] = {NULL,NULL,NULL,NULL};
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2241 GaimAccount *account;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2242 GaimConnection *gc;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2243 struct yahoo_data *yd;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2244 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2245
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2246 if (!b || !(account = b->account) || !(gc = gaim_account_get_connection(account)) ||
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2247 !(yd = gc->proto_data))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2248 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2249
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2250 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2251 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2252 *se = "notauthorized";
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2253 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2254 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2255
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
2256 if (b->present == GAIM_BUDDY_OFFLINE) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2257 *se = "offline";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2258 return;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2259 } else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2260 if (f->away)
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2261 emblems[i++] = "away";
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2262 if (f->sms)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2263 emblems[i++] = "wireless";
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2264 if (f->game)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2265 emblems[i++] = "game";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2266 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2267 *se = emblems[0];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2268 *sw = emblems[1];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2269 *nw = emblems[2];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2270 *ne = emblems[3];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2271 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2272
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2273 static char *yahoo_get_status_string(enum yahoo_status a)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2274 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2275 switch (a) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2276 case YAHOO_STATUS_BRB:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2277 return _("Be Right Back");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2278 case YAHOO_STATUS_BUSY:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2279 return _("Busy");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2280 case YAHOO_STATUS_NOTATHOME:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2281 return _("Not At Home");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2282 case YAHOO_STATUS_NOTATDESK:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2283 return _("Not At Desk");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2284 case YAHOO_STATUS_NOTINOFFICE:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2285 return _("Not In Office");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2286 case YAHOO_STATUS_ONPHONE:
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2287 return _("On The Phone");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2288 case YAHOO_STATUS_ONVACATION:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2289 return _("On Vacation");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2290 case YAHOO_STATUS_OUTTOLUNCH:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2291 return _("Out To Lunch");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2292 case YAHOO_STATUS_STEPPEDOUT:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2293 return _("Stepped Out");
2873
26be84883f91 [gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
2294 case YAHOO_STATUS_INVISIBLE:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2295 return _("Invisible");
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2296 case YAHOO_STATUS_IDLE:
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2297 return _("Idle");
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2298 case YAHOO_STATUS_OFFLINE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2299 return _("Offline");
2879
5fc5123b7098 [gaim-migrate @ 2892]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2878
diff changeset
2300 default:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2301 return _("Online");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2302 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2303 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2304
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2305 static void yahoo_initiate_conference(GaimBlistNode *node, gpointer data) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2306
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2307 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2308 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2309
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2310 GHashTable *components;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2311 struct yahoo_data *yd;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2312 int id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2313
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2314 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2315
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2316 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2317 gc = gaim_account_get_connection(buddy->account);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2318 yd = gc->proto_data;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2319 id = yd->conf_id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2320
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2321 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
2322 g_hash_table_replace(components, g_strdup("room"),
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2323 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
2324 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
2325 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference"));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2326 yahoo_c_join(gc, components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2327 g_hash_table_destroy(components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2328
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2329 yahoo_c_invite(gc, id, "Join my conference...", buddy->name);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2330 }
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2331
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2332 static void yahoo_game(GaimBlistNode *node, gpointer data) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2333
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2334 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2335 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2336
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2337 struct yahoo_data *yd;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2338 char *game = NULL;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2339 char *t;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2340 char url[256];
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2341 struct yahoo_friend *f;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2342
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2343 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2344
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2345 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2346 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2347 yd = (struct yahoo_data *) gc->proto_data;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2348
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2349 f = g_hash_table_lookup(yd->friends, buddy->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2350 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2351 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2352
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2353 game = f->game;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2354 if (!game)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2355 return;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2356
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2357 t = game = g_strdup(strstr(game, "ante?room="));
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2358 while (*t != '\t')
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2359 t++;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2360 *t = 0;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2361 g_snprintf(url, sizeof url, "http://games.yahoo.com/games/%s", game);
6465
fb64cc87bc96 [gaim-migrate @ 6974]
Christian Hammond <chipx86@chipx86.com>
parents: 6371
diff changeset
2362 gaim_notify_uri(gc, url);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2363 g_free(game);
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2364 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2365
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2366 static char *yahoo_status_text(GaimBuddy *b)
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2367 {
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2368 struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2369 struct yahoo_friend *f = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2370 char *stripped = NULL;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2371
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2372 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2373 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2374 return g_strdup(_("Not on server list"));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2375
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2376 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2377 case YAHOO_STATUS_AVAILABLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2378 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2379 case YAHOO_STATUS_IDLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2380 if (f->idle == -1)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2381 return g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2382 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2383 case YAHOO_STATUS_CUSTOM:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2384 if (!f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2385 return NULL;
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
2386 stripped = gaim_markup_strip_html(f->msg);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2387 if (stripped) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2388 char *ret = g_markup_escape_text(stripped, strlen(stripped));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2389 g_free(stripped);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2390 return ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2391 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2392 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2393 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2394 return g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2395 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2396 }
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2397
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2398 static char *yahoo_tooltip_text(GaimBuddy *b)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
2399 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
2400 struct yahoo_data *yd = (struct yahoo_data*)b->account->gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2401 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2402 char *escaped, *status, *ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2403
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2404 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2405 if (!f)
8591
f96795b786d2 [gaim-migrate @ 9342]
Mark Doliner <mark@kingant.net>
parents: 8589
diff changeset
2406 status = g_strdup_printf("\n%s", _("Not on server list"));
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2407 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2408 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2409 case YAHOO_STATUS_IDLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2410 if (f->idle == -1) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2411 status = g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2412 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2413 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2414 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2415 case YAHOO_STATUS_CUSTOM:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2416 if (!f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2417 return NULL;
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
2418 status = gaim_markup_strip_html(f->msg);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2419 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2420 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2421 status = g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2422 break;
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4732
diff changeset
2423 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2424
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2425 escaped = g_markup_escape_text(status, strlen(status));
8591
f96795b786d2 [gaim-migrate @ 9342]
Mark Doliner <mark@kingant.net>
parents: 8589
diff changeset
2426 ret = g_strdup_printf(_("\n<b>%s:</b> %s"), _("Status"), escaped);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2427 g_free(status);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2428 g_free(escaped);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2429
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2430 return ret;
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2431 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2432
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2433 static void yahoo_addbuddyfrommenu_cb(GaimBlistNode *node, gpointer data)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2434 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2435 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2436 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2437
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2438 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2439
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2440 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2441 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2442
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2443 yahoo_add_buddy(gc, buddy->name, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2444 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2445
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2446
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2447 static void yahoo_chat_goto_menu(GaimBlistNode *node, gpointer data)
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2448 {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2449 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2450 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2451
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2452 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2453
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2454 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2455 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2456
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2457 yahoo_chat_goto(gc, buddy->name);
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2458 }
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2459
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2460
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2461 static void yahoo_ask_send_file_menu(GaimBlistNode *node, gpointer data)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2462 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2463 GaimBuddy *buddy;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2464 GaimConnection *gc;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2465
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2466 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(node));
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2467
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2468 buddy = (GaimBuddy *) node;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2469 gc = gaim_account_get_connection(buddy->account);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2470
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2471 yahoo_ask_send_file(gc, buddy->name);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2472 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2473
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2474
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2475 static GList *yahoo_buddy_menu(GaimBuddy *buddy)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2476 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2477 GList *m = NULL;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2478 GaimBlistNodeAction *act;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2479
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2480 GaimConnection *gc = gaim_account_get_connection(buddy->account);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2481 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2482 static char buf2[1024];
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2483 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2484
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2485 f = g_hash_table_lookup(yd->friends, buddy->name);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2486
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2487 if (!f) {
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2488 act = gaim_blist_node_action_new(_("Add Buddy"),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2489 yahoo_addbuddyfrommenu_cb, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2490 m = g_list_append(m, act);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2491
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2492 return m;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2493
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2494 } else if (f->status == YAHOO_STATUS_OFFLINE) {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2495 return NULL;
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2496 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2497
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2498 act = gaim_blist_node_action_new(_("Join in Chat"),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2499 yahoo_chat_goto_menu, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2500 m = g_list_append(m, act);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2501
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2502 act = gaim_blist_node_action_new(_("Initiate Conference"),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2503 yahoo_initiate_conference, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2504 m = g_list_append(m, act);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2505
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2506 /* FIXME: remove this when the ui does it for us. */
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2507 act = gaim_blist_node_action_new(_("Send File"),
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2508 yahoo_ask_send_file_menu, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2509 m = g_list_append(m, act);
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
2510
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2511 if (f->game) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2512 char *game = f->game;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2513 char *room;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2514 char *t;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2515
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2516 if (!game)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2517 return m;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2518
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2519 if (!(room = strstr(game, "&follow="))) /* skip ahead to the url */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2520 return m;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2521 while (*room && *room != '\t') /* skip to the tab */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2522 room++;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2523 t = room++; /* room as now at the name */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2524 while (*t != '\n')
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2525 t++; /* replace the \n with a space */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2526 *t = ' ';
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2527 g_snprintf(buf2, sizeof buf2, "%s", room);
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2528
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2529 act = gaim_blist_node_action_new(buf2, yahoo_game, NULL);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2530 m = g_list_append(m, act);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2531 }
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2532
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2533 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2534 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2535
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2536
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2537 static GList *yahoo_blist_node_menu(GaimBlistNode *node)
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2538 {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2539 if(GAIM_BLIST_NODE_IS_BUDDY(node)) {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2540 return yahoo_buddy_menu((GaimBuddy *) node);
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2541 } else {
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2542 return NULL;
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2543 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2544 }
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2545
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
2546
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2547 static void yahoo_act_id(GaimConnection *gc, const char *entry)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2548 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2549 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2550
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2551 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_IDACT, YAHOO_STATUS_AVAILABLE, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2552 yahoo_packet_hash(pkt, 3, entry);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2553 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2554 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2555
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2556 gaim_connection_set_display_name(gc, entry);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2557 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2558
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2559 static void yahoo_show_act_id(GaimPluginAction *action)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2560 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2561 GaimConnection *gc = (GaimConnection *) action->context;
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2562 gaim_request_input(gc, NULL, _("Active which ID?"), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8620
diff changeset
2563 gaim_connection_get_display_name(gc), FALSE, FALSE, NULL,
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2564 _("OK"), G_CALLBACK(yahoo_act_id),
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2565 _("Cancel"), NULL, gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2566 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2567
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2568 static void yahoo_show_chat_goto(GaimPluginAction *action)
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2569 {
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2570 GaimConnection *gc = (GaimConnection *) action->context;
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2571 gaim_request_input(gc, NULL, _("Join who in chat?"), NULL,
8697
725413cc9fb9 [gaim-migrate @ 9450]
Mark Doliner <mark@kingant.net>
parents: 8620
diff changeset
2572 "", FALSE, FALSE, NULL,
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2573 _("OK"), G_CALLBACK(yahoo_chat_goto),
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2574 _("Cancel"), NULL, gc);
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2575 }
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2576
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2577 static GList *yahoo_actions(GaimPlugin *plugin, gpointer context) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2578 GList *m = NULL;
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2579 GaimPluginAction *act;
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2580
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2581 act = gaim_plugin_action_new(_("Activate ID..."),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2582 yahoo_show_act_id);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2583 m = g_list_append(m, act);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2584
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2585 act = gaim_plugin_action_new(_("Join user in chat..."),
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2586 yahoo_show_chat_goto);
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
2587 m = g_list_append(m, act);
7878
cbfbed263d00 [gaim-migrate @ 8532]
Luke Schierer <lschiere@pidgin.im>
parents: 7865
diff changeset
2588
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2589 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2590 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2591
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7112
diff changeset
2592 static int yahoo_send_im(GaimConnection *gc, const char *who, const char *what, GaimConvImFlags flags)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2593 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2594 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2595 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
2596 char *msg = yahoo_html_to_codes(what);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2597 char *msg2;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2598 gboolean utf8 = TRUE;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2599
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2600 msg2 = yahoo_string_encode(gc, msg, &utf8);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2601
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2602 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2603 yahoo_packet_hash(pkt, 5, who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2604 if (utf8)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2605 yahoo_packet_hash(pkt, 97, "1");
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2606 yahoo_packet_hash(pkt, 14, msg2);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2607
2681
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 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2610
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2611 yahoo_packet_free(pkt);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2612
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2613 g_free(msg);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2614 g_free(msg2);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2615
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2616 return 1;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2617 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2618
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2619 int yahoo_send_typing(GaimConnection *gc, const char *who, int typ)
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2620 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2621 struct yahoo_data *yd = gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2622 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_NOTIFY, YAHOO_STATUS_TYPING, 0);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2623 yahoo_packet_hash(pkt, 49, "TYPING");
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2624 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2625 yahoo_packet_hash(pkt, 14, " ");
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
2626 yahoo_packet_hash(pkt, 13, typ == GAIM_TYPING ? "1" : "0");
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2627 yahoo_packet_hash(pkt, 5, who);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2628 yahoo_packet_hash(pkt, 1002, "1");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2629
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2630 yahoo_send_packet(yd, pkt);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2631
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2632 yahoo_packet_free(pkt);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2633
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
2634 return 0;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2635 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2636
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2637 static void yahoo_set_away(GaimConnection *gc, const char *state, const char *msg)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2638 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2639 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2640 struct yahoo_packet *pkt;
2772
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2641 int service;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2642 char s[4];
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2643 char *conv_msg = NULL;
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2644 char *conv_msg2 = NULL;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2645
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2646 if (gc->away) {
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2647 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2648 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2649 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2650
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2651 if (msg) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2652 yd->current_status = YAHOO_STATUS_CUSTOM;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2653 gc->away = g_strndup(msg, YAHOO_MAX_STATUS_MESSAGE_LENGTH);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2654 } else if (state) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2655 gc->away = g_strdup("");
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2656 if (!strcmp(state, _("Available"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2657 yd->current_status = YAHOO_STATUS_AVAILABLE;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2658 } else if (!strcmp(state, _("Be Right Back"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2659 yd->current_status = YAHOO_STATUS_BRB;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2660 } else if (!strcmp(state, _("Busy"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2661 yd->current_status = YAHOO_STATUS_BUSY;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2662 } else if (!strcmp(state, _("Not At Home"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2663 yd->current_status = YAHOO_STATUS_NOTATHOME;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2664 } else if (!strcmp(state, _("Not At Desk"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2665 yd->current_status = YAHOO_STATUS_NOTATDESK;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2666 } else if (!strcmp(state, _("Not In Office"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2667 yd->current_status = YAHOO_STATUS_NOTINOFFICE;
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2668 } else if (!strcmp(state, _("On The Phone"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2669 yd->current_status = YAHOO_STATUS_ONPHONE;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2670 } else if (!strcmp(state, _("On Vacation"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2671 yd->current_status = YAHOO_STATUS_ONVACATION;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2672 } else if (!strcmp(state, _("Out To Lunch"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2673 yd->current_status = YAHOO_STATUS_OUTTOLUNCH;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2674 } else if (!strcmp(state, _("Stepped Out"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2675 yd->current_status = YAHOO_STATUS_STEPPEDOUT;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2676 } else if (!strcmp(state, _("Invisible"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2677 yd->current_status = YAHOO_STATUS_INVISIBLE;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2678 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { /* this should never happen? */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2679 if (gc->is_idle) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2680 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2681 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2682 yd->current_status = YAHOO_STATUS_AVAILABLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2683 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2684 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2685 } else if (gc->is_idle) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2686 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2687 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2688 yd->current_status = YAHOO_STATUS_AVAILABLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2689 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2690
2772
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2691 if (yd->current_status == YAHOO_STATUS_AVAILABLE)
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2692 service = YAHOO_SERVICE_ISBACK;
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2693 else
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2694 service = YAHOO_SERVICE_ISAWAY;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2695
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2696 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2697 g_snprintf(s, sizeof(s), "%d", yd->current_status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2698 yahoo_packet_hash(pkt, 10, s);
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2699
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2700 if ((yd->current_status == YAHOO_STATUS_CUSTOM) && gc->away) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2701 conv_msg = yahoo_string_encode(gc, gc->away, NULL);
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2702 conv_msg2 = gaim_unescape_html(conv_msg);
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2703 yahoo_packet_hash(pkt, 19, conv_msg2);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2704 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2705
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2706 if ((yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2707 (yd->current_status != YAHOO_STATUS_IDLE)) {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2708 if (gc->is_idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2709 yahoo_packet_hash(pkt, 47, "2");
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2710 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2711 yahoo_packet_hash(pkt, 47, "1");
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
2712 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2713
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2714 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2715 yahoo_packet_free(pkt);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2716 if (conv_msg)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2717 g_free(conv_msg);
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2718 if (conv_msg2)
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2719 g_free(conv_msg2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2720 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2721
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2722 static void yahoo_set_idle(GaimConnection *gc, int idle)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2723 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2724 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2725 struct yahoo_packet *pkt = NULL;
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2726 char *msg = NULL, *msg2 = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2727
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2728 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) {
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2729 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2730 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2731 } else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2732 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2733 yd->current_status = YAHOO_STATUS_AVAILABLE;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2734 } else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2735 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2736 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2737
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2738 if (pkt) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2739 char buf[4];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2740 g_snprintf(buf, sizeof(buf), "%d", yd->current_status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2741 yahoo_packet_hash(pkt, 10, buf);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2742 if (gc->away && yd->current_status == YAHOO_STATUS_CUSTOM) {
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2743 msg = yahoo_string_encode(gc, gc->away, NULL);
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2744 msg2 = gaim_unescape_html(msg);
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2745 yahoo_packet_hash(pkt, 19, msg2);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2746 if (idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2747 yahoo_packet_hash(pkt, 47, "2");
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2748 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2749 yahoo_packet_hash(pkt, 47, "1"); /* fixme when available messages are possible */
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2750 } else if (idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2751 (yd->current_status != YAHOO_STATUS_IDLE)) {
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2752 yahoo_packet_hash(pkt, 47, "2");
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2753 } else if (!idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2754 (yd->current_status != YAHOO_STATUS_IDLE)) {
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2755 yahoo_packet_hash(pkt, 47, "1");
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2756 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2757
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2758 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2759 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2760 }
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2761 if (msg)
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2762 g_free(msg);
8503
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2763 if (msg2)
4c3ec649fd7d [gaim-migrate @ 9239]
Mark Doliner <mark@kingant.net>
parents: 8482
diff changeset
2764 g_free(msg2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2765 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2766
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2767 static GList *yahoo_away_states(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2768 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2769 GList *m = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2770
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2771 m = g_list_append(m, _("Available"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2772 m = g_list_append(m, _("Be Right Back"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2773 m = g_list_append(m, _("Busy"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2774 m = g_list_append(m, _("Not At Home"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2775 m = g_list_append(m, _("Not At Desk"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2776 m = g_list_append(m, _("Not In Office"));
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2777 m = g_list_append(m, _("On The Phone"));
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2778 m = g_list_append(m, _("On Vacation"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2779 m = g_list_append(m, _("Out To Lunch"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2780 m = g_list_append(m, _("Stepped Out"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2781 m = g_list_append(m, _("Invisible"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2782 m = g_list_append(m, GAIM_AWAY_CUSTOM);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2783
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2784 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2785 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2786
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2787 static void yahoo_keepalive(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2788 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2789 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2790 struct yahoo_packet *pkt = yahoo_packet_new(YAHOO_SERVICE_PING, YAHOO_STATUS_AVAILABLE, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2791 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2792 yahoo_packet_free(pkt);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2793
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2794 if (!yd->chat_online)
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2795 return;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2796
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2797 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2798 yahoo_packet_hash(pkt, 109, gaim_connection_get_display_name(gc));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2799 yahoo_send_packet(yd, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2800 yahoo_packet_free(pkt);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2801 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2802
6787
faa491042c66 [gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents: 6784
diff changeset
2803 static void yahoo_add_buddy(GaimConnection *gc, const char *who, GaimGroup *foo)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2804 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2805 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2806 struct yahoo_packet *pkt;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2807 GaimGroup *g;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2808 char *group = NULL;
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
2809 char *group2 = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2810
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2811 if (!yd->logged_in)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2812 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2813
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2814 if (foo)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2815 group = foo->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2816 if (!group) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2817 g = gaim_find_buddys_group(gaim_find_buddy(gc->account, who));
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2818 if (g)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2819 group = g->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2820 else
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2821 group = "Buddies";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2822 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2823
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
2824 group2 = yahoo_string_encode(gc, group, NULL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2825 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2826 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2827 yahoo_packet_hash(pkt, 7, who);
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
2828 yahoo_packet_hash(pkt, 65, group2);
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
2829 yahoo_packet_hash(pkt, 14, "");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2830 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2831 yahoo_packet_free(pkt);
7829
4bc847ab3bb4 [gaim-migrate @ 8481]
Ethan Blanton <elb@pidgin.im>
parents: 7827
diff changeset
2832 g_free(group2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2833 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2834
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2835 static void yahoo_remove_buddy(GaimConnection *gc, const char *who, const char *group)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2836 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2837 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2838 struct yahoo_friend *f;
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
2839 struct yahoo_packet *pkt;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2840 GSList *buddies, *l;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2841 GaimGroup *g;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2842 gboolean remove = TRUE;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2843 char *cg;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2844
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2845 if (!(f = g_hash_table_lookup(yd->friends, who)))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2846 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2847
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2848 buddies = gaim_find_buddies(gaim_connection_get_account(gc), who);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2849 for (l = buddies; l; l = l->next) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2850 g = gaim_find_buddys_group(l->data);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2851 if (gaim_utf8_strcasecmp(group, g->name)) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2852 remove = FALSE;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2853 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2854 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2855 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2856
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2857 g_slist_free(buddies);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2858
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2859 if (remove)
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
2860 g_hash_table_remove(yd->friends, who);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2861
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2862 cg = yahoo_string_encode(gc, group, NULL);
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
2863 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2864 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2865 yahoo_packet_hash(pkt, 7, who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2866 yahoo_packet_hash(pkt, 65, cg);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2867 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2868 yahoo_packet_free(pkt);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
2869 g_free(cg);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2870 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2871
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2872 static void yahoo_add_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2873 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2874 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2875
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2876 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2877 return;
8057
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2878 /* It seems to work better without this */
2c4cfb63ce60 [gaim-migrate @ 8743]
Sean Egan <seanegan@gmail.com>
parents: 8046
diff changeset
2879
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2880 /* if (gc->account->perm_deny != 4)
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2881 return; */
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2882
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2883 if (!who || who[0] == '\0')
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2884 return;
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
2885
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2886 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2887 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2888 yahoo_packet_hash(pkt, 7, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2889 yahoo_packet_hash(pkt, 13, "1");
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2890 yahoo_send_packet(yd, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2891 yahoo_packet_free(pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2892 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2893
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2894 static void yahoo_rem_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2895 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2896 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2897
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2898 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2899 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2900
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2901 if (!who || who[0] == '\0')
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2902 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2903
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2904 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2905 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2906 yahoo_packet_hash(pkt, 7, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2907 yahoo_packet_hash(pkt, 13, "2");
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2908 yahoo_send_packet(yd, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2909 yahoo_packet_free(pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2910 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2911
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2912 static void yahoo_set_permit_deny(GaimConnection *gc) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2913 GaimAccount *acct;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2914 GSList *deny;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2915
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2916 acct = gc->account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2917
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2918 switch (acct->perm_deny) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2919 case 1:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2920 case 3:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2921 case 5:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2922 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2923 yahoo_rem_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2924 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2925 case 4:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2926 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2927 yahoo_add_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2928 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2929 case 2:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2930 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2931 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2932 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2933 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2934
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2935 static gboolean yahoo_unload_plugin(GaimPlugin *plugin)
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2936 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2937 yahoo_dest_colorht();
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2938 return TRUE;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2939 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2940
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2941 static void yahoo_got_info(void *data, const char *url_text, size_t len)
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2942 {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2943 YahooGetInfoData *info_data = (YahooGetInfoData *)data;
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2944 char *stripped, *p;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2945 char buf[1024];
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
2946 gboolean found = FALSE;
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2947 char *url_buffer;
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
2948 GString *s;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
2949 int stripped_len;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2950
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2951 gaim_debug_info("yahoo", "In yahoo_got_info\n");
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2952
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2953 /* we failed to grab the profile URL */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2954 if (url_text == NULL || strcmp(url_text, "") == 0) {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2955 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2956 _("<html><body><b>Error retrieving profile</b></body></html>"),
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2957 NULL, NULL);
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2958
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2959 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2960 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2961 return;
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2962 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2963
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2964 /* we don't yet support the multiple link level of the warning page for
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2965 * 'adult' profiles, not to mention the fact that yahoo wants you to be
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2966 * logged in (on the website) to be able to view an 'adult' profile. for
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2967 * now, just tell them that we can't help them, and provide a link to the
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2968 * profile if they want to do the web browser thing.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2969 */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2970 p = strstr(url_text, "Adult Profiles Warning Message");
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2971 if (p) {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2972 g_snprintf(buf, 1024, "<html><body>%s%s<a href=\"%s%s\">%s%s</a></body></html>",
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2973 _("<b>Sorry, profiles marked as containing adult content are not supported at this time.</b><br><br>\n"),
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2974 _("If you wish to view this profile, you will need to visit this link in your web browser<br>"),
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2975 YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2976
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2977 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2978 buf, NULL, NULL);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2979
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2980 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2981 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2982 return;
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2983 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2984
6630
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2985 /* at the moment we don't support profile pages with languages other than
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2986 * english. the problem is, that every user may choose his/her own profile
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2987 * language. this language has nothing to do with the preferences of the
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
2988 * user which looks at the profile
6630
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2989 */
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2990 p = strstr(url_text, "Last Updated:");
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2991 if (!p) {
7550
ebf1f580d6a9 [gaim-migrate @ 8164]
Luke Schierer <lschiere@pidgin.im>
parents: 7478
diff changeset
2992 p = strstr(url_text, "Last Updated&nbsp;");
ebf1f580d6a9 [gaim-migrate @ 8164]
Luke Schierer <lschiere@pidgin.im>
parents: 7478
diff changeset
2993 }
ebf1f580d6a9 [gaim-migrate @ 8164]
Luke Schierer <lschiere@pidgin.im>
parents: 7478
diff changeset
2994 if (!p) {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2995 g_snprintf(buf, 1024, "<html><body>%s%s<a href=\"%s%s\">%s%s</a></body></html>",
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2996 _("<b>Sorry, non-English profiles are not supported at this time.</b><br><br>\n"),
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2997 _("If you wish to view this profile, you will need to visit this link in your web browser<br>"),
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2998 YAHOO_PROFILE_URL, info_data->name, YAHOO_PROFILE_URL, info_data->name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2999
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3000 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3001 buf, NULL, NULL);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
3002
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
3003 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
3004 g_free(info_data);
6630
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
3005 return;
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
3006 }
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
3007
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3008 url_buffer = g_strdup(url_text);
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3009
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3010 /*
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3011 * gaim_markup_strip_html() doesn't strip out character entities like &nbsp;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3012 * and &#183;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3013 */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3014 while ((p = strstr(url_buffer, "&nbsp;")) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3015 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3016 url_buffer[strlen(url_buffer) - 6] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3017 }
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3018 while ((p = strstr(url_buffer, "&#183;")) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3019 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3020 url_buffer[strlen(url_buffer) - 6] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3021 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3022
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3023 /* nuke the nasty \r's */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3024 while ((p = strchr(url_buffer, '\r')) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3025 memmove(p, p + 1, strlen(p + 1));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3026 url_buffer[strlen(url_buffer) - 1] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3027 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3028
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3029 /* nuke the html, it's easier than trying to parse the horrid stuff */
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
3030 stripped = gaim_markup_strip_html(url_buffer);
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3031 stripped_len = strlen(stripped);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3032
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3033 gaim_debug_misc("yahoo", "stripped = %p\n", stripped);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3034 gaim_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3035
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3036 /* gonna re-use the memory we've already got for url_buffer */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3037 /* no we're not */
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3038 s = g_string_sized_new(strlen(url_buffer));
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3039 g_string_append(s, "<html><body>\n");
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3040
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3041 /* extract their Yahoo! ID and put it in. Don't bother marking has_info as
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3042 * true, since the Yahoo! ID will always be there */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3043 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Yahoo! ID:", 2, "\n", 0,
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3044 NULL, _("Yahoo! ID"), 0, NULL))
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3045 g_string_append_printf(s, "<b>%s:</b> %s<br>", _("Yahoo! ID"), info_data->name);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3046
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3047
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3048 /* extract their Email address and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3049 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "My Email", 5, "\n", 0,
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
3050 "Private", _("Email"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3051
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3052 /* extract the Nickname if it exists */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3053 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Nickname:", 1, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3054 NULL, _("Nickname"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3055
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3056 /* extract their RealName and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3057 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "RealName:", 1, "\n", '\n',
6623
156e6643f9db [gaim-migrate @ 7147]
Luke Schierer <lschiere@pidgin.im>
parents: 6622
diff changeset
3058 NULL, _("Realname"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3059
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3060 /* extract their Location and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3061 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Location:", 2, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3062 NULL, _("Location"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3063
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3064 /* extract their Age and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3065 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Age:", 3, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3066 NULL, _("Age"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3067
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3068 /* extract their MaritalStatus and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3069 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "MaritalStatus:", 3, "\n", '\n',
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
3070 "No Answer", _("Marital Status"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3071
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3072 /* extract their Gender and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3073 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Gender:", 3, "\n", '\n',
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
3074 "No Answer", _("Gender"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3075
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3076 /* extract their Occupation and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3077 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Occupation:", 2, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3078 NULL, _("Occupation"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3079
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3080 /* Hobbies, Latest News, and Favorite Quote are a bit different, since the
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3081 * values can contain embedded newlines... but any or all of them can also
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3082 * not appear. The way we delimit them is to successively look for the next
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3083 * one that _could_ appear, and if all else fails, we end the section by
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3084 * looking for the 'Links' heading, which is the next thing to follow this
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3085 * bunch.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3086 */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3087
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3088 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Latest News",
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3089 '\n', NULL, _("Hobbies"), 0, NULL))
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3090 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3091 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Favorite Quote",
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3092 '\n', NULL, _("Hobbies"), 0, NULL))
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3093 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3094 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Hobbies:", 1, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3095 '\n', NULL, _("Hobbies"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3096 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3097 else
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3098 found = TRUE;
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3099 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3100 else
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3101 found = TRUE;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3102
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3103 if (!gaim_markup_extract_info_field(stripped, stripped_len, s, "Latest News:", 1, "Favorite Quote",
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3104 '\n', NULL, _("Latest News"), 0, NULL))
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3105 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3106 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Latest News:", 1, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3107 '\n', NULL, _("Latest News"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3108 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3109 else
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3110 found = TRUE;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3111
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3112 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Favorite Quote:", 0, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3113 '\n', NULL, _("Favorite Quote"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3114
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3115 /* Home Page will either be "No home page specified",
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3116 * or "Home Page: " and a link. */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3117 p = strstr(stripped, "No home page specified");
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3118 if(!p)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3119 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3120 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Home Page:", 1, " ", 0, NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3121 _("Home Page"), 1, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3122 }
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3123
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3124 /* Cool Link {1,2,3} is also different. If "No cool link specified" exists,
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3125 * then we have none. If we have one however, we'll need to check and see if
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3126 * we have a second one. If we have a second one, we have to check to see if
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3127 * we have a third one.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3128 */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3129 p = strstr(stripped,"No cool link specified");
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3130 if (!p)
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3131 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3132 if (gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 1:", 1, " ", 0, NULL,
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3133 _("Cool Link 1"), 1, NULL))
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3134 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3135 found = TRUE;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3136 if (gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 2:", 1, " ", 0, NULL,
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3137 _("Cool Link 2"), 1, NULL))
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3138 gaim_markup_extract_info_field(stripped, stripped_len, s, "Cool Link 3:", 1, " ", 0, NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3139 _("Cool Link 3"), 1, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3140 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3141 }
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3142
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3143 /* see if Member Since is there, and if so, extract it. */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3144 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Member Since:", 1, "Last Updated:",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3145 '\n', NULL, _("Member Since"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3146
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3147 /* extract the Last Updated date and put it in */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3148 found |= gaim_markup_extract_info_field(stripped, stripped_len, s, "Last Updated:", 1, "\n", '\n', NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
3149 _("Last Updated"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3150
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3151 /* finish off the html */
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3152 g_string_append(s, "</body></html>\n");
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3153 g_free(stripped);
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3154
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3155 if(found)
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3156 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3157 /* show it to the user */
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3158 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3159 s->str, NULL, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3160 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3161 else
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3162 {
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3163 char *primary;
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3164 primary = g_strdup_printf(_("User information for %s unavailable"), info_data->name);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3165 gaim_notify_error(info_data->gc, NULL, primary,
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3166 _("The user's profile is empty."));
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3167 g_free(primary);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3168 }
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3169
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
3170 g_free(url_buffer);
7675
66d9440db6ec [gaim-migrate @ 8319]
Luke Schierer <lschiere@pidgin.im>
parents: 7664
diff changeset
3171 g_string_free(s, TRUE);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
3172 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
3173 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3174 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3175
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3176 static void yahoo_get_info(GaimConnection *gc, const char *name)
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3177 {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3178 YahooGetInfoData *data;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3179 char *url;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3180
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3181 data = g_new0(YahooGetInfoData, 1);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3182 data->gc = gc;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3183 data->name = g_strdup(name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3184
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3185 url = g_strdup_printf("%s%s", YAHOO_PROFILE_URL, name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3186
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3187 gaim_url_fetch(url, FALSE, NULL, FALSE, yahoo_got_info, data);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3188
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
3189 g_free(url);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3190 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3191
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3192 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3193 const char *old_group, const char *new_group)
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3194 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3195 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3196 struct yahoo_packet *pkt;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3197 char *gpn, *gpo;
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3198
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3199 /* Step 0: If they aren't on the server list anyway,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3200 * don't bother letting the server know.
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3201 */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3202 if (!g_hash_table_lookup(yd->friends, who))
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3203 return;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3204
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3205 /* If old and new are the same, we would probably
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3206 * end up deleting the buddy, which would be bad.
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3207 * This might happen because of the charset conversation.
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3208 */
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3209 gpn = yahoo_string_encode(gc, new_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3210 gpo = yahoo_string_encode(gc, old_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3211 if (!strcmp(gpn, gpo)) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3212 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3213 g_free(gpo);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3214 return;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3215 }
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3216
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3217 /* Step 1: Add buddy to new group. */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3218 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3219 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3220 yahoo_packet_hash(pkt, 7, who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3221 yahoo_packet_hash(pkt, 65, gpn);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3222 yahoo_packet_hash(pkt, 14, "");
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3223 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3224 yahoo_packet_free(pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3225
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3226 /* Step 2: Remove buddy from old group */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3227 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3228 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3229 yahoo_packet_hash(pkt, 7, who);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3230 yahoo_packet_hash(pkt, 65, gpo);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3231 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3232 yahoo_packet_free(pkt);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3233 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3234 g_free(gpo);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3235 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3236
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3237 static void yahoo_rename_group(GaimConnection *gc, const char *old_group,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3238 const char *new_group, GList *whocares)
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3239 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3240 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3241 struct yahoo_packet *pkt;
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3242 char *gpn, *gpo;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3243
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3244 gpn = yahoo_string_encode(gc, new_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3245 gpo = yahoo_string_encode(gc, old_group, NULL);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3246 if (!strcmp(gpn, gpo)) {
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3247 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3248 g_free(gpo);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3249 return;
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3250 }
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3251
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3252 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3253 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3254 yahoo_packet_hash(pkt, 65, gpo);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3255 yahoo_packet_hash(pkt, 67, gpn);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3256 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3257 yahoo_packet_free(pkt);
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3258 g_free(gpn);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3259 g_free(gpo);
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3260 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3261
7696
29bcd6e3da33 [gaim-migrate @ 8341]
Mark Doliner <mark@kingant.net>
parents: 7675
diff changeset
3262 #if 0
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3263 static gboolean yahoo_has_send_file(GaimConnection *gc, const char *who)
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3264 {
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3265 return TRUE;
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3266 }
7696
29bcd6e3da33 [gaim-migrate @ 8341]
Mark Doliner <mark@kingant.net>
parents: 7675
diff changeset
3267 #endif
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3268
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3269 static GaimPlugin *my_protocol = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
3270
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3271 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3272 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8735
diff changeset
3273 GAIM_PRPL_API_VERSION,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3274 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3275 NULL, /* user_splits */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3276 NULL, /* protocol_options */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3277 yahoo_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3278 yahoo_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3279 yahoo_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3280 yahoo_tooltip_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3281 yahoo_away_states,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3282 yahoo_blist_node_menu,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3283 yahoo_c_info,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3284 yahoo_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3285 yahoo_close,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3286 yahoo_send_im,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3287 NULL, /* set info */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3288 yahoo_send_typing,
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
3289 yahoo_get_info,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3290 yahoo_set_away,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3291 yahoo_set_idle,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3292 NULL, /* change_passwd*/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3293 yahoo_add_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3294 NULL, /* add_buddies */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3295 yahoo_remove_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3296 NULL, /*remove_buddies */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3297 NULL, /* add_permit */
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3298 yahoo_add_deny,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3299 NULL, /* rem_permit */
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3300 yahoo_rem_deny,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
3301 yahoo_set_permit_deny,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3302 NULL, /* warn */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3303 yahoo_c_join,
8562
e3c059c3d92d [gaim-migrate @ 9306]
Luke Schierer <lschiere@pidgin.im>
parents: 8503
diff changeset
3304 NULL, /* reject chat invite */
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3305 yahoo_c_invite,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3306 yahoo_c_leave,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3307 NULL, /* chat whisper */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3308 yahoo_c_send,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3309 yahoo_keepalive,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3310 NULL, /* register_user */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3311 NULL, /* get_cb_info */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3312 NULL, /* get_cb_away */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3313 NULL, /* alias_buddy */
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3314 yahoo_change_buddys_group,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
3315 yahoo_rename_group,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3316 NULL, /* buddy_free */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3317 NULL, /* convo_closed */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
3318 NULL, /* normalize */
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3319 NULL, /* set_buddy_icon */
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3320 NULL, /* void (*remove_group)(GaimConnection *gc, const char *group);*/
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3321 NULL, /* char *(*get_cb_real_name)(GaimConnection *gc, int id, const char *who); */
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3322 #if 0
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3323 yahoo_ask_send_file,
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3324 yahoo_send_file,
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3325 yahoo_has_send_file,
7651
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3326 #endif
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3327 NULL,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3328 NULL,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3329 yahoo_roomlist_get_list,
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3330 yahoo_roomlist_cancel,
9030
7ab20f829190 [gaim-migrate @ 9806]
Mark Doliner <mark@kingant.net>
parents: 9015
diff changeset
3331 yahoo_roomlist_expand_category
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3332 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3333
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3334 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3335 {
8749
d7b8eb1f0a18 [gaim-migrate @ 9504]
Christian Hammond <chipx86@chipx86.com>
parents: 8735
diff changeset
3336 GAIM_PLUGIN_API_VERSION, /**< api_version */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3337 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3338 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3339 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3340 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3341 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3342
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3343 "prpl-yahoo", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3344 "Yahoo", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3345 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3346 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3347 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3348 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3349 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3350 NULL, /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6321
diff changeset
3351 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3352
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3353 NULL, /**< load */
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3354 yahoo_unload_plugin, /**< unload */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3355 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3356
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3357 NULL, /**< ui_info */
8993
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
3358 &prpl_info, /**< extra_info */
294ae6548d4e [gaim-migrate @ 9768]
Luke Schierer <lschiere@pidgin.im>
parents: 8950
diff changeset
3359 NULL,
9015
67421e0dc497 [gaim-migrate @ 9791]
Luke Schierer <lschiere@pidgin.im>
parents: 8993
diff changeset
3360 yahoo_actions
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3361 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3362
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3363 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
3364 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3365 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
3366 GaimAccountOption *option;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3367
7827
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3368 option = gaim_account_option_string_new(_("Pager host"), "server", YAHOO_PAGER_HOST);
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3369 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
3370
ee32e030c9be [gaim-migrate @ 8479]
Ethan Blanton <elb@pidgin.im>
parents: 7823
diff changeset
3371 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
3372 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
3373
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3374 option = gaim_account_option_string_new(_("File transfer host"), "xfer_host", YAHOO_XFER_HOST);
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3375 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
3376
580bd39219a2 [gaim-migrate @ 8295]
Luke Schierer <lschiere@pidgin.im>
parents: 7631
diff changeset
3377 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
3378 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
3379
8113
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3380 option = gaim_account_option_string_new(_("Chat Room List Url"), "room_list", YAHOO_ROOMLIST_URL);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3381 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option);
d60272410bd5 [gaim-migrate @ 8817]
Nathan Walp <nwalp@pidgin.im>
parents: 8087
diff changeset
3382
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3383 my_protocol = plugin;
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3384
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
3385 yahoo_init_colorht();
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3386 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
3387
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
3388 GAIM_INIT_PLUGIN(yahoo, init_plugin, info);