annotate src/protocols/yahoo/yahoo.c @ 7209:43b76be7796a

[gaim-migrate @ 7778] Gettin' ready for 0.71. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 09 Oct 2003 19:50:34 +0000
parents 4bd3892cded3
children 1930e3d00ecd
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 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net>
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx>
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
6 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
7 * This program is free software; you can redistribute it and/or modify
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
8 * 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
9 * the Free Software Foundation; either version 2 of the License, or
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
10 * (at your option) any later version.
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
11 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful,
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
15 * GNU General Public License for more details.
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
16 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
17 * You should have received a copy of the GNU General Public License
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
18 * along with this program; if not, write to the Free Software
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
20 *
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
21 */
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
22 #include "internal.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
23
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
24 #include "account.h"
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
25 #include "accountopt.h"
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
26 #include "blist.h"
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
27 #include "debug.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
28 #include "multi.h"
5872
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"
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
40 #include "md5.h"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
41
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
42 extern char *yahoo_crypt(const char *, const char *);
2795
536bb833fdeb [gaim-migrate @ 2808]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2786
diff changeset
43
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
44 typedef struct
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
45 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
46 GaimConnection *gc;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
47 char *name;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
48 } YahooGetInfoData;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
49
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
50
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
51 /* #define YAHOO_DEBUG */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
52
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
53 #define USEROPT_MAIL 0
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
54
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
55 #define YAHOO_PAGER_HOST "scs.yahoo.com"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
56 #define YAHOO_PAGER_PORT 5050
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
57 #define YAHOO_PROFILE_URL "http://profiles.yahoo.com/"
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
58
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
59 #ifdef YAHOO_WEBMESSENGER
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
60 #define YAHOO_PROTO_VER 0x0065
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
61 #else
6810
bc8f329c1341 [gaim-migrate @ 7350]
Sean Egan <seanegan@gmail.com>
parents: 6804
diff changeset
62 #define YAHOO_PROTO_VER 0x000b
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
63 #endif
3467
79e0d2f8ad2b [gaim-migrate @ 3517]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
64
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
65 #define YAHOO_PACKET_HDRLEN (4 + 2 + 2 + 2 + 2 + 4 + 4)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
66
6791
9927df765fae [gaim-migrate @ 7330]
Luke Schierer <lschiere@pidgin.im>
parents: 6787
diff changeset
67 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
68
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
69 static struct yahoo_friend *yahoo_friend_new()
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
70 {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
71 struct yahoo_friend *ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
72
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
73 ret = g_new0(struct yahoo_friend, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
74 ret->status = YAHOO_STATUS_OFFLINE;
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 return ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
77 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
78
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
79 static void yahoo_friend_free(gpointer p)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
80 {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
81 struct yahoo_friend *f = p;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
82 if (f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
83 g_free(f->msg);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
84 if (f->game)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
85 g_free(f->game);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
86 g_free(f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
87 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
88
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
89 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
90 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
91 struct yahoo_packet *pkt = g_new0(struct yahoo_packet, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
92
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
93 pkt->service = service;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
94 pkt->status = status;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
95 pkt->id = id;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
96
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
97 return pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
98 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
99
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
100 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
101 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
102 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
103 pair->key = key;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
104 pair->value = g_strdup(value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
105 pkt->hash = g_slist_append(pkt->hash, pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
106 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
107
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
108 static int yahoo_packet_length(struct yahoo_packet *pkt)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
109 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
110 GSList *l;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
111
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
112 int len = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
113
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
114 l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
115 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
116 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
117 int tmp = pair->key;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
118 do {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
119 tmp /= 10;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
120 len++;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
121 } while (tmp);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
122 len += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
123 len += strlen(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
124 len += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
125 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
126 }
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 return len;
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
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
131 /* sometimes i wish prpls could #include things from other prpls. then i could just
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
132 * use the routines from libfaim and not have to admit to knowing how they work. */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
133 #define yahoo_put16(buf, data) ( \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
134 (*(buf) = (u_char)((data)>>8)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
135 (*((buf)+1) = (u_char)(data)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
136 2)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
137 #define yahoo_get16(buf) ((((*(buf))<<8)&0xff00) + ((*((buf)+1)) & 0xff))
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
138 #define yahoo_put32(buf, data) ( \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
139 (*((buf)) = (u_char)((data)>>24)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
140 (*((buf)+1) = (u_char)((data)>>16)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
141 (*((buf)+2) = (u_char)((data)>>8)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
142 (*((buf)+3) = (u_char)(data)&0xff), \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
143 4)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
144 #define yahoo_get32(buf) ((((*(buf))<<24)&0xff000000) + \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
145 (((*((buf)+1))<<16)&0x00ff0000) + \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
146 (((*((buf)+2))<< 8)&0x0000ff00) + \
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
147 (((*((buf)+3) )&0x000000ff)))
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
148
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
149 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
150 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
151 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
152
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
153 while (pos + 1 < len) {
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
154 char key[64], *value = NULL, *esc;
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
155 int accept;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
156 int x;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
157
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
158 struct yahoo_pair *pair = g_new0(struct yahoo_pair, 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
159
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
160 x = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
161 while (pos + 1 < len) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
162 if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
163 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
164 key[x++] = data[pos++];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
165 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
166 key[x] = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
167 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
168 pair->key = strtol(key, NULL, 10);
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
169 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
170
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
171 if (len - pos + 1 <= 0) {
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
172 /* Truncated. Garbage or something. */
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
173 accept = 0;
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
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
176 if (accept) {
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
177 value = g_malloc(len - pos + 1);
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
178 x = 0;
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
179 while (pos + 1 < len) {
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
180 if (data[pos] == 0xc0 && data[pos + 1] == 0x80)
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
181 break;
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
182 value[x++] = data[pos++];
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
183 }
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
184 value[x] = 0;
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
185 pair->value = g_strdup(value);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
186 g_free(value);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
187 pkt->hash = g_slist_append(pkt->hash, pair);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
188 esc = g_strescape(pair->value, NULL);
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
189 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
190 "Key: %d \tValue: %s\n", pair->key, esc);
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
191 g_free(esc);
2724
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
192 } else {
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
193 g_free(pair);
7f3f4aa114ad [gaim-migrate @ 2737]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2723
diff changeset
194 }
3996
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
195 pos += 2;
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
196
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
197 /* Skip over garbage we've noticed in the mail notifications */
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
198 if (data[0] == '9' && data[pos] == 0x01)
3fdfe7872118 [gaim-migrate @ 4191]
Christian Hammond <chipx86@chipx86.com>
parents: 3768
diff changeset
199 pos++;
2681
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 }
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 static void yahoo_packet_write(struct yahoo_packet *pkt, guchar *data)
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 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
206 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
207
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
208 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
209 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
210 guchar buf[100];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
211
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
212 g_snprintf(buf, sizeof(buf), "%d", pair->key);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
213 strcpy(data + pos, buf);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
214 pos += strlen(buf);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
215 data[pos++] = 0xc0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
216 data[pos++] = 0x80;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
217
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
218 strcpy(data + pos, pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
219 pos += strlen(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
220 data[pos++] = 0xc0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
221 data[pos++] = 0x80;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
222
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
223 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
224 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
225 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
226
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
227 static void yahoo_packet_dump(guchar *data, int len)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
228 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
229 #ifdef YAHOO_DEBUG
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
230 int i;
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
231
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
232 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
233
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
234 for (i = 0; i + 1 < len; i += 2) {
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
235 if ((i % 16 == 0) && i) {
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
236 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
237 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
238 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
239
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
240 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
241 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
242 if (i < len)
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
243 gaim_debug(GAIM_DEBUG_MISC, NULL, "%02x", data[i]);
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
244
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
245 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
246 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
247
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
248 for (i = 0; i < len; i++) {
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
249 if ((i % 16 == 0) && i) {
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
250 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
251 gaim_debug(GAIM_DEBUG_MISC, "yahoo", "");
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
252 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
253
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
254 if (g_ascii_isprint(data[i]))
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
255 gaim_debug(GAIM_DEBUG_MISC, NULL, "%c ", data[i]);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
256 else
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
257 gaim_debug(GAIM_DEBUG_MISC, NULL, ". ");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
258 }
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
259
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
260 gaim_debug(GAIM_DEBUG_MISC, NULL, "\n");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
261 #endif
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
262 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
263
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
264 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
265 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
266 int pktlen = yahoo_packet_length(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
267 int len = YAHOO_PACKET_HDRLEN + pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
268 int ret;
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 guchar *data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
271 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
272
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
273 if (yd->fd < 0)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
274 return -1;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
275
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
276 data = g_malloc0(len + 1);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
277
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
278 memcpy(data + pos, "YMSG", 4); pos += 4;
3467
79e0d2f8ad2b [gaim-migrate @ 3517]
Sean Egan <seanegan@gmail.com>
parents: 3466
diff changeset
279 pos += yahoo_put16(data + pos, YAHOO_PROTO_VER);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
280 pos += yahoo_put16(data + pos, 0x0000);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
281 pos += yahoo_put16(data + pos, pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
282 pos += yahoo_put16(data + pos, pkt->service);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
283 pos += yahoo_put32(data + pos, pkt->status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
284 pos += yahoo_put32(data + pos, pkt->id);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
285
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
286 yahoo_packet_write(pkt, data + pos);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
287
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
288 yahoo_packet_dump(data, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
289 ret = write(yd->fd, data, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
290 g_free(data);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
291
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
292 return ret;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
293 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
294
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
295 void yahoo_packet_free(struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
296 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
297 while (pkt->hash) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
298 struct yahoo_pair *pair = pkt->hash->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
299 g_free(pair->value);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
300 g_free(pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
301 pkt->hash = g_slist_remove(pkt->hash, pair);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
302 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
303 g_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
304 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
305
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
306 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
307 {
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
308 int online = 1;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
309
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
310 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
311 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
312
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
313 if (f->status == YAHOO_STATUS_OFFLINE)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
314 online = 0;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
315
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
316 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
317 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
318
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
319 static void yahoo_process_status(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
320 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
321 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
322 GSList *l = pkt->hash;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
323 struct yahoo_friend *f = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
324 char *name = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
325
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
326
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
327 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
328 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
329
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
330 switch (pair->key) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
331 case 0: /* we won't actually do anything with this */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
332 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
333 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
334 if (!yd->logged_in) {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
335 gaim_connection_set_state(gc, GAIM_CONNECTED);
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
336 serv_finish_login(gc);
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
337 gaim_connection_set_display_name(gc, pair->value);
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
338 yd->logged_in = TRUE;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
339
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
340 /* 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
341 *
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
342 * 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
343 * requested
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
344 *
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
345 * do_import(gc, NULL);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
346 * newpkt = yahoo_packet_new(YAHOO_SERVICE_LIST, YAHOO_STATUS_OFFLINE, 0);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
347 * yahoo_send_packet(yd, newpkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
348 * yahoo_packet_free(newpkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
349 */
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
350
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
351 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
352 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
353 case 8: /* how many online buddies we have */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
354 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
355 case 7: /* the current buddy */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
356 name = pair->value;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
357 f = g_hash_table_lookup(yd->friends, name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
358 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
359 f = yahoo_friend_new();
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
360 g_hash_table_insert(yd->friends, g_strdup(name), f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
361 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
362 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
363 case 10: /* state */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
364 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
365 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
366
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
367 f->status = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
368 if ((f->status >= YAHOO_STATUS_BRB) && (f->status <= YAHOO_STATUS_STEPPEDOUT))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
369 f->away = 1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
370 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
371 f->away = 0;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
372 if (f->status == YAHOO_STATUS_IDLE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
373 f->idle = time(NULL);
6804
3ef17670e69f [gaim-migrate @ 7344]
Luke Schierer <lschiere@pidgin.im>
parents: 6796
diff changeset
374 else
3ef17670e69f [gaim-migrate @ 7344]
Luke Schierer <lschiere@pidgin.im>
parents: 6796
diff changeset
375 f->idle = 0;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
376 if (f->status != YAHOO_STATUS_CUSTOM) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
377 g_free(f->msg);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
378 f->msg = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
379 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
380
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
381 f->sms = 0;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
382 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
383 case 19: /* custom message */
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
384 if (f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
385 if (f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
386 g_free(f->msg);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
387 f->msg = g_strdup(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
388 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
389 break;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
390 case 11: /* this is the buddy's session id */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
391 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
392 case 17: /* in chat? */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
393 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
394 case 47: /* is custom status away or not? 2=idle*/
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
395 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
396 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
397 f->away = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
398 if (f->away == 2)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
399 f->idle = time(NULL);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
400 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
401 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
402 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
403 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
404
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
405 if (f->idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
406 f->idle = -1;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
407 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
408 case 137: /* usually idle time in seconds, sometimes login time */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
409 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
410 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
411
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
412 if (f->status != YAHOO_STATUS_AVAILABLE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
413 f->idle = time(NULL) - strtol(pair->value, NULL, 10);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
414 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
415 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
416 if (strtol(pair->value, NULL, 10) == 0) {
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->status = YAHOO_STATUS_OFFLINE;
4732
c15e0699acae [gaim-migrate @ 5047]
Nathan Walp <nwalp@pidgin.im>
parents: 4731
diff changeset
419 serv_got_update(gc, name, 0, 0, 0, 0, 0);
2807
f01e6a425136 [gaim-migrate @ 2820]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2805
diff changeset
420 break;
2805
9b3c7d2a6e9a [gaim-migrate @ 2818]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2795
diff changeset
421 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
422
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
423 if (f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
424 yahoo_update_status(gc, name, f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
425 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
426 case 60: /* SMS */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
427 if (f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
428 f->sms = strtol(pair->value, NULL, 10);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
429 yahoo_update_status(gc, name, f);
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
430 }
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
431 break;
2979
8e924e4aa256 [gaim-migrate @ 2992]
Rob Flynn <gaim@robflynn.com>
parents: 2951
diff changeset
432 case 16: /* Custom error message */
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
433 gaim_notify_error(gc, NULL, pair->value, NULL);
2951
b74f4f7165a1 [gaim-migrate @ 2964]
Rob Flynn <gaim@robflynn.com>
parents: 2918
diff changeset
434 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
435 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
436 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
437 "Unknown status key %d\n", pair->key);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
438 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
439 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
440
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
441 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
442 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
443 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
444
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
445 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
446 gboolean *export)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
447 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
448 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
449 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
450 GSList *list, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
451 gboolean onlist = 0;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
452 char *oname = NULL;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
453
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
454 if (!g_hash_table_lookup_extended(ht, name, (gpointer *) &oname, (gpointer *) &list))
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
455 list = gaim_find_buddies(account, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
456 else
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
457 g_hash_table_steal(ht, name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
458
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
459 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
460 b = i->data;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
461 g = gaim_find_buddys_group(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
462 if (!gaim_utf8_strcasecmp(group, g->name)) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
463 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
464 "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
465 list = g_slist_delete_link(list, i);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
466 onlist = 1;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
467 break;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
468 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
469 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
470
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
471 if (!onlist) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
472 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
473 "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
474 if (!(g = gaim_find_group(group))) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
475 g = gaim_group_new(group);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
476 gaim_blist_add_group(g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
477 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
478 b = gaim_buddy_new(account, name, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
479 gaim_blist_add_buddy(b, NULL, g, NULL);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
480 *export = TRUE;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
481 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
482
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
483 if (list) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
484 if (!oname)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
485 oname = g_strdup(name);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
486 g_hash_table_insert(ht, oname, list);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
487 } else if (oname)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
488 g_free(oname);
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
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
491 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
492 {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
493 char *name = key;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
494 GSList *list = value, *i;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
495 GaimBuddy *b;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
496 GaimGroup *g;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
497 gboolean *export = user_data;
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 if (list)
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
500 *export = TRUE;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
501
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
502 for (i = list; i; i = i->next) {
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
503 b = i->data;
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
504 g = gaim_find_buddys_group(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
505 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
506 gaim_blist_remove_buddy(b);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
507 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
508 }
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
509
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
510 static void yahoo_process_list(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
511 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
512 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
513 gboolean export = FALSE;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
514 gboolean got_serv_list = FALSE;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
515 GaimBuddy *b;
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
516 GaimGroup *g;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
517 struct yahoo_friend *f = NULL;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
518 GaimAccount *account = gaim_connection_get_account(gc);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
519 struct yahoo_data *yd = gc->proto_data;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
520 GHashTable *ht;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
521
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
522 char **lines;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
523 char **split;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
524 char **buddies;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
525 char **tmp, **bud;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
526
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
527 while (l) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
528 struct yahoo_pair *pair = l->data;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
529 l = l->next;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
530
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
531 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
532 case 87:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
533 if (!yd->tmp_serv_blist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
534 yd->tmp_serv_blist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
535 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
536 g_string_append(yd->tmp_serv_blist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
537 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
538 case 88:
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
539 if (!yd->tmp_serv_ilist)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
540 yd->tmp_serv_ilist = g_string_new(pair->value);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
541 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
542 g_string_append(yd->tmp_serv_ilist, pair->value);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
543 break;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
544 }
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
545 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
546
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
547 if (pkt->status != 0)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
548 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
549
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
550 if (yd->tmp_serv_blist) {
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
551 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
552
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
553 lines = g_strsplit(yd->tmp_serv_blist->str, "\n", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
554 for (tmp = lines; *tmp; tmp++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
555 split = g_strsplit(*tmp, ":", 2);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
556 if (!split)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
557 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
558 if (!split[0] || !split[1]) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
559 g_strfreev(split);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
560 continue;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
561 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
562 buddies = g_strsplit(split[1], ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
563 for (bud = buddies; bud && *bud; bud++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
564 if (!(f = g_hash_table_lookup(yd->friends, *bud))) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
565 f = yahoo_friend_new(*bud);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
566 g_hash_table_insert(yd->friends, g_strdup(*bud), f);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
567 }
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
568 if (!(b = gaim_find_buddy(account, *bud))) {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
569 if (!(g = gaim_find_group(split[0]))) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
570 g = gaim_group_new(split[0]);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
571 gaim_blist_add_group(g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
572 }
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
573 b = gaim_buddy_new(account, *bud, NULL);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
574 gaim_blist_add_buddy(b, NULL, g, NULL);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
575 export = TRUE;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
576 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
577
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
578 yahoo_do_group_check(account, ht, *bud, split[0], &export);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
579 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
580 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
581 g_strfreev(split);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
582 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
583 g_strfreev(lines);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
584
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
585 g_string_free(yd->tmp_serv_blist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
586 yd->tmp_serv_blist = NULL;
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
587 g_hash_table_foreach(ht, yahoo_do_group_cleanup, &export);
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
588 g_hash_table_destroy(ht);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
589 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
590
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
591
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
592 if (yd->tmp_serv_ilist) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
593 buddies = g_strsplit(yd->tmp_serv_ilist->str, ",", -1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
594 for (bud = buddies; bud && *bud; bud++) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
595 /* The server is already ignoring the user */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
596 got_serv_list = TRUE;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
597 gaim_privacy_deny_add(gc->account, *bud, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
598 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
599 g_strfreev(buddies);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
600
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
601 g_string_free(yd->tmp_serv_ilist, TRUE);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
602 yd->tmp_serv_ilist = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
603 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
604
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
605 if (got_serv_list) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
606 gc->account->perm_deny = 4;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
607 serv_set_permit_deny(gc);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
608 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
609 if (export)
4349
0c68d402f59f [gaim-migrate @ 4614]
Nathan Walp <nwalp@pidgin.im>
parents: 4333
diff changeset
610 gaim_blist_save();
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
611 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
612
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
613 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
614 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
615 char *msg = NULL;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
616 char *from = NULL;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
617 char *stat = NULL;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
618 char *game = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
619 struct yahoo_friend *f = NULL;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
620 GSList *l = pkt->hash;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
621 struct yahoo_data *yd = (struct yahoo_data*) gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
622
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
623 while (l) {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
624 struct yahoo_pair *pair = l->data;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
625 if (pair->key == 4)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
626 from = pair->value;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
627 if (pair->key == 49)
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
628 msg = pair->value;
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
629 if (pair->key == 13)
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
630 stat = pair->value;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
631 if (pair->key == 14)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
632 game = pair->value;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
633 l = l->next;
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
634 }
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
635
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
636 if (!from || !msg)
3640
1c39909fb476 [gaim-migrate @ 3763]
Sean Egan <seanegan@gmail.com>
parents: 3630
diff changeset
637 return;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
638
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
639 if (!g_ascii_strncasecmp(msg, "TYPING", strlen("TYPING"))) {
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
640 if (*stat == '1')
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
641 serv_got_typing(gc, from, 0, GAIM_TYPING);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
642 else
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
643 serv_got_typing_stopped(gc, from);
4793
677d3cb193a1 [gaim-migrate @ 5113]
Nathan Walp <nwalp@pidgin.im>
parents: 4777
diff changeset
644 } else if (!g_ascii_strncasecmp(msg, "GAME", strlen("GAME"))) {
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
645 GaimBuddy *bud = gaim_find_buddy(gc->account, from);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
646
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
647 if (!bud) {
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
648 gaim_debug(GAIM_DEBUG_WARNING, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
649 "%s is playing a game, and doesn't want "
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
650 "you to know.\n", from);
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
651 }
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
652
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
653 f = g_hash_table_lookup(yd->friends, from);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
654 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
655 return; /* if they're not on the list, don't bother */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
656
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
657 if (f->game) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
658 g_free(f->game);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
659 f->game = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
660 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
661
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
662 if (*stat == '1') {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
663 f->game = g_strdup(game);
3020
c3a29bd2a2d7 [gaim-migrate @ 3033]
Sean Egan <seanegan@gmail.com>
parents: 3019
diff changeset
664 if (bud)
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
665 yahoo_update_status(gc, from, f);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
666 }
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
667 }
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
668 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
669
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
670 static void yahoo_process_message(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
671 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
672 char *msg = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
673 char *from = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
674 time_t tm = time(NULL);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
675 GSList *l = pkt->hash;
6069
5ca86172352a [gaim-migrate @ 6519]
Luke Schierer <lschiere@pidgin.im>
parents: 6061
diff changeset
676
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
677 if (pkt->status <= 1 || pkt->status == 5) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
678 while (l) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
679 struct yahoo_pair *pair = l->data;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
680 if (pair->key == 4)
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
681 from = pair->value;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
682 if (pair->key == 15)
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
683 tm = strtol(pair->value, NULL, 10);
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
684 if (pair->key == 14) {
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
685 char *m;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
686
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
687 msg = pair->value;
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
688
7108
6faeeecab0dc [gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
689 gaim_str_strip_linefeed(msg);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
690 m = yahoo_codes_to_html(msg);
6982
083d1e4a9c78 [gaim-migrate @ 7538]
Mark Doliner <mark@kingant.net>
parents: 6847
diff changeset
691 serv_got_im(gc, from, m, 0, tm);
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
692 g_free(m);
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
693
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
694 tm = time(NULL);
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
695 }
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
696 l = l->next;
6687
d524232faed8 [gaim-migrate @ 7213]
Luke Schierer <lschiere@pidgin.im>
parents: 6686
diff changeset
697 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
698 } else if (pkt->status == 2) {
5436
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
699 gaim_notify_error(gc, NULL,
ad445074d239 [gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents: 5367
diff changeset
700 _("Your Yahoo! message did not get sent."), NULL);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
701 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
702 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
703
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
704 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
705 char *id = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
706 char *who = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
707 char *msg = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
708 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
709
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
710 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
711 struct yahoo_pair *pair = l->data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
712
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
713 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
714 case 1:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
715 id = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
716 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
717 case 3:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
718 who = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
719 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
720 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
721 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
722 case 14:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
723 msg = pair->value;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
724 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
725 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
726 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
727 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
728
2682
db2b0b733732 [gaim-migrate @ 2695]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2681
diff changeset
729 if (id)
7015
dece74f05509 [gaim-migrate @ 7578]
Christian Hammond <chipx86@chipx86.com>
parents: 7013
diff changeset
730 gaim_account_notify_added(gc->account, id, who, NULL, msg);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
731 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
732
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
733 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
734 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
735 char *who = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
736 char *msg = NULL;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
737 GSList *l = pkt->hash;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
738 GString *buf = NULL;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
739 struct yahoo_data *yd = gc->proto_data;
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
740
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
741 while (l) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
742 struct yahoo_pair *pair = l->data;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
743
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
744 switch (pair->key) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
745 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
746 who = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
747 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
748 case 14:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
749 msg = pair->value;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
750 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
751 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
752 l = l->next;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
753 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
754
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
755 if (who) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
756 buf = g_string_sized_new(0);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
757 if (!msg)
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
758 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list."), who);
2683
4836eae8dd8c [gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2682
diff changeset
759 else
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
760 g_string_printf(buf, _("%s has (retroactively) denied your request to add them to your list for the following reason: %s."), who, msg);
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
761 gaim_notify_info(gc, NULL, _("Add buddy rejected"), buf->str);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
762 g_string_free(buf, TRUE);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
763 g_hash_table_remove(yd->friends, who);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
764 serv_got_update(gc, who, 0, 0, 0, 0, 0);
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
765 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
766 }
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
767
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
768 static void yahoo_process_contact(GaimConnection *gc, struct yahoo_packet *pkt)
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
769 {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
770
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
771
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
772 switch (pkt->status) {
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
773 case 1:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
774 yahoo_process_status(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
775 return;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
776 case 3:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
777 yahoo_buddy_added_us(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
778 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
779 case 7:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
780 yahoo_buddy_denied_our_add(gc, pkt);
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
781 break;
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
782 default:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
783 break;
2683
4836eae8dd8c [gaim-migrate @ 2696]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2682
diff changeset
784 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
785 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
786
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
787 static void yahoo_process_mail(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
788 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
789 GaimAccount *account = gaim_connection_get_account(gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
790 char *who = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
791 char *email = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
792 char *subj = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
793 int count = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
794 GSList *l = pkt->hash;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
795
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
796 if (!gaim_account_get_check_mail(account))
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
797 return;
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
798
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
799 while (l) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
800 struct yahoo_pair *pair = l->data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
801 if (pair->key == 9)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
802 count = strtol(pair->value, NULL, 10);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
803 else if (pair->key == 43)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
804 who = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
805 else if (pair->key == 42)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
806 email = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
807 else if (pair->key == 18)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
808 subj = pair->value;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
809 l = l->next;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
810 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
811
4001
9178da61c19f [gaim-migrate @ 4201]
Luke Schierer <lschiere@pidgin.im>
parents: 3996
diff changeset
812 if (who && subj && email && *email) {
2850
cbe6a1e63a72 [gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2813
diff changeset
813 char *from = g_strdup_printf("%s (%s)", who, email);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
814
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
815 gaim_notify_email(gc, subj, from, gaim_account_get_username(account),
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
816 "http://mail.yahoo.com/", NULL, NULL);
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
817
2850
cbe6a1e63a72 [gaim-migrate @ 2863]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2813
diff changeset
818 g_free(from);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
819 } else if (count > 0) {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
820 const char *to = gaim_account_get_username(account);
5521
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
821 const char *url = "http://mail.yahoo.com/";
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
822
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
823 gaim_notify_emails(gc, count, FALSE, NULL, NULL, &to, &url,
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
824 NULL, NULL);
76ec14ba51d7 [gaim-migrate @ 5921]
Christian Hammond <chipx86@chipx86.com>
parents: 5498
diff changeset
825 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
826 }
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
827 /* 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
828 char base64digits[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._";
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
829
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
830 /* 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
831 * 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
832 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
833 /* 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
834 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
835 for (; inlen >= 3; inlen -= 3)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
836 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
837 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
838 *out++ = base64digits[((in[0] << 4) & 0x30) | (in[1] >> 4)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
839 *out++ = base64digits[((in[1] << 2) & 0x3c) | (in[2] >> 6)];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
840 *out++ = base64digits[in[2] & 0x3f];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
841 in += 3;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
842 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
843 if (inlen > 0)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
844 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
845 unsigned char fragment;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
846
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
847 *out++ = base64digits[in[0] >> 2];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
848 fragment = (in[0] << 4) & 0x30;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
849 if (inlen > 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
850 fragment |= in[1] >> 4;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
851 *out++ = base64digits[fragment];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
852 *out++ = (inlen < 2) ? '-' : base64digits[(in[1] << 2) & 0x3c];
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
853 *out++ = '-';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
854 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
855 *out = '\0';
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
856 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
857
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
858 static void yahoo_process_auth_old(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
859 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
860 struct yahoo_packet *pack;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
861 GaimAccount *account = gaim_connection_get_account(gc);
7107
9220c7490cd1 [gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
862 const char *name = gaim_normalize(gaim_account_get_username(account));
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
863 const char *pass = gaim_account_get_password(account);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
864 struct yahoo_data *yd = gc->proto_data;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
865
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
866 /* 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
867 * will soon do so in the rest of the world.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
868 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
869 * The new clients use this authentication method. I warn you in advance, it's
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
870 * bizzare, convoluted, inordinately complicated. It's also no more secure than
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
871 * 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
872 * part clients from connecting to their servers.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
873 *
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
874 * Sorry, Yahoo.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
875 */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
876
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
877 md5_byte_t result[16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
878 md5_state_t ctx;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
879
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
880 char *crypt_result;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
881 char password_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
882 char crypt_hash[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
883 char *hash_string_p = g_malloc(50 + strlen(name));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
884 char *hash_string_c = g_malloc(50 + strlen(name));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
885
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
886 char checksum;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
887
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
888 int sv;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
889
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
890 char result6[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
891 char result96[25];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
892
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
893 sv = seed[15];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
894 sv = sv % 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
895
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
896 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
897 md5_append(&ctx, pass, strlen(pass));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
898 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
899 to_y64(password_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
900
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
901 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
902 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
903 md5_append(&ctx, crypt_result, strlen(crypt_result));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
904 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
905 to_y64(crypt_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
906
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
907 switch (sv) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
908 case 1:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
909 case 6:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
910 checksum = seed[seed[9] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
911 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
912 "%c%s%s%s", checksum, name, seed, password_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
913 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
914 "%c%s%s%s", checksum, name, seed, crypt_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
915 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
916 case 2:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
917 case 7:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
918 checksum = seed[seed[15] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
919 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
920 "%c%s%s%s", checksum, seed, password_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
921 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
922 "%c%s%s%s", checksum, seed, crypt_hash, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
923 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
924 case 3:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
925 checksum = seed[seed[1] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
926 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
927 "%c%s%s%s", checksum, name, password_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
928 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
929 "%c%s%s%s", checksum, name, crypt_hash, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
930 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
931 case 4:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
932 checksum = seed[seed[3] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
933 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
934 "%c%s%s%s", checksum, password_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
935 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
936 "%c%s%s%s", checksum, crypt_hash, seed, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
937 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
938 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
939 case 5:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
940 checksum = seed[seed[7] % 16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
941 g_snprintf(hash_string_p, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
942 "%c%s%s%s", checksum, password_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
943 g_snprintf(hash_string_c, strlen(name) + 50,
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
944 "%c%s%s%s", checksum, crypt_hash, name, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
945 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
946 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
947
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
948 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
949 md5_append(&ctx, hash_string_p, strlen(hash_string_p));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
950 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
951 to_y64(result6, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
952
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
953 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
954 md5_append(&ctx, hash_string_c, strlen(hash_string_c));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
955 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
956 to_y64(result96, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
957
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
958 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
959 yahoo_packet_hash(pack, 0, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
960 yahoo_packet_hash(pack, 6, result6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
961 yahoo_packet_hash(pack, 96, result96);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
962 yahoo_packet_hash(pack, 1, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
963
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
964 yahoo_send_packet(yd, pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
965
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
966 g_free(hash_string_p);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
967 g_free(hash_string_c);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
968
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
969 yahoo_packet_free(pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
970
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
971 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
972
6998
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
973 /* 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
974 * and sending the fix! Thanks guys. */
b11b2880bafd [gaim-migrate @ 7554]
Sean Egan <seanegan@gmail.com>
parents: 6989
diff changeset
975
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
976 static void yahoo_process_auth_new(GaimConnection *gc, const char *seed)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
977 {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
978 struct yahoo_packet *pack = NULL;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
979 GaimAccount *account = gaim_connection_get_account(gc);
7107
9220c7490cd1 [gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
980 const char *name = gaim_normalize(gaim_account_get_username(account));
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
981 const char *pass = gaim_account_get_password(account);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
982 struct yahoo_data *yd = gc->proto_data;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
983
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
984 md5_byte_t result[16];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
985 md5_state_t ctx;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
987 SHA_CTX ctx1;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
988 SHA_CTX ctx2;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
989
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
990 char *alphabet1 = "FBZDWAGHrJTLMNOPpRSKUVEXYChImkwQ";
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
991 char *alphabet2 = "F0E1D2C3B4A59687abcdefghijklmnop";
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
992
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
993 char *challenge_lookup = "qzec2tb3um1olpar8whx4dfgijknsvy5";
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
994 char *operand_lookup = "+|&%/*^-";
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
995 char *delimit_lookup = ",;";
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
996
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
997 char *password_hash = g_malloc0(25);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
998 char *crypt_hash = g_malloc0(25);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
999 char *crypt_result = NULL;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1000 char pass_hash_xor1[64];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1001 char pass_hash_xor2[64];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1002 char crypt_hash_xor1[64];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1003 char crypt_hash_xor2[64];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1004 char resp_6[100];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1005 char resp_96[100];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1006
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1007 unsigned char digest1[20];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1008 unsigned char digest2[20];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1009 unsigned char magic_key_char[4];
6989
56ae951450e5 [gaim-migrate @ 7545]
Nathan Walp <nwalp@pidgin.im>
parents: 6986
diff changeset
1010 const unsigned char *magic_ptr;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1011
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1012 unsigned int magic[64];
7108
6faeeecab0dc [gaim-migrate @ 7673]
Christian Hammond <chipx86@chipx86.com>
parents: 7107
diff changeset
1013 unsigned int magic_work = 0;
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1014
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1015 char comparison_src[20];
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1016 int x;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1017 int cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1018 int magic_cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1019 int magic_len;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1020
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1021 memset(&pass_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1022 memset(&pass_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1023 memset(&crypt_hash_xor1, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1024 memset(&crypt_hash_xor2, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1025 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1026 memset(&digest2, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1027 memset(&magic, 0, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1028 memset(&resp_6, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1029 memset(&resp_96, 0, 100);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1030 memset(&magic_key_char, 0, 4);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1031
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1032 /*
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1033 * Magic: Phase 1. Generate what seems to be a 30
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1034 * byte value (could change if base64
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1035 * ends up differently? I don't remember and I'm
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1036 * tired, so use a 64 byte buffer.
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
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1039 magic_ptr = seed;
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 while (*magic_ptr != (int)NULL) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1042 char *loc;
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 /* Ignore parentheses. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1045
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1046 if (*magic_ptr == '(' || *magic_ptr == ')') {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1047 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1048 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1049 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1050
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1051 /* Characters and digits verify against
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1052 the challenge lookup.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1053 */
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 if (isalpha(*magic_ptr) || isdigit(*magic_ptr)) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1056 loc = strchr(challenge_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1057 if (!loc) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1058 /* This isn't good */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1059 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1060
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1061 /* Get offset into lookup table and lsh 3. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1062
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1063 magic_work = loc - challenge_lookup;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1064 magic_work <<= 3;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1065
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1066 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1067 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1068 } else {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1069 unsigned int local_store;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1070
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1071 loc = strchr(operand_lookup, *magic_ptr);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1072 if (!loc) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1073 /* Also not good. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1074 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1075
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1076 local_store = loc - operand_lookup;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1077
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1078 /* Oops; how did this happen? */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1079 if (magic_cnt >= 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1080 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1081
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1082 magic[magic_cnt++] = magic_work | local_store;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1083 magic_ptr++;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1084 continue;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1085 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1086 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1087
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1088 magic_len = magic_cnt;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1089 magic_cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1090
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1091 /* Magic: Phase 2. Take generated magic value and
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1092 * sprinkle fairy dust on the values. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1093
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1094 for (magic_cnt = magic_len-2; magic_cnt >= 0; magic_cnt--) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1095 unsigned char byte1;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1096 unsigned char byte2;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1097
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1098 /* Bad. Abort.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1099 */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1100 if ((magic_cnt + 1 > magic_len) ||
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1101 (magic_cnt > magic_len))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1102 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1103
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1104 byte1 = magic[magic_cnt];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1105 byte2 = magic[magic_cnt+1];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1106
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1107 byte1 *= 0xcd;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1108 byte1 ^= byte2;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1109
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1110 magic[magic_cnt+1] = byte1;
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
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1113 /* Magic: Phase 3. This computes 20 bytes. The first 4 bytes are used as our magic
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1114 * key (and may be changed later); the next 16 bytes are an MD5 sum of the magic key
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1115 * plus 3 bytes. The 3 bytes are found by looping, and they represent the offsets
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1116 * into particular functions we'll later call to potentially alter the magic key.
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1117 *
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1118 * %-)
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1119 */
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1120
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1121 magic_cnt = 1;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1122 x = 0;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1123
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1124 do {
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1125 unsigned int bl = 0;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1126 unsigned int cl = magic[magic_cnt++];
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1127
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1128 if (magic_cnt >= magic_len)
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1129 break;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1130
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1131 if (cl > 0x7F) {
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1132 if (cl < 0xe0)
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1133 bl = cl = (cl & 0x1f) << 6;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1134 else {
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1135 bl = magic[magic_cnt++];
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1136 cl = (cl & 0x0f) << 6;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1137 bl = ((bl & 0x3f) + cl) << 6;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1138 }
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1139
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1140 cl = magic[magic_cnt++];
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1141 bl = (cl & 0x3f) + bl;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1142 } else
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1143 bl = cl;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1144
7127
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1145 comparison_src[x++] = (bl & 0xff00) >> 8;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1146 comparison_src[x++] = bl & 0xff;
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1147 } while (x < 20);
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1148
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1149 /* First four bytes are magic key. */
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1150 for (x = 0; x < 4; x++)
4c0b7e7118ee [gaim-migrate @ 7694]
Sean Egan <seanegan@gmail.com>
parents: 7118
diff changeset
1151 magic_key_char[x] = comparison_src[x];
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1152
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1153
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1154 /* Get password and crypt hashes as per usual. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1155 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1156 md5_append(&ctx, pass, strlen(pass));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1157 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1158 to_y64(password_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1159
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1160 md5_init(&ctx);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1161 crypt_result = yahoo_crypt(pass, "$1$_2S43d5f$");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1162 md5_append(&ctx, crypt_result, strlen(crypt_result));
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1163 md5_finish(&ctx, result);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1164 to_y64(crypt_hash, result, 16);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1165
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1166 /* Our first authentication response is based off
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1167 * of the password hash. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1168
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1169 for (x = 0; x < (int)strlen(password_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1170 pass_hash_xor1[cnt++] = password_hash[x] ^ 0x36;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1171
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1172 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1173 memset(&(pass_hash_xor1[cnt]), 0x36, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1174
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1175 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1176
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1177 for (x = 0; x < (int)strlen(password_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1178 pass_hash_xor2[cnt++] = password_hash[x] ^ 0x5c;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1179
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1180 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1181 memset(&(pass_hash_xor2[cnt]), 0x5c, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1182
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1183 shaInit(&ctx1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1184 shaInit(&ctx2);
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 /* The first context gets the password hash XORed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1187 * with 0x36 plus a magic value
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1188 * which we previously extrapolated from our
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1189 * challenge. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1190
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1191 shaUpdate(&ctx1, pass_hash_xor1, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1192 shaUpdate(&ctx1, magic_key_char, 4);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1193 shaFinal(&ctx1, digest1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1194
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1195 /* The second context gets the password hash XORed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1196 * with 0x5c plus the SHA-1 digest
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1197 * of the first context. */
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 shaUpdate(&ctx2, pass_hash_xor2, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1200 shaUpdate(&ctx2, digest1, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1201 shaFinal(&ctx2, digest2);
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 /* Now that we have digest2, use it to fetch
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1204 * characters from an alphabet to construct
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1205 * our first authentication response. */
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 for (x = 0; x < 20; x += 2) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1208 unsigned int val = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1209 unsigned int lookup = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1210 char byte[6];
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 memset(&byte, 0, 6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1213
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1214 /* First two bytes of digest stuffed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1215 * together.
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1216 */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1217
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1218 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1219 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1220 val += digest2[x+1];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1221
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1222 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1223 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1224 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1225 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1226 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1227 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1228 strcat(resp_6, "=");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1229
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1230 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1231 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1232 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1233 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1234 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1235 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1236
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1237 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1238 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1239 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1240 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1241 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1242 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1243
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1244 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1245 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1246 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1247 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1248 strcat(resp_6, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1249 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1250
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1251 /* Our second authentication response is based off
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1252 * of the crypto hash. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1253
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1254 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1255 memset(&digest1, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1256 memset(&digest2, 0, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1257
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1258 for (x = 0; x < (int)strlen(crypt_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1259 crypt_hash_xor1[cnt++] = crypt_hash[x] ^ 0x36;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1260
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1261 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1262 memset(&(crypt_hash_xor1[cnt]), 0x36, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1263
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1264 cnt = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1265
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1266 for (x = 0; x < (int)strlen(crypt_hash); x++)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1267 crypt_hash_xor2[cnt++] = crypt_hash[x] ^ 0x5c;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1268
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1269 if (cnt < 64)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1270 memset(&(crypt_hash_xor2[cnt]), 0x5c, 64-cnt);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1271
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1272 shaInit(&ctx1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1273 shaInit(&ctx2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1274
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1275 /* The first context gets the password hash XORed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1276 * with 0x36 plus a magic value
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1277 * which we previously extrapolated from our
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1278 * challenge. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1279
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1280 shaUpdate(&ctx1, crypt_hash_xor1, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1281 shaUpdate(&ctx1, magic_key_char, 4);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1282 shaFinal(&ctx1, digest1);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1283
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1284 /* The second context gets the password hash XORed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1285 * with 0x5c plus the SHA-1 digest
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1286 * of the first context. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1287
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1288 shaUpdate(&ctx2, crypt_hash_xor2, 64);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1289 shaUpdate(&ctx2, digest1, 20);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1290 shaFinal(&ctx2, digest2);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1291
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1292 /* Now that we have digest2, use it to fetch
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1293 * characters from an alphabet to construct
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1294 * our first authentication response. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1295
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1296 for (x = 0; x < 20; x += 2) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1297 unsigned int val = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1298 unsigned int lookup = 0;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1299
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1300 char byte[6];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1301
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1302 memset(&byte, 0, 6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1303
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1304 /* First two bytes of digest stuffed
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1305 * together. */
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1306
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1307 val = digest2[x];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1308 val <<= 8;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1309 val += digest2[x+1];
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1310
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1311 lookup = (val >> 0x0b);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1312 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1313 if (lookup >= strlen(alphabet1))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1314 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1315 sprintf(byte, "%c", alphabet1[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1316 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1317 strcat(resp_96, "=");
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1318
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1319 lookup = (val >> 0x06);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1320 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1321 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1322 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1323 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1324 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1325
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1326 lookup = (val >> 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1327 lookup &= 0x1f;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1328 if (lookup >= strlen(alphabet2))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1329 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1330 sprintf(byte, "%c", alphabet2[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1331 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1332
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1333 lookup = (val & 0x01);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1334 if (lookup >= strlen(delimit_lookup))
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1335 break;
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1336 sprintf(byte, "%c", delimit_lookup[lookup]);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1337 strcat(resp_96, byte);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1338 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1339
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1340 pack = yahoo_packet_new(YAHOO_SERVICE_AUTHRESP, YAHOO_STATUS_AVAILABLE, 0);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1341 yahoo_packet_hash(pack, 0, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1342 yahoo_packet_hash(pack, 6, resp_6);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1343 yahoo_packet_hash(pack, 96, resp_96);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1344 yahoo_packet_hash(pack, 1, name);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1345 yahoo_send_packet(yd, pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1346 yahoo_packet_free(pack);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1347
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1348 free(password_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1349 free(crypt_hash);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1350 }
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1351
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1352 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
1353 {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1354 char *seed = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1355 char *sn = NULL;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1356 GSList *l = pkt->hash;
7010
eb3ed649252e [gaim-migrate @ 7573]
Sean Egan <seanegan@gmail.com>
parents: 6998
diff changeset
1357 int m = 0;
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1358 gchar *buf;
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1359
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1360
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1361 while (l) {
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1362 struct yahoo_pair *pair = l->data;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1363 if (pair->key == 94)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1364 seed = pair->value;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1365 if (pair->key == 1)
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1366 sn = pair->value;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1367 if (pair->key == 13)
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1368 m = atoi(pair->value);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1369 l = l->next;
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1370 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1371
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1372 if (seed) {
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1373 switch (m) {
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1374 case 0:
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1375 yahoo_process_auth_old(gc, seed);
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1376 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1377 case 1:
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1378 yahoo_process_auth_new(gc, seed);
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1379 break;
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1380 default:
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1381 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
1382 "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
1383 "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
1384 gaim_notify_error(gc, "", _("Failed Yahoo! Authentication"),
7043
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1385 buf);
35a567991f76 [gaim-migrate @ 7606]
Luke Schierer <lschiere@pidgin.im>
parents: 7015
diff changeset
1386 g_free(buf);
6986
6290e7aeabfe [gaim-migrate @ 7542]
Sean Egan <seanegan@gmail.com>
parents: 6982
diff changeset
1387 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
1388 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1389 }
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1390 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1391
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1392 static void ignore_buddy(GaimBuddy *b) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1393 GaimGroup *g;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1394 GaimConversation *c;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1395 GaimAccount *account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1396 gchar *name;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1397
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1398 if (!b)
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1399 return;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1400
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1401 g = gaim_find_buddys_group(b);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1402 name = g_strdup(b->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1403 account = b->account;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1404
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1405 gaim_debug(GAIM_DEBUG_INFO, "blist",
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1406 "Removing '%s' from buddy list.\n", b->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1407 serv_remove_buddy(account->gc, name, g->name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1408 gaim_blist_remove_buddy(b);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1409
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1410 serv_add_deny(account->gc, name);
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1411 gaim_blist_save();
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1412
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1413 c = gaim_find_conversation_with_account(name, account);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1414
6792
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1415 if (c != NULL)
62aec9fd7aca [gaim-migrate @ 7331]
Luke Schierer <lschiere@pidgin.im>
parents: 6791
diff changeset
1416 gaim_conversation_update(c, GAIM_CONV_UPDATE_REMOVE);
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1417
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1418 g_free(name);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1419 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1420
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1421 static void keep_buddy(GaimBuddy *b) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1422 gaim_privacy_deny_remove(b->account, b->name, 1);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1423 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1424
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1425 static void yahoo_process_ignore(GaimConnection *gc, struct yahoo_packet *pkt) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1426 GaimBuddy *b;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1427 GSList *l;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1428 gchar *who = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1429 gchar *sn = NULL;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1430 gchar buf[BUF_LONG];
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1431 gint ignore = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1432 gint status = 0;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1433
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1434 for (l = pkt->hash; l; l = l->next) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1435 struct yahoo_pair *pair = l->data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1436 switch (pair->key) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1437 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1438 who = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1439 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1440 case 1:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1441 sn = pair->value;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1442 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1443 case 13:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1444 ignore = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1445 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1446 case 66:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1447 status = strtol(pair->value, NULL, 10);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1448 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1449 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1450 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1451 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1452 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1453
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1454 switch (status) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1455 case 12:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1456 b = gaim_find_buddy(gc->account, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1457 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
1458 "user is on your buddy list. Clicking \"Yes\" "
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1459 "will remove and ignore the buddy."), who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1460 gaim_request_yes_no(gc, NULL, _("Ignore buddy?"), buf, 0, b,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1461 G_CALLBACK(ignore_buddy),
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1462 G_CALLBACK(keep_buddy));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1463 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1464 case 2:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1465 case 3:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1466 case 0:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1467 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1468 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1469 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1470 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1471
6761
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1472 static void yahoo_process_authresp(GaimConnection *gc, struct yahoo_packet *pkt)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1473 {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1474 GSList *l = pkt->hash;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1475 int err = 0;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1476 char *msg;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1477
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1478 while (l) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1479 struct yahoo_pair *pair = l->data;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1480
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1481 if (pair->key == 66)
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1482 err = strtol(pair->value, NULL, 10);
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1483
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1484 l = l->next;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1485 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1486
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1487 switch (err) {
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1488 case 3:
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1489 msg = _("Invalid username.");
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1490 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1491 case 13:
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1492 msg = _("Incorrect password.");
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1493 break;
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1494 default:
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1495 msg = _("Unknown error.");
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1496 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1497 gaim_connection_error(gc, msg);
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1498 }
ddbe06989d46 [gaim-migrate @ 7293]
Luke Schierer <lschiere@pidgin.im>
parents: 6760
diff changeset
1499
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1500 static void yahoo_process_addbuddy(GaimConnection *gc, struct yahoo_packet *pkt)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1501 {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1502 int err = 0;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1503 char *who = NULL;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1504 char *group = NULL;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1505 char *buf;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1506 struct yahoo_friend *f;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1507 struct yahoo_data *yd = gc->proto_data;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1508 GSList *l = pkt->hash;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1509
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1510 while (l) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1511 struct yahoo_pair *pair = l->data;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1512
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1513 switch (pair->key) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1514 case 66:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1515 err = strtol(pair->value, NULL, 10);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1516 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1517 case 7:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1518 who = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1519 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1520 case 65:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1521 group = pair->value;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1522 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1523 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1524
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1525 l = l->next;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1526 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1527
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1528 if (!who)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1529 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1530 if (!group)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1531 group = "";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1532
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1533 if (!err || (err == 2)) { /* 0 = ok, 2 = already on serv list */
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1534 if (!g_hash_table_lookup(yd->friends, who)) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1535 f = yahoo_friend_new();
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1536 g_hash_table_insert(yd->friends, g_strdup(who), f);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1537 yahoo_update_status(gc, who, f);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1538 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1539 return;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1540 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1541
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1542 buf = g_strdup_printf(_("Could not add buddy %s to group %s to the server list on account %s."),
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1543 who, group, gaim_connection_get_display_name(gc));
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1544 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
1545 g_free(buf);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1546 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1547
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1548 static void yahoo_packet_process(GaimConnection *gc, struct yahoo_packet *pkt)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1549 {
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1550 switch (pkt->service) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1551 case YAHOO_SERVICE_LOGON:
2771
450f4f9d2f23 [gaim-migrate @ 2784]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2741
diff changeset
1552 case YAHOO_SERVICE_LOGOFF:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1553 case YAHOO_SERVICE_ISAWAY:
2737
f61c1f3a6afa [gaim-migrate @ 2750]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2724
diff changeset
1554 case YAHOO_SERVICE_ISBACK:
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1555 case YAHOO_SERVICE_GAMELOGON:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1556 case YAHOO_SERVICE_GAMELOGOFF:
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
1557 case YAHOO_SERVICE_CHATLOGON:
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
1558 case YAHOO_SERVICE_CHATLOGOFF:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1559 yahoo_process_status(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1560 break;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1561 case YAHOO_SERVICE_NOTIFY:
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
1562 yahoo_process_notify(gc, pkt);
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
1563 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1564 case YAHOO_SERVICE_MESSAGE:
2786
318f846120e2 [gaim-migrate @ 2799]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2772
diff changeset
1565 case YAHOO_SERVICE_GAMEMSG:
5939
3014de25a8a4 [gaim-migrate @ 6379]
Luke Schierer <lschiere@pidgin.im>
parents: 5921
diff changeset
1566 case YAHOO_SERVICE_CHATMSG:
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1567 yahoo_process_message(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1568 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1569 case YAHOO_SERVICE_NEWMAIL:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1570 yahoo_process_mail(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1571 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1572 case YAHOO_SERVICE_NEWCONTACT:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1573 yahoo_process_contact(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1574 break;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1575 case YAHOO_SERVICE_AUTHRESP:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1576 yahoo_process_authresp(gc, pkt);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1577 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1578 case YAHOO_SERVICE_LIST:
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1579 yahoo_process_list(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1580 break;
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1581 case YAHOO_SERVICE_AUTH:
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1582 yahoo_process_auth(gc, pkt);
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1583 break;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1584 case YAHOO_SERVICE_ADDBUDDY:
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1585 yahoo_process_addbuddy(gc, pkt);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
1586 break;
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1587 case YAHOO_SERVICE_IGNORECONTACT:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1588 yahoo_process_ignore(gc, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
1589 break;
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1590 case YAHOO_SERVICE_CONFINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1591 case YAHOO_SERVICE_CONFADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1592 yahoo_process_conference_invite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1593 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1594 case YAHOO_SERVICE_CONFDECLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1595 yahoo_process_conference_decline(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1596 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1597 case YAHOO_SERVICE_CONFLOGON:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1598 yahoo_process_conference_logon(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1599 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1600 case YAHOO_SERVICE_CONFLOGOFF:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1601 yahoo_process_conference_logoff(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1602 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1603 case YAHOO_SERVICE_CONFMSG:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1604 yahoo_process_conference_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1605 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1606 case YAHOO_SERVICE_CHATONLINE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1607 yahoo_process_chat_online(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1608 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1609 case YAHOO_SERVICE_CHATLOGOUT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1610 yahoo_process_chat_logout(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1611 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1612 case YAHOO_SERVICE_CHATGOTO:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1613 yahoo_process_chat_goto(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1614 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1615 case YAHOO_SERVICE_CHATJOIN:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1616 yahoo_process_chat_join(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1617 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1618 case YAHOO_SERVICE_CHATLEAVE: /* XXX is this right? */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1619 case YAHOO_SERVICE_CHATEXIT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1620 yahoo_process_chat_exit(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1621 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1622 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
1623 case YAHOO_SERVICE_CHATADDINVITE:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1624 yahoo_process_chat_addinvite(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1625 break;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1626 case YAHOO_SERVICE_COMMENT:
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1627 yahoo_process_chat_message(gc, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1628 break;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1629 default:
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1630 gaim_debug(GAIM_DEBUG_ERROR, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1631 "Unhandled service 0x%02x\n", pkt->service);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1632 break;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1633 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1634 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1635
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1636 static void yahoo_pending(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1637 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1638 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1639 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1640 char buf[1024];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1641 int len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1642
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1643 len = read(yd->fd, buf, sizeof(buf));
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1644
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1645 if (len <= 0) {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
1646 gaim_connection_error(gc, _("Unable to read"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1647 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1648 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1649
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1650 yd->rxqueue = g_realloc(yd->rxqueue, len + yd->rxlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1651 memcpy(yd->rxqueue + yd->rxlen, buf, len);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1652 yd->rxlen += len;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1653
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1654 while (1) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1655 struct yahoo_packet *pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1656 int pos = 0;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1657 int pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1658
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1659 if (yd->rxlen < YAHOO_PACKET_HDRLEN)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1660 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1661
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1662 pos += 4; /* YMSG */
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1663 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1664 pos += 2;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1665
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1666 pktlen = yahoo_get16(yd->rxqueue + pos); pos += 2;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1667 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1668 "%d bytes to read, rxlen is %d\n", pktlen, yd->rxlen);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1669
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1670 if (yd->rxlen < (YAHOO_PACKET_HDRLEN + pktlen))
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1671 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1672
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1673 yahoo_packet_dump(yd->rxqueue, YAHOO_PACKET_HDRLEN + pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1674
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1675 pkt = yahoo_packet_new(0, 0, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1676
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1677 pkt->service = yahoo_get16(yd->rxqueue + pos); pos += 2;
3021
18f0e61a6caf [gaim-migrate @ 3034]
Sean Egan <seanegan@gmail.com>
parents: 3020
diff changeset
1678 pkt->status = yahoo_get32(yd->rxqueue + pos); pos += 4;
5220
7b9d78fa051e [gaim-migrate @ 5590]
Christian Hammond <chipx86@chipx86.com>
parents: 5216
diff changeset
1679 gaim_debug(GAIM_DEBUG_MISC, "yahoo",
5216
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1680 "Yahoo Service: 0x%02x Status: %d\n",
00bd3019749e [gaim-migrate @ 5586]
Christian Hammond <chipx86@chipx86.com>
parents: 5205
diff changeset
1681 pkt->service, pkt->status);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1682 pkt->id = yahoo_get32(yd->rxqueue + pos); pos += 4;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1683
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1684 yahoo_packet_read(pkt, yd->rxqueue + pos, pktlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1685
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1686 yd->rxlen -= YAHOO_PACKET_HDRLEN + pktlen;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1687 if (yd->rxlen) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1688 char *tmp = g_memdup(yd->rxqueue + YAHOO_PACKET_HDRLEN + pktlen, yd->rxlen);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1689 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1690 yd->rxqueue = tmp;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1691 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1692 g_free(yd->rxqueue);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1693 yd->rxqueue = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1694 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1695
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1696 yahoo_packet_process(gc, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1697
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1698 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1699 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1700 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1701
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1702 #ifndef YAHOO_WEBMESSENGER
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1703 static void yahoo_got_connected(gpointer data, gint source, GaimInputCondition cond)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1704 {
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1705 GaimConnection *gc = data;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1706 struct yahoo_data *yd;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1707 struct yahoo_packet *pkt;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1708
5590
011a0a975060 [gaim-migrate @ 5994]
Christian Hammond <chipx86@chipx86.com>
parents: 5583
diff changeset
1709 if (!g_list_find(gaim_connections_get_all(), gc)) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1710 close(source);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1711 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1712 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1713
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1714 if (source < 0) {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
1715 gaim_connection_error(gc, _("Unable to connect"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1716 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1717 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1718
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1719 yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1720 yd->fd = source;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1721
3147
3805d9d344f2 [gaim-migrate @ 3163]
Sean Egan <seanegan@gmail.com>
parents: 3074
diff changeset
1722 pkt = yahoo_packet_new(YAHOO_SERVICE_AUTH, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1723
7107
9220c7490cd1 [gaim-migrate @ 7672]
Christian Hammond <chipx86@chipx86.com>
parents: 7095
diff changeset
1724 yahoo_packet_hash(pkt, 1, gaim_normalize(gaim_account_get_username(gaim_connection_get_account(gc))));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1725 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1726
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1727 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1728
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1729 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
1730 }
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1731 #endif
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1732
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1733 #ifdef YAHOO_WEBMESSENGER
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1734 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
1735 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1736 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1737 struct yahoo_data *yd;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1738 struct yahoo_packet *pkt;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1739
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1740 if (!g_list_find(gaim_connections_get_all(), gc)) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1741 close(source);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1742 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1743 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1744
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1745 if (source < 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1746 gaim_connection_error(gc, _("Unable to connect"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1747 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1748 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1749
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1750 yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1751 yd->fd = source;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1752
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1753 pkt = yahoo_packet_new(YAHOO_SERVICE_WEBLOGIN, YAHOO_STATUS_WEBLOGIN, 0);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1754
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1755 yahoo_packet_hash(pkt, 0, gaim_normalize(gaim_account_get_username(gaim_connection_get_account(gc))));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1756 yahoo_packet_hash(pkt, 1, gaim_normalize(gaim_account_get_username(gaim_connection_get_account(gc))));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1757 yahoo_packet_hash(pkt, 6, yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1758 yahoo_send_packet(yd, pkt);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1759
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1760 yahoo_packet_free(pkt);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1761 g_free(yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1762 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
1763 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1764
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1765 static void yahoo_web_pending(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1766 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1767 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1768 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1769 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1770 char buf[1024], buf2[256], *i = buf, *r = buf2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1771 int len, o = 0;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1772
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1773 len = read(source, buf, sizeof(buf));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1774
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1775 if (len <= 0 || strncmp(buf, "HTTP/1.0 302", strlen("HTTP/1.0 302"))) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1776 gaim_connection_error(gc, _("Unable to read"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1777 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1778 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1779
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1780 while ((i = strstr(i, "Set-Cookie: ")) && 0 < 2) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1781 i += strlen("Set-Cookie: ");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1782 for (;*i != ';'; r++, i++) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1783 *r = *i;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1784 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1785 *r=';';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1786 r++;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1787 *r=' ';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1788 r++;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1789 o++;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1790 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1791 /* Get rid of that "; " */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1792 *(r-2) = '\0';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1793 yd->auth = g_strdup(buf2);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1794 gaim_input_remove(gc->inpa);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1795 close(source);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1796
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1797 /* Now we have our cookies to login with. I'll go get the milk. */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1798 if (gaim_proxy_connect(account, "wcs1.msg.sc5.yahoo.com",
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1799 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1800 yahoo_got_web_connected, gc) != 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1801 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1802 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1803 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1804 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1805
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1806 static void yahoo_got_cookies(gpointer data, gint source, GaimInputCondition cond)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1807 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1808 GaimConnection *gc = data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1809 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1810 if (source < 0) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1811 gaim_connection_error(gc, _("Unable to connect"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1812 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1813 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1814 write(source, yd->auth, strlen(yd->auth));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1815 g_free(yd->auth);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1816 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
1817 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1818
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1819 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
1820 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1821 if (!strcmp(key, "passwd"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1822 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1823 url = g_string_append_c(url, '&');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1824 url = g_string_append(url, key);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1825 url = g_string_append_c(url, '=');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1826 if (!strcmp(key, ".save") || !strcmp(key, ".js"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1827 url = g_string_append_c(url, '1');
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1828 else if (!strcmp(key, ".challenge"))
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1829 url = g_string_append(url, val);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1830 else
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1831 url = g_string_append(url, gaim_url_encode(val));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1832 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1833
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1834 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
1835 {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1836 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
1837 const char *c = buf;
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1838 char *d;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1839 char name[64], value[64];
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1840 while ((c < (buf + len)) && (c = strstr(c, "<input "))) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1841 c = strstr(c, "name=\"") + strlen("name=\"");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1842 for (d = name; *c!='"'; c++, d++)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1843 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1844 *d = '\0';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1845 d = strstr(c, "value=\"") + strlen("value=\"");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1846 if (strchr(c, '>') < d)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1847 break;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1848 for (c = d, d = value; *c!='"'; c++, d++)
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1849 *d = *c;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1850 *d = '\0';
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1851 g_hash_table_insert(hash, g_strdup(name), g_strdup(value));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1852 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1853 return hash;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1854 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1855
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1856 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
1857 {
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1858 GaimConnection *gc = (GaimConnection *)user_data;
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1859 GaimAccount *account = gaim_connection_get_account(gc);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1860 struct yahoo_data *yd = gc->proto_data;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1861 const char *sn = gaim_account_get_username(account);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1862 const char *pass = gaim_account_get_password(account);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1863 GHashTable *hash = yahoo_login_page_hash(buf, len);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1864 GString *url = g_string_new("GET /config/login?login=");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1865 char md5[33], *hashp = md5, *chal;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1866 int i;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1867 md5_byte_t result[16];
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1868 md5_state_t ctx;
7191
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
1869
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
1870 url = g_string_append(url, sn);
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
1871 url = g_string_append(url, "&passwd=");
4bd3892cded3 [gaim-migrate @ 7760]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 7161
diff changeset
1872
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1873 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1874 md5_append(&ctx, pass, strlen(pass));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1875 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1876 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1877 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1878 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1879 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1880 chal = g_strconcat(md5, g_hash_table_lookup(hash, ".challenge"), NULL);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1881 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1882 md5_append(&ctx, chal, strlen(chal));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1883 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1884 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1885 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1886 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1887 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1888 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1889 /*
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1890 md5_init(&ctx);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1891 md5_append(&ctx, md5, strlen(md5));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1892 md5_finish(&ctx, result);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1893 hashp = md5;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1894 for (i = 0; i < 16; ++i) {
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1895 g_snprintf(hashp, 3, "%02x", result[i]);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1896 hashp += 2;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1897 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1898 */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1899 g_free(chal);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1900
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1901 url = g_string_append(url, md5);
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1902 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
1903
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1904 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
1905 "Host: login.yahoo.com\r\n\r\n");
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1906 g_hash_table_destroy(hash);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1907
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1908 yd->auth = g_string_free(url, FALSE);
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1909 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
1910 gaim_connection_error(gc, _("Connection problem"));
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1911 return;
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1912 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1913 }
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1914
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1915 #endif /* YAHOO_WEBMESSENGER */
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1916
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1917 static void yahoo_login(GaimAccount *account) {
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1918 GaimConnection *gc = gaim_account_get_connection(account);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1919 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
1920
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
1921 gc->flags |= GAIM_CONNECTION_HTML | GAIM_CONNECTION_NO_BGCOLOR;
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
1922
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1923 gaim_connection_update_progress(gc, _("Connecting"), 1, 2);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1924
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1925 yd->fd = -1;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1926 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
1927 yd->confs = NULL;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1928 yd->conf_id = 2;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1929
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1930 #ifndef YAHOO_WEBMESSENGER
5681
46d7ad0dfa26 [gaim-migrate @ 6100]
Christian Hammond <chipx86@chipx86.com>
parents: 5638
diff changeset
1931 if (gaim_proxy_connect(account, gaim_account_get_string(account, "server", YAHOO_PAGER_HOST),
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1932 gaim_account_get_int(account, "port", YAHOO_PAGER_PORT),
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1933 yahoo_got_connected, gc) != 0) {
6321
3613007cbb6e [gaim-migrate @ 6820]
Luke Schierer <lschiere@pidgin.im>
parents: 6115
diff changeset
1934 gaim_connection_error(gc, _("Connection problem"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1935 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1936 }
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1937 #else
7138
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1938 gaim_url_fetch(WEBMESSENGER_URL, TRUE, "Gaim/" VERSION, FALSE,
f189f8ccaa98 [gaim-migrate @ 7705]
Christian Hammond <chipx86@chipx86.com>
parents: 7134
diff changeset
1939 yahoo_login_page_cb, gc);
7134
67f9b43c402a [gaim-migrate @ 7701]
Sean Egan <seanegan@gmail.com>
parents: 7129
diff changeset
1940 #endif
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1941
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
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
1944 static void yahoo_close(GaimConnection *gc) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1945 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1946
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1947 g_hash_table_destroy(yd->friends);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1948 g_slist_free(yd->confs);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1949 if (yd->chat_name)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1950 g_free(yd->chat_name);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
1951
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1952 if (yd->fd >= 0)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1953 close(yd->fd);
3720
34c95669952f [gaim-migrate @ 3853]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 3642
diff changeset
1954
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1955 if (yd->rxqueue)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1956 g_free(yd->rxqueue);
2687
2d544f48146d [gaim-migrate @ 2700]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2686
diff changeset
1957 yd->rxlen = 0;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1958 if (gc->inpa)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1959 gaim_input_remove(gc->inpa);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1960 g_free(yd);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1961 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1962
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
1963 static const char *yahoo_list_icon(GaimAccount *a, GaimBuddy *b)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1964 {
4687
283fb289c510 [gaim-migrate @ 4998]
Sean Egan <seanegan@gmail.com>
parents: 4634
diff changeset
1965 return "yahoo";
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
1966 }
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1967
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
1968 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
1969 {
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1970 int i = 0;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1971 char *emblems[4] = {NULL,NULL,NULL,NULL};
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1972 GaimAccount *account;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1973 GaimConnection *gc;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1974 struct yahoo_data *yd;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1975 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1976
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1977 if (!b || !(account = b->account) || !(gc = gaim_account_get_connection(account)) ||
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1978 !(yd = gc->proto_data))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1979 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1980
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1981 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1982 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1983 *se = "notauthorized";
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1984 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1985 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1986
5068
b37d7d09ec83 [gaim-migrate @ 5419]
Nathan Walp <nwalp@pidgin.im>
parents: 5002
diff changeset
1987 if (b->present == GAIM_BUDDY_OFFLINE) {
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1988 *se = "offline";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1989 return;
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1990 } else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1991 if (f->away)
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
1992 emblems[i++] = "away";
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1993 if (f->sms)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1994 emblems[i++] = "wireless";
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
1995 if (f->game)
4916
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1996 emblems[i++] = "game";
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1997 }
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1998 *se = emblems[0];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
1999 *sw = emblems[1];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2000 *nw = emblems[2];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2001 *ne = emblems[3];
d9b6b5ae34e4 [gaim-migrate @ 5250]
Sean Egan <seanegan@gmail.com>
parents: 4834
diff changeset
2002 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2003
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2004 static char *yahoo_get_status_string(enum yahoo_status a)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2005 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2006 switch (a) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2007 case YAHOO_STATUS_BRB:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2008 return _("Be Right Back");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2009 case YAHOO_STATUS_BUSY:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2010 return _("Busy");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2011 case YAHOO_STATUS_NOTATHOME:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2012 return _("Not At Home");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2013 case YAHOO_STATUS_NOTATDESK:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2014 return _("Not At Desk");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2015 case YAHOO_STATUS_NOTINOFFICE:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2016 return _("Not In Office");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2017 case YAHOO_STATUS_ONPHONE:
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2018 return _("On The Phone");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2019 case YAHOO_STATUS_ONVACATION:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2020 return _("On Vacation");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2021 case YAHOO_STATUS_OUTTOLUNCH:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2022 return _("Out To Lunch");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2023 case YAHOO_STATUS_STEPPEDOUT:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2024 return _("Stepped Out");
2873
26be84883f91 [gaim-migrate @ 2886]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2856
diff changeset
2025 case YAHOO_STATUS_INVISIBLE:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2026 return _("Invisible");
4730
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2027 case YAHOO_STATUS_IDLE:
9d3b7b106def [gaim-migrate @ 5043]
Sean Egan <seanegan@gmail.com>
parents: 4729
diff changeset
2028 return _("Idle");
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2029 case YAHOO_STATUS_OFFLINE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2030 return _("Offline");
2879
5fc5123b7098 [gaim-migrate @ 2892]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2878
diff changeset
2031 default:
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2032 return _("Online");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2033 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2034 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2035
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2036 static void yahoo_initiate_conference(GaimConnection *gc, const char *name)
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2037 {
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2038 GHashTable *components;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2039 struct yahoo_data *yd;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2040 int id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2041
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2042 yd = gc->proto_data;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2043 id = yd->conf_id;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2044
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2045 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
2046 g_hash_table_replace(components, g_strdup("room"),
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2047 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
2048 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
2049 g_hash_table_replace(components, g_strdup("type"), g_strdup("Conference"));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2050 yahoo_c_join(gc, components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2051 g_hash_table_destroy(components);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2052
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2053 yahoo_c_invite(gc, id, "Join my conference...", name);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2054 }
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2055
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2056 static void yahoo_game(GaimConnection *gc, const char *name) {
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2057 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2058 char *game = NULL;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2059 char *t;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2060 char url[256];
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2061 struct yahoo_friend *f;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2062
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2063 f = g_hash_table_lookup(yd->friends, name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2064 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2065 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2066
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2067 game = f->game;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2068 if (!game)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2069 return;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2070
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2071 t = game = g_strdup(strstr(game, "ante?room="));
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2072 while (*t != '\t')
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2073 t++;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2074 *t = 0;
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2075 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
2076 gaim_notify_uri(gc, url);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2077 g_free(game);
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2078 }
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2079
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2080 static char *yahoo_status_text(GaimBuddy *b)
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2081 {
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2082 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
2083 struct yahoo_friend *f = NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2084 char *stripped = NULL;
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2085
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2086 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2087 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2088 return g_strdup(_("Not on server list"));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2089
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2090 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2091 case YAHOO_STATUS_AVAILABLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2092 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2093 case YAHOO_STATUS_IDLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2094 if (f->idle == -1)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2095 return g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2096 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2097 case YAHOO_STATUS_CUSTOM:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2098 if (!f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2099 return NULL;
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
2100 stripped = gaim_markup_strip_html(f->msg);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2101 if (stripped) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2102 char *ret = g_markup_escape_text(stripped, strlen(stripped));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2103 g_free(stripped);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2104 return ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2105 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2106 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2107 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2108 return g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2109 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2110
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2111 return NULL;
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2112 }
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2113
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2114 static char *yahoo_tooltip_text(GaimBuddy *b)
4724
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
2115 {
b9e7ccf21f9c [gaim-migrate @ 5037]
Sean Egan <seanegan@gmail.com>
parents: 4722
diff changeset
2116 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
2117 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2118 char *escaped, *status, *ret;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2119
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2120 f = g_hash_table_lookup(yd->friends, b->name);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2121 if (!f)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2122 status = g_strdup(_("Not on server list"));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2123 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2124 switch (f->status) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2125 case YAHOO_STATUS_IDLE:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2126 if (f->idle == -1) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2127 status = g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2128 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2129 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2130 return NULL;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2131 case YAHOO_STATUS_CUSTOM:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2132 if (!f->msg)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2133 return NULL;
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
2134 status = gaim_markup_strip_html(f->msg);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2135 break;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2136 default:
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2137 status = g_strdup(yahoo_get_status_string(f->status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2138 break;
4745
01cae9259e2f [gaim-migrate @ 5060]
Nathan Walp <nwalp@pidgin.im>
parents: 4732
diff changeset
2139 }
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2140
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2141 escaped = g_markup_escape_text(status, strlen(status));
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2142 ret = g_strdup_printf(_("<b>Status:</b> %s"), escaped);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2143 g_free(status);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2144 g_free(escaped);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2145
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2146 return ret;
4729
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2147 }
751c37a940dd [gaim-migrate @ 5042]
Nathan Walp <nwalp@pidgin.im>
parents: 4724
diff changeset
2148
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2149 static void yahoo_addbuddyfrommenu_cb(GaimConnection *gc, const char *who)
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2150 {
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2151 yahoo_add_buddy(gc, who, NULL);
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2152 }
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2153
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2154 static GList *yahoo_buddy_menu(GaimConnection *gc, const char *who)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2155 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2156 GList *m = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2157 struct proto_buddy_menu *pbm;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2158 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2159 static char buf2[1024];
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2160 struct yahoo_friend *f;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2161
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2162 f = g_hash_table_lookup(yd->friends, who);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2163
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2164 if (!f) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2165 pbm = g_new0(struct proto_buddy_menu, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2166 pbm->label = _("Add Buddy");
6796
f5f2669970a0 [gaim-migrate @ 7336]
Luke Schierer <lschiere@pidgin.im>
parents: 6795
diff changeset
2167 pbm->callback = yahoo_addbuddyfrommenu_cb;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2168 pbm->gc = gc;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2169 m = g_list_append(m, pbm);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2170
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2171 return m;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2172 }
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2173
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2174 if (f->status == YAHOO_STATUS_OFFLINE)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2175 return NULL;
4722
534eaa4ead94 [gaim-migrate @ 5034]
Sean Egan <seanegan@gmail.com>
parents: 4690
diff changeset
2176
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2177 pbm = g_new0(struct proto_buddy_menu, 1);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2178 pbm->label = _("Join in Chat");
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2179 pbm->callback = yahoo_chat_goto;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2180 pbm->gc = gc;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2181 m = g_list_append(m, pbm);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2182
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2183 pbm = g_new0(struct proto_buddy_menu, 1);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2184 pbm->label = _("Initiate Conference");
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2185 pbm->callback = yahoo_initiate_conference;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2186 pbm->gc = gc;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2187 m = g_list_append(m, pbm);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2188
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2189 if (f->game) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2190 char *game = f->game;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2191 char *room;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2192 char *t;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2193
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2194 if (!game)
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2195 return m;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2196
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2197 pbm = g_new0(struct proto_buddy_menu, 1);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2198 if (!(room = strstr(game, "&follow="))) /* skip ahead to the url */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2199 return m;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2200 while (*room && *room != '\t') /* skip to the tab */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2201 room++;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2202 t = room++; /* room as now at the name */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2203 while (*t != '\n')
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2204 t++; /* replace the \n with a space */
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2205 *t = ' ';
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2206 g_snprintf(buf2, sizeof buf2, "%s", room);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2207 pbm->label = buf2;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2208 pbm->callback = yahoo_game;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2209 pbm->gc = gc;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2210 m = g_list_append(m, pbm);
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2211 }
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2212
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2213 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2214 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2215
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2216 static void yahoo_act_id(GaimConnection *gc, const char *entry)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2217 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2218 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2219
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2220 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
2221 yahoo_packet_hash(pkt, 3, entry);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2222 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2223 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2224
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2225 gaim_connection_set_display_name(gc, entry);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2226 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2227
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2228 static void yahoo_show_act_id(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2229 {
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2230 gaim_request_input(gc, NULL, _("Active which ID?"), NULL,
6035
8c44020a958e [gaim-migrate @ 6485]
Christian Hammond <chipx86@chipx86.com>
parents: 5939
diff changeset
2231 gaim_connection_get_display_name(gc), FALSE, FALSE,
5493
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2232 _("OK"), G_CALLBACK(yahoo_act_id),
3e8487580024 [gaim-migrate @ 5889]
Christian Hammond <chipx86@chipx86.com>
parents: 5436
diff changeset
2233 _("Cancel"), NULL, gc);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2234 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2235
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2236 static GList *yahoo_actions(GaimConnection *gc) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2237 GList *m = NULL;
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2238 struct proto_actions_menu *pam;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2239
4333
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2240 pam = g_new0(struct proto_actions_menu, 1);
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2241 pam->label = _("Activate ID");
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2242 pam->callback = yahoo_show_act_id;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2243 pam->gc = gc;
cc2f780c0505 [gaim-migrate @ 4597]
Mark Doliner <mark@kingant.net>
parents: 4201
diff changeset
2244 m = g_list_append(m, pam);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2245
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2246 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2247 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2248
7118
bf630f7dfdcd [gaim-migrate @ 7685]
Christian Hammond <chipx86@chipx86.com>
parents: 7112
diff changeset
2249 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
2250 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2251 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2252 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
2253 char *msg = yahoo_html_to_codes(what);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2254
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2255 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2256 yahoo_packet_hash(pkt, 5, who);
3493
4b204c262376 [gaim-migrate @ 3553]
Luke Schierer <lschiere@pidgin.im>
parents: 3467
diff changeset
2257 yahoo_packet_hash(pkt, 14, msg);
6044
8642749e55ca [gaim-migrate @ 6494]
Mark Doliner <mark@kingant.net>
parents: 6035
diff changeset
2258 yahoo_packet_hash(pkt, 97, "1");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2259
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2260 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2261
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2262 yahoo_packet_free(pkt);
6629
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2263
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2264 g_free(msg);
bdc448cf4cb6 [gaim-migrate @ 7153]
Luke Schierer <lschiere@pidgin.im>
parents: 6623
diff changeset
2265
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2266 return 1;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2267 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2268
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2269 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
2270 {
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2271 struct yahoo_data *yd = gc->proto_data;
3019
304e8c376472 [gaim-migrate @ 3032]
Sean Egan <seanegan@gmail.com>
parents: 3001
diff changeset
2272 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
2273 yahoo_packet_hash(pkt, 49, "TYPING");
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2274 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
2275 yahoo_packet_hash(pkt, 14, " ");
5872
059d95c67cda [gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents: 5685
diff changeset
2276 yahoo_packet_hash(pkt, 13, typ == GAIM_TYPING ? "1" : "0");
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2277 yahoo_packet_hash(pkt, 5, who);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2278 yahoo_packet_hash(pkt, 1002, "1");
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2279
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2280 yahoo_send_packet(yd, pkt);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2281
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2282 yahoo_packet_free(pkt);
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2283
3001
87fff45fa36b [gaim-migrate @ 3014]
Sean Egan <seanegan@gmail.com>
parents: 2993
diff changeset
2284 return 0;
2993
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2285 }
7239a392486c [gaim-migrate @ 3006]
Rob Flynn <gaim@robflynn.com>
parents: 2979
diff changeset
2286
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2287 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
2288 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2289 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2290 struct yahoo_packet *pkt;
2772
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2291 int service;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2292 char s[4];
6691
306790891ce7 [gaim-migrate @ 7217]
Christian Hammond <chipx86@chipx86.com>
parents: 6687
diff changeset
2293
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2294 if (gc->away) {
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2295 g_free(gc->away);
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2296 gc->away = NULL;
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2297 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2298
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2299 if (msg) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2300 yd->current_status = YAHOO_STATUS_CUSTOM;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2301 gc->away = g_strndup(msg, YAHOO_MAX_STATUS_MESSAGE_LENGTH);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2302 } else if (state) {
4111
ee884f1d7ae3 [gaim-migrate @ 4326]
Christian Hammond <chipx86@chipx86.com>
parents: 4044
diff changeset
2303 gc->away = g_strdup("");
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2304 if (!strcmp(state, _("Available"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2305 yd->current_status = YAHOO_STATUS_AVAILABLE;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2306 } else if (!strcmp(state, _("Be Right Back"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2307 yd->current_status = YAHOO_STATUS_BRB;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2308 } else if (!strcmp(state, _("Busy"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2309 yd->current_status = YAHOO_STATUS_BUSY;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2310 } else if (!strcmp(state, _("Not At Home"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2311 yd->current_status = YAHOO_STATUS_NOTATHOME;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2312 } else if (!strcmp(state, _("Not At Desk"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2313 yd->current_status = YAHOO_STATUS_NOTATDESK;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2314 } else if (!strcmp(state, _("Not In Office"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2315 yd->current_status = YAHOO_STATUS_NOTINOFFICE;
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2316 } else if (!strcmp(state, _("On The Phone"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2317 yd->current_status = YAHOO_STATUS_ONPHONE;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2318 } else if (!strcmp(state, _("On Vacation"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2319 yd->current_status = YAHOO_STATUS_ONVACATION;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2320 } else if (!strcmp(state, _("Out To Lunch"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2321 yd->current_status = YAHOO_STATUS_OUTTOLUNCH;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2322 } else if (!strcmp(state, _("Stepped Out"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2323 yd->current_status = YAHOO_STATUS_STEPPEDOUT;
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2324 } else if (!strcmp(state, _("Invisible"))) {
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2325 yd->current_status = YAHOO_STATUS_INVISIBLE;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2326 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { /* this should never happen? */
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2327 if (gc->is_idle) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2328 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2329 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2330 yd->current_status = YAHOO_STATUS_AVAILABLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2331 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2332 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2333 } else if (gc->is_idle) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2334 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2335 } else {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2336 yd->current_status = YAHOO_STATUS_AVAILABLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2337 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2338
2772
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2339 if (yd->current_status == YAHOO_STATUS_AVAILABLE)
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2340 service = YAHOO_SERVICE_ISBACK;
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2341 else
f9227268db25 [gaim-migrate @ 2785]
Eric Warmenhoven <eric@warmenhoven.org>
parents: 2771
diff changeset
2342 service = YAHOO_SERVICE_ISAWAY;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2343
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2344 pkt = yahoo_packet_new(service, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2345 g_snprintf(s, sizeof(s), "%d", yd->current_status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2346 yahoo_packet_hash(pkt, 10, s);
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2347
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2348 if ((yd->current_status == YAHOO_STATUS_CUSTOM) && gc->away)
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2349 yahoo_packet_hash(pkt, 19, gc->away);
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2350
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2351 if ((yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2352 (yd->current_status != YAHOO_STATUS_IDLE)) {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2353 if (gc->is_idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2354 yahoo_packet_hash(pkt, 47, "2");
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2355 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2356 yahoo_packet_hash(pkt, 47, "1");
6686
0b286eace44c [gaim-migrate @ 7212]
Luke Schierer <lschiere@pidgin.im>
parents: 6657
diff changeset
2357 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2358
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2359 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2360 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2361 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2362
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2363 static void yahoo_set_idle(GaimConnection *gc, int idle)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2364 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2365 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2366 struct yahoo_packet *pkt = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2367
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2368 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) {
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2369 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2370 yd->current_status = YAHOO_STATUS_IDLE;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2371 } else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2372 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2373 yd->current_status = YAHOO_STATUS_AVAILABLE;
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2374 } else {
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2375 pkt = yahoo_packet_new(YAHOO_SERVICE_ISAWAY, YAHOO_STATUS_AVAILABLE, 0);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2376 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2377
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2378 if (pkt) {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2379 char buf[4];
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2380 g_snprintf(buf, sizeof(buf), "%d", yd->current_status);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2381 yahoo_packet_hash(pkt, 10, buf);
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2382 if (gc->away && yd->current_status == YAHOO_STATUS_CUSTOM) {
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2383 yahoo_packet_hash(pkt, 19, gc->away);
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2384 if (idle)
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2385 yahoo_packet_hash(pkt, 47, "2");
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2386 else
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2387 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
2388 } else if (idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2389 (yd->current_status != YAHOO_STATUS_IDLE)) {
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2390 yahoo_packet_hash(pkt, 47, "2");
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2391 } else if (!idle && (yd->current_status != YAHOO_STATUS_AVAILABLE) &&
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2392 (yd->current_status != YAHOO_STATUS_IDLE)) {
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2393 yahoo_packet_hash(pkt, 47, "1");
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2394 }
6847
7de1b559cbbb [gaim-migrate @ 7392]
Luke Schierer <lschiere@pidgin.im>
parents: 6840
diff changeset
2395
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2396 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2397 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2398 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2399 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2400
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2401 static GList *yahoo_away_states(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2402 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2403 GList *m = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2404
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2405 m = g_list_append(m, _("Available"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2406 m = g_list_append(m, _("Be Right Back"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2407 m = g_list_append(m, _("Busy"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2408 m = g_list_append(m, _("Not At Home"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2409 m = g_list_append(m, _("Not At Desk"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2410 m = g_list_append(m, _("Not In Office"));
4606
864518c3767d [gaim-migrate @ 4894]
Luke Schierer <lschiere@pidgin.im>
parents: 4596
diff changeset
2411 m = g_list_append(m, _("On The Phone"));
4596
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2412 m = g_list_append(m, _("On Vacation"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2413 m = g_list_append(m, _("Out To Lunch"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2414 m = g_list_append(m, _("Stepped Out"));
7e1591c6d0d8 [gaim-migrate @ 4881]
Luke Schierer <lschiere@pidgin.im>
parents: 4491
diff changeset
2415 m = g_list_append(m, _("Invisible"));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2416 m = g_list_append(m, GAIM_AWAY_CUSTOM);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2417
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2418 return m;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2419 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2420
5583
e46efd264489 [gaim-migrate @ 5987]
Sean Egan <seanegan@gmail.com>
parents: 5521
diff changeset
2421 static void yahoo_keepalive(GaimConnection *gc)
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2422 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2423 struct yahoo_data *yd = gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2424 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
2425 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2426 yahoo_packet_free(pkt);
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2427
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2428 if (!yd->chat_online)
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2429 return;
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2430
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2431 pkt = yahoo_packet_new(YAHOO_SERVICE_CHATPING, YAHOO_STATUS_AVAILABLE, 0);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2432 yahoo_packet_hash(pkt, 109, gaim_connection_get_display_name(gc));
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2433 yahoo_send_packet(yd, pkt);
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2434 yahoo_packet_free(pkt);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2435 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2436
6787
faa491042c66 [gaim-migrate @ 7326]
Christian Hammond <chipx86@chipx86.com>
parents: 6784
diff changeset
2437 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
2438 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2439 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2440 struct yahoo_packet *pkt;
6695
0c5637b5462e [gaim-migrate @ 7221]
Nathan Walp <nwalp@pidgin.im>
parents: 6691
diff changeset
2441 GaimGroup *g;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2442 char *group = NULL;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2443
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2444 if (!yd->logged_in)
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2445 return;
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2446
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2447 if (foo)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2448 group = foo->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2449 if (!group) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2450 g = gaim_find_buddys_group(gaim_find_buddy(gc->account, who));
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2451 if (g)
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2452 group = g->name;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2453 else
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2454 group = "Buddies";
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2455 }
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2456
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2457 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
2458 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2459 yahoo_packet_hash(pkt, 7, who);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2460 yahoo_packet_hash(pkt, 65, group);
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
2461 yahoo_packet_hash(pkt, 14, "");
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2462 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2463 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2464 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2465
6059
d8cd876e613e [gaim-migrate @ 6509]
Mark Doliner <mark@kingant.net>
parents: 6044
diff changeset
2466 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
2467 {
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2468 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2469 struct yahoo_friend *f;
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
2470 struct yahoo_packet *pkt;
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2471 GSList *buddies, *l;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2472 GaimGroup *g;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2473 gboolean remove = TRUE;
6784
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2474
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2475 if (!(f = g_hash_table_lookup(yd->friends, who)))
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2476 return;
ea3707dde7a3 [gaim-migrate @ 7323]
Luke Schierer <lschiere@pidgin.im>
parents: 6761
diff changeset
2477
6840
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2478 buddies = gaim_find_buddies(gaim_connection_get_account(gc), who);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2479 for (l = buddies; l; l = l->next) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2480 g = gaim_find_buddys_group(l->data);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2481 if (gaim_utf8_strcasecmp(group, g->name)) {
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2482 remove = FALSE;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2483 break;
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2484 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2485 }
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2486
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2487 g_slist_free(buddies);
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2488
b67670ac5584 [gaim-migrate @ 7385]
Luke Schierer <lschiere@pidgin.im>
parents: 6820
diff changeset
2489 if (remove)
6820
4b3fa146e995 [gaim-migrate @ 7364]
Luke Schierer <lschiere@pidgin.im>
parents: 6810
diff changeset
2490 g_hash_table_remove(yd->friends, who);
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2491
6795
40ba19133882 [gaim-migrate @ 7334]
Herman Bloggs <hermanator12002@yahoo.com>
parents: 6793
diff changeset
2492 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
2493 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2494 yahoo_packet_hash(pkt, 7, who);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2495 yahoo_packet_hash(pkt, 65, group);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2496 yahoo_send_packet(yd, pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2497 yahoo_packet_free(pkt);
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2498 }
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2499
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2500 static void yahoo_add_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2501 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2502 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2503
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2504 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2505 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2506
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2507 if (gc->account->perm_deny != 4)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2508 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2509
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2510 if (!who || who[0] == '\0')
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2511 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2512
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2513 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2514 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2515 yahoo_packet_hash(pkt, 7, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2516 yahoo_packet_hash(pkt, 13, "1");
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2517 yahoo_send_packet(yd, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2518 yahoo_packet_free(pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2519 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2520
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2521 static void yahoo_rem_deny(GaimConnection *gc, const char *who) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2522 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2523 struct yahoo_packet *pkt;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2524
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2525 if (!yd->logged_in)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2526 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2527
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2528 if (!who || who[0] == '\0')
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2529 return;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2530
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2531 pkt = yahoo_packet_new(YAHOO_SERVICE_IGNORECONTACT, YAHOO_STATUS_AVAILABLE, 0);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2532 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2533 yahoo_packet_hash(pkt, 7, who);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2534 yahoo_packet_hash(pkt, 13, "2");
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2535 yahoo_send_packet(yd, pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2536 yahoo_packet_free(pkt);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2537 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2538
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2539 static void yahoo_set_permit_deny(GaimConnection *gc) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2540 GaimAccount *acct;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2541 GSList *deny;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2542
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2543 acct = gc->account;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2544
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2545 switch (acct->perm_deny) {
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2546 case 1:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2547 case 3:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2548 case 5:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2549 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2550 yahoo_rem_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2551 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2552 case 4:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2553 for (deny = acct->deny;deny;deny = deny->next)
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2554 yahoo_add_deny(gc, deny->data);
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2555 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2556 case 2:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2557 default:
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2558 break;
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2559 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2560 }
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2561
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2562 static gboolean yahoo_unload_plugin(GaimPlugin *plugin)
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2563 {
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2564 yahoo_dest_colorht();
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2565 return TRUE;
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2566 }
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2567
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2568 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
2569 {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2570 YahooGetInfoData *info_data = (YahooGetInfoData *)data;
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2571 char *stripped, *p;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2572 char buf[1024];
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2573 gboolean found;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2574 gboolean has_info = FALSE;
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2575 char *url_buffer;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2576
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2577 gaim_debug_info("yahoo", "In yahoo_got_info\n");
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2578
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2579 /* we failed to grab the profile URL */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2580 if (url_text == NULL || strcmp(url_text, "") == 0) {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2581 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
7062
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2582 _("<html><body><b>Error retrieving profile</b></body></html>"),
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2583 NULL, NULL);
86ed8b2aa665 [gaim-migrate @ 7626]
Christian Hammond <chipx86@chipx86.com>
parents: 7043
diff changeset
2584
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2585 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2586 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2587 return;
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2588 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2589
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2590 /* 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
2591 * '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
2592 * 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
2593 * 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
2594 * profile if they want to do the web browser thing.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2595 */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2596 p = strstr(url_text, "Adult Profiles Warning Message");
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2597 if (p) {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2598 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
2599 _("<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
2600 _("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
2601 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
2602
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2603 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2604 buf, NULL, NULL);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2605
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2606 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2607 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2608 return;
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2609 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2610
6630
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2611 /* 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
2612 * 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
2613 * language. this language has nothing to do with the preferences of the
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2614 * user which looks at the profile
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2615 */
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2616 p = strstr(url_text, "Last Updated:");
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2617 if (!p) {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2618 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
2619 _("<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
2620 _("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
2621 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
2622
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2623 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2624 buf, NULL, NULL);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2625
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2626 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2627 g_free(info_data);
6630
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2628 return;
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2629 }
889279abb909 [gaim-migrate @ 7154]
Luke Schierer <lschiere@pidgin.im>
parents: 6629
diff changeset
2630
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2631 url_buffer = g_strdup(url_text);
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2632
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2633 /*
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2634 * 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
2635 * and &#183;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2636 */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2637 while ((p = strstr(url_buffer, "&nbsp;")) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2638 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2639 url_buffer[strlen(url_buffer) - 6] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2640 }
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2641 while ((p = strstr(url_buffer, "&#183;")) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2642 memmove(p, p + 6, strlen(p + 6));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2643 url_buffer[strlen(url_buffer) - 6] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2644 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2645
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2646 /* nuke the nasty \r's */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2647 while ((p = strchr(url_buffer, '\r')) != NULL) {
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2648 memmove(p, p + 1, strlen(p + 1));
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2649 url_buffer[strlen(url_buffer) - 1] = '\0';
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2650 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2651
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2652 /* 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
2653 stripped = gaim_markup_strip_html(url_buffer);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2654
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2655 gaim_debug_misc("yahoo", "stripped = %p\n", stripped);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2656 gaim_debug_misc("yahoo", "url_buffer = %p\n", url_buffer);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2657
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2658 /* gonna re-use the memory we've already got for url_buffer */
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2659 strcpy(url_buffer, "<html><body>\n");
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2660
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2661 /* 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
2662 * true, since the Yahoo! ID will always be there */
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2663 found = gaim_markup_extract_info_field(stripped, url_buffer, "Yahoo! ID:", 2, "\n", 0,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2664 NULL, _("Yahoo! ID"), 0, NULL);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2665
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2666
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2667 /* extract their Email address and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2668 found = gaim_markup_extract_info_field(stripped, url_buffer, "My Email", 5, "\n", 0,
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
2669 "Private", _("Email"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2670 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2671 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2672
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2673 /* extract the Nickname if it exists */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2674 found = gaim_markup_extract_info_field(stripped, url_buffer, "Nickname:", 1, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2675 NULL, _("Nickname"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2676 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2677 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2678
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2679 /* extract their RealName and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2680 found = gaim_markup_extract_info_field(stripped, url_buffer, "RealName:", 1, "\n", '\n',
6623
156e6643f9db [gaim-migrate @ 7147]
Luke Schierer <lschiere@pidgin.im>
parents: 6622
diff changeset
2681 NULL, _("Realname"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2682 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2683 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2684
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2685 /* extract their Location and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2686 found = gaim_markup_extract_info_field(stripped, url_buffer, "Location:", 2, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2687 NULL, _("Location"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2688 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2689 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2690
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2691 /* extract their Age and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2692 found = gaim_markup_extract_info_field(stripped, url_buffer, "Age:", 3, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2693 NULL, _("Age"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2694 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2695 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2696
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2697 /* extract their MaritalStatus and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2698 found = gaim_markup_extract_info_field(stripped, url_buffer, "MaritalStatus:", 3, "\n", '\n',
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
2699 "No Answer", _("Marital Status"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2700 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2701 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2702
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2703 /* extract their Gender and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2704 found = gaim_markup_extract_info_field(stripped, url_buffer, "Gender:", 3, "\n", '\n',
6657
7e2d2c8e88a8 [gaim-migrate @ 7182]
Luke Schierer <lschiere@pidgin.im>
parents: 6630
diff changeset
2705 "No Answer", _("Gender"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2706 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2707 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2708
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2709 /* extract their Occupation and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2710 found = gaim_markup_extract_info_field(stripped, url_buffer, "Occupation:", 2, "\n", '\n',
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2711 NULL, _("Occupation"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2712 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2713 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2714
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2715 /* 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
2716 * 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
2717 * 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
2718 * 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
2719 * 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
2720 * bunch.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2721 */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2722
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2723 found = gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Latest News",
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2724 '\n', NULL, _("Hobbies"), 0, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2725 if(!found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2726 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2727 found = gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Favorite Quote",
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2728 '\n', NULL, _("Hobbies"), 0, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2729 if(!found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2730 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2731 found = gaim_markup_extract_info_field(stripped, url_buffer, "Hobbies:", 1, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2732 '\n', NULL, _("Hobbies"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2733 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2734 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2735 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2736 else
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2737 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2738 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2739 else
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2740 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2741
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2742 found = gaim_markup_extract_info_field(stripped, url_buffer, "Latest News:", 1, "Favorite Quote",
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2743 '\n', NULL, _("Latest News"), 0, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2744 if(!found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2745 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2746 found = gaim_markup_extract_info_field(stripped, url_buffer, "Latest News:", 1, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2747 '\n', NULL, _("Latest News"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2748 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2749 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2750 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2751 else
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2752 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2753
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2754 found = gaim_markup_extract_info_field(stripped, url_buffer, "Favorite Quote:", 0, "Links",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2755 '\n', NULL, _("Favorite Quote"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2756 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2757 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2758
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2759 /* Home Page will either be "No home page specified",
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2760 * or "Home Page: " and a link. */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2761 p = strstr(stripped, "No home page specified");
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2762 if(!p)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2763 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2764 found = gaim_markup_extract_info_field(stripped, url_buffer, "Home Page:", 1, " ", 0, NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2765 _("Home Page"), 1, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2766 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2767 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2768 }
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2769
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2770 /* 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
2771 * 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
2772 * 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
2773 * we have a third one.
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2774 */
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2775 p = strstr(stripped,"No cool link specified");
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2776 if (!p)
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2777 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2778 found = gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 1:", 1, " ", 0, NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2779 _("Cool Link 1"), 1, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2780 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2781 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2782 has_info = TRUE;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2783 found = gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 2:", 1, " ", 0, NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2784 _("Cool Link 2"), 1, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2785 if(found)
7095
c8bf2da398e3 [gaim-migrate @ 7660]
Christian Hammond <chipx86@chipx86.com>
parents: 7094
diff changeset
2786 gaim_markup_extract_info_field(stripped, url_buffer, "Cool Link 3:", 1, " ", 0, NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2787 _("Cool Link 3"), 1, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2788 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2789 }
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2790
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2791 /* see if Member Since is there, and if so, extract it. */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2792 found = gaim_markup_extract_info_field(stripped, url_buffer, "Member Since:", 1, "Last Updated:",
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2793 '\n', NULL, _("Member Since"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2794 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2795 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2796
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2797 /* extract the Last Updated date and put it in */
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2798 found = gaim_markup_extract_info_field(stripped, url_buffer, "Last Updated:", 1, "\n", '\n', NULL,
6573
cc41123c684a [gaim-migrate @ 7095]
Luke Schierer <lschiere@pidgin.im>
parents: 6546
diff changeset
2799 _("Last Updated"), 0, NULL);
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2800 if(found)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2801 has_info = TRUE;
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2802
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2803 /* finish off the html */
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2804 strcat(url_buffer, "</body></html>\n");
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2805 g_free(stripped);
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2806
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2807 if(has_info)
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2808 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2809 /* show it to the user */
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2810 gaim_notify_formatted(info_data->gc, NULL, _("Buddy Information"), NULL,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2811 url_buffer, NULL, NULL);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2812 }
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2813 else
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2814 {
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2815 char primary[256];
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2816 g_snprintf(primary, sizeof(primary),
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2817 _("User information for %s unavailable"), info_data->name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2818 gaim_notify_error(info_data->gc, NULL, primary,
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2819 _("The user's profile is empty."));
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2820 }
7094
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2821
2343c3aa1dec [gaim-migrate @ 7659]
Christian Hammond <chipx86@chipx86.com>
parents: 7084
diff changeset
2822 g_free(url_buffer);
7161
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2823
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2824 g_free(info_data->name);
3471c3b1e85c [gaim-migrate @ 7728]
Mark Doliner <mark@kingant.net>
parents: 7138
diff changeset
2825 g_free(info_data);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2826 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2827
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2828 static void yahoo_get_info(GaimConnection *gc, const char *name)
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2829 {
7112
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2830 YahooGetInfoData *data;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2831 char *url;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2832
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2833 data = g_new0(YahooGetInfoData, 1);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2834 data->gc = gc;
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2835 data->name = g_strdup(name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2836
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2837 url = g_strdup_printf("%s%s", YAHOO_PROFILE_URL, name);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2838
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2839 gaim_url_fetch(url, FALSE, NULL, FALSE, yahoo_got_info, data);
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2840
cc1d09631513 [gaim-migrate @ 7679]
Luke Schierer <lschiere@pidgin.im>
parents: 7108
diff changeset
2841 g_free(url);
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2842 }
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2843
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2844 static void yahoo_change_buddys_group(GaimConnection *gc, const char *who,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2845 const char *old_group, const char *new_group)
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2846 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2847 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2848 struct yahoo_packet *pkt;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2849
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2850 /* Step 0: If they aren't on the server list anyway,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2851 * don't bother letting the server know.
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2852 */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2853 if (!g_hash_table_lookup(yd->friends, who))
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2854 return;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2855
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2856 /* Step 1: Add buddy to new group. */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2857 pkt = yahoo_packet_new(YAHOO_SERVICE_ADDBUDDY, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2858 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2859 yahoo_packet_hash(pkt, 7, who);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2860 yahoo_packet_hash(pkt, 65, new_group);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2861 yahoo_packet_hash(pkt, 14, "");
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2862 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2863 yahoo_packet_free(pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2864
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2865 /* Step 2: Remove buddy from old group */
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2866 pkt = yahoo_packet_new(YAHOO_SERVICE_REMBUDDY, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2867 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2868 yahoo_packet_hash(pkt, 7, who);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2869 yahoo_packet_hash(pkt, 65, old_group);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2870 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2871 yahoo_packet_free(pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2872 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2873
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2874 static void yahoo_rename_group(GaimConnection *gc, const char *old_group,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2875 const char *new_group, GList *whocares)
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2876 {
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2877 struct yahoo_data *yd = gc->proto_data;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2878 struct yahoo_packet *pkt;
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2879
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2880 pkt = yahoo_packet_new(YAHOO_SERVICE_GROUPRENAME, YAHOO_STATUS_AVAILABLE, 0);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2881 yahoo_packet_hash(pkt, 1, gaim_connection_get_display_name(gc));
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2882 yahoo_packet_hash(pkt, 65, old_group);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2883 yahoo_packet_hash(pkt, 67, new_group);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2884 yahoo_send_packet(yd, pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2885 yahoo_packet_free(pkt);
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2886 }
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2887
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2888 static GaimPlugin *my_protocol = NULL;
2681
37d80035e77f [gaim-migrate @ 2694]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
diff changeset
2889
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2890 static GaimPluginProtocolInfo prpl_info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2891 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2892 GAIM_PROTO_YAHOO,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2893 OPT_PROTO_MAIL_CHECK | OPT_PROTO_CHAT_TOPIC,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2894 NULL, /* user_splits */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2895 NULL, /* protocol_options */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2896 yahoo_list_icon,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2897 yahoo_list_emblems,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2898 yahoo_status_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2899 yahoo_tooltip_text,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2900 yahoo_away_states,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2901 yahoo_actions,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2902 yahoo_buddy_menu,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2903 yahoo_c_info,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2904 yahoo_login,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2905 yahoo_close,
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2906 yahoo_send_im,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2907 NULL, /* set info */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2908 yahoo_send_typing,
6514
64d952098596 [gaim-migrate @ 7031]
Luke Schierer <lschiere@pidgin.im>
parents: 6513
diff changeset
2909 yahoo_get_info,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2910 yahoo_set_away,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2911 NULL, /* get_away */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2912 NULL, /* set_dir */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2913 NULL, /* get_dir */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2914 NULL, /* dir_search */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2915 yahoo_set_idle,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2916 NULL, /* change_passwd*/
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2917 yahoo_add_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2918 NULL, /* add_buddies */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2919 yahoo_remove_buddy,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2920 NULL, /*remove_buddies */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2921 NULL, /* add_permit */
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2922 yahoo_add_deny,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2923 NULL, /* rem_permit */
6760
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2924 yahoo_rem_deny,
e7e21e5d1d16 [gaim-migrate @ 7292]
Luke Schierer <lschiere@pidgin.im>
parents: 6729
diff changeset
2925 yahoo_set_permit_deny,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2926 NULL, /* warn */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2927 yahoo_c_join,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2928 yahoo_c_invite,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2929 yahoo_c_leave,
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2930 NULL, /* chat whisper */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2931 yahoo_c_send,
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2932 yahoo_keepalive,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2933 NULL, /* register_user */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2934 NULL, /* get_cb_info */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2935 NULL, /* get_cb_away */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2936 NULL, /* alias_buddy */
6793
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2937 yahoo_change_buddys_group,
3d84c933b939 [gaim-migrate @ 7332]
Luke Schierer <lschiere@pidgin.im>
parents: 6792
diff changeset
2938 yahoo_rename_group,
6729
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2939 NULL, /* buddy_free */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2940 NULL, /* convo_closed */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2941 NULL, /* normalize */
7b878ee8f064 [gaim-migrate @ 7256]
Luke Schierer <lschiere@pidgin.im>
parents: 6695
diff changeset
2942 NULL /* set_buddy_icon */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2943 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2944
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2945 static GaimPluginInfo info =
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2946 {
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2947 2, /**< api_version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2948 GAIM_PLUGIN_PROTOCOL, /**< type */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2949 NULL, /**< ui_requirement */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2950 0, /**< flags */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2951 NULL, /**< dependencies */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2952 GAIM_PRIORITY_DEFAULT, /**< priority */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2953
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2954 "prpl-yahoo", /**< id */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2955 "Yahoo", /**< name */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2956 VERSION, /**< version */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2957 /** summary */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2958 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2959 /** description */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2960 N_("Yahoo Protocol Plugin"),
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2961 NULL, /**< author */
6371
8f94cce8faa5 [gaim-migrate @ 6876]
Christian Hammond <chipx86@chipx86.com>
parents: 6321
diff changeset
2962 GAIM_WEBSITE, /**< homepage */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2963
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2964 NULL, /**< load */
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2965 yahoo_unload_plugin, /**< unload */
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2966 NULL, /**< destroy */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2967
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2968 NULL, /**< ui_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2969 &prpl_info /**< extra_info */
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2970 };
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2971
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2972 static void
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
2973 init_plugin(GaimPlugin *plugin)
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2974 {
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2975 GaimAccountOption *option;
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2976
5685
43ea75092684 [gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2977 option = gaim_account_option_string_new(_("Pager host"), "server",
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2978 YAHOO_PAGER_HOST);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2979 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2980 option);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2981
5685
43ea75092684 [gaim-migrate @ 6106]
Christian Hammond <chipx86@chipx86.com>
parents: 5681
diff changeset
2982 option = gaim_account_option_int_new(_("Pager port"), "port",
5638
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2983 YAHOO_PAGER_PORT);
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2984 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options,
0bdfa28c678e [gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents: 5590
diff changeset
2985 option);
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2986 my_protocol = plugin;
6513
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2987
63c449a1022f [gaim-migrate @ 7030]
Luke Schierer <lschiere@pidgin.im>
parents: 6465
diff changeset
2988 yahoo_init_colorht();
5205
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2989 }
fefad67de2c7 [gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents: 5136
diff changeset
2990
5920
7d385de2f9cd [gaim-migrate @ 6360]
Christian Hammond <chipx86@chipx86.com>
parents: 5872
diff changeset
2991 GAIM_INIT_PLUGIN(yahoo, init_plugin, info);