Mercurial > pidgin
annotate plugins/yay/yay.c @ 1891:1c977d995da9
[gaim-migrate @ 1901]
yahoo doesn't have to notify you of mail.
committer: Tailor Script <tailor@pidgin.im>
author | Eric Warmenhoven <eric@warmenhoven.org> |
---|---|
date | Thu, 24 May 2001 21:34:26 +0000 |
parents | a02584b98823 |
children | ac9dd6b00b34 |
rev | line source |
---|---|
1054 | 1 /* |
2 * gaim | |
3 * | |
4 * Some code copyright (C) 1998-1999, Mark Spencer <markster@marko.net> | |
5 * libfaim code copyright 1998, 1999 Adam Fritzler <afritz@auk.cx> | |
6 * | |
7 * This program is free software; you can redistribute it and/or modify | |
8 * it under the terms of the GNU General Public License as published by | |
9 * the Free Software Foundation; either version 2 of the License, or | |
10 * (at your option) any later version. | |
11 * | |
12 * This program is distributed in the hope that it will be useful, | |
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 * GNU General Public License for more details. | |
16 * | |
17 * You should have received a copy of the GNU General Public License | |
18 * along with this program; if not, write to the Free Software | |
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
20 * | |
21 */ | |
22 | |
23 #ifdef HAVE_CONFIG_H | |
1514
0dd012166152
[gaim-migrate @ 1524]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1503
diff
changeset
|
24 #include "config.h" |
1054 | 25 #endif |
26 | |
27 | |
28 #include <netdb.h> | |
29 #include <gtk/gtk.h> | |
30 #include <unistd.h> | |
31 #include <errno.h> | |
32 #include <netinet/in.h> | |
33 #include <arpa/inet.h> | |
34 #include <string.h> | |
35 #include <stdlib.h> | |
36 #include <stdio.h> | |
37 #include <time.h> | |
38 #include <sys/socket.h> | |
39 #include <sys/stat.h> | |
40 #include "multi.h" | |
41 #include "prpl.h" | |
42 #include "gaim.h" | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
43 #include "yay.h" |
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
44 #include "proxy.h" |
1054 | 45 |
1232
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
46 #include "pixmaps/status-away.xpm" |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
47 #include "pixmaps/status-here.xpm" |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
48 #include "pixmaps/status-idle.xpm" |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
49 |
1448
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
50 #include "pixmaps/cancel.xpm" |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
51 |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
52 #define USEROPT_MAIL 0 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
53 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
54 struct conn { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
55 int socket; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
56 int type; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
57 int inpa; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
58 }; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
59 |
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
60 struct connect { |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
61 struct yahoo_session *sess; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
62 gpointer data; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
63 }; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
64 |
1054 | 65 struct yahoo_data { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
66 struct yahoo_session *sess; |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
67 int current_status; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
68 GHashTable *hash; |
1448
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
69 GtkWidget *email_win; |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
70 GtkWidget *email_label; |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
71 char *active_id; |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
72 GList *conns; |
1553
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
73 gboolean logged_in; |
1054 | 74 }; |
75 | |
76 static char *yahoo_name() { | |
77 return "Yahoo"; | |
78 } | |
79 | |
80 char *name() { | |
81 return "Yahoo"; | |
82 } | |
83 | |
84 char *description() { | |
85 return "Allows gaim to use the Yahoo protocol"; | |
86 } | |
87 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
88 static int yahoo_status(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
89 struct gaim_connection *gc = sess->user_data; |
1054 | 90 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
1232
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
91 time_t tmptime; |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
92 struct buddy *b; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
93 gboolean online; |
1054 | 94 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
95 va_list ap; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
96 char *who; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
97 int status; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
98 char *msg; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
99 int in_pager, in_chat, in_game; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
100 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
101 va_start(ap, sess); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
102 who = va_arg(ap, char *); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
103 status = va_arg(ap, int); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
104 msg = va_arg(ap, char *); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
105 in_pager = va_arg(ap, int); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
106 in_chat = va_arg(ap, int); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
107 in_game = va_arg(ap, int); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
108 va_end(ap); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
109 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
110 online = in_pager || in_chat || in_game; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
111 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
112 b = find_buddy(gc, who); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
113 if (!b) return 0; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
114 if (!online) |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
115 serv_got_update(gc, b->name, 0, 0, 0, 0, 0, 0); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
116 else { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
117 if (status == YAHOO_STATUS_AVAILABLE) |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
118 serv_got_update(gc, b->name, 1, 0, 0, 0, UC_NORMAL, 0); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
119 else if (status == YAHOO_STATUS_IDLE) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
120 time(&tmptime); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
121 serv_got_update(gc, b->name, 1, 0, 0, tmptime - 600, |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
122 (status << 5) | UC_NORMAL, 0); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
123 } else |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
124 serv_got_update(gc, b->name, 1, 0, 0, 0, |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
125 (status << 5) | UC_UNAVAILABLE, 0); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
126 if (status == YAHOO_STATUS_CUSTOM) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
127 gpointer val = g_hash_table_lookup(yd->hash, b->name); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
128 if (val) |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
129 g_free(val); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
130 g_hash_table_insert(yd->hash, g_strdup(b->name), g_strdup(msg)); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
131 } |
1054 | 132 } |
133 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
134 return 1; |
1054 | 135 } |
136 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
137 static int yahoo_message(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
138 struct gaim_connection *gc = sess->user_data; |
1400
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1395
diff
changeset
|
139 char buf[BUF_LEN * 4]; |
1571
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
140 char *tmp, *c, *e; |
1737
82c824fe018e
[gaim-migrate @ 1747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1657
diff
changeset
|
141 time_t tm; |
1571
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
142 int at = 0; |
1054 | 143 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
144 va_list ap; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
145 char *id, *nick, *msg; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
146 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
147 va_start(ap, sess); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
148 id = va_arg(ap, char *); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
149 nick = va_arg(ap, char *); |
1737
82c824fe018e
[gaim-migrate @ 1747]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1657
diff
changeset
|
150 tm = va_arg(ap, time_t); |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
151 msg = va_arg(ap, char *); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
152 va_end(ap); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
153 |
1657
45800119e039
[gaim-migrate @ 1667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1571
diff
changeset
|
154 if (msg) |
45800119e039
[gaim-migrate @ 1667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1571
diff
changeset
|
155 e = tmp = g_strdup(msg); |
45800119e039
[gaim-migrate @ 1667]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1571
diff
changeset
|
156 else |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
157 return 1; |
1571
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
158 |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
159 while ((c = strchr(e, '\033')) != NULL) { |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
160 *c++ = '\0'; |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
161 at += g_snprintf(buf + at, sizeof(buf) - at, "%s", e); |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
162 e = ++c; |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
163 while (*e && (*e++ != 'm')); |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
164 } |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
165 |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
166 if (*e) |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
167 g_snprintf(buf + at, sizeof(buf) - at, "%s", e); |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
168 |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
169 g_free(tmp); |
bbdc5eefd243
[gaim-migrate @ 1581]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1565
diff
changeset
|
170 |
1764 | 171 serv_got_im(gc, nick, buf, 0, tm ? tm : time((time_t)NULL)); |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
172 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
173 return 1; |
1054 | 174 } |
175 | |
1562
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
176 static int yahoo_bounce(struct yahoo_session *sess, ...) { |
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
177 do_error_dialog(_("Your message did not get sent."), _("Gaim - Error")); |
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
178 |
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
179 return 1; |
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
180 } |
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
181 |
1563
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
182 static int yahoo_buddyadded(struct yahoo_session *sess, ...) { |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
183 va_list ap; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
184 char *id; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
185 char *who; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
186 char *msg; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
187 char buf[2048]; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
188 |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
189 va_start(ap, sess); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
190 id = va_arg(ap, char *); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
191 who = va_arg(ap, char *); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
192 msg = va_arg(ap, char *); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
193 va_end(ap); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
194 |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
195 g_snprintf(buf, sizeof(buf), _("%s has made %s their buddy%s%s"), who, id, |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
196 msg ? ": " : "", msg ? msg : ""); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
197 do_error_dialog(buf, _("Gaim - Buddy")); |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
198 |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
199 return 1; |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
200 } |
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
201 |
1448
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
202 static void des_win(GtkWidget *w, struct yahoo_data *yd) { |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
203 gtk_widget_destroy(yd->email_win); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
204 if (yd->email_win == w) |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
205 yd->email_win = NULL; |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
206 yd->email_label = NULL; |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
207 } |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
208 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
209 static int yahoo_newmail(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
210 struct gaim_connection *gc = sess->user_data; |
1054 | 211 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
212 char buf[2048]; | |
213 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
214 va_list ap; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
215 int count; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
216 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
217 va_start(ap, sess); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
218 count = va_arg(ap, int); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
219 va_end(ap); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
220 |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
221 if (gc->user->proto_opt[USEROPT_MAIL][0] != '1') |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
222 return 1; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
223 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
224 if (count) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
225 g_snprintf(buf, sizeof buf, "%s has %d new message%s on Yahoo Mail.", |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
226 gc->username, count, count == 1 ? "" : "s"); |
1448
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
227 if (!yd->email_win) { |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
228 GtkWidget *close; |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
229 |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
230 yd->email_win = gtk_dialog_new(); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
231 gtk_window_set_policy(GTK_WINDOW(yd->email_win), 0, 0, 1); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
232 gtk_container_set_border_width(GTK_CONTAINER(yd->email_win), 5); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
233 gtk_window_set_title(GTK_WINDOW(yd->email_win), "New Mail"); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
234 gtk_signal_connect(GTK_OBJECT(yd->email_win), "destroy", |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
235 GTK_SIGNAL_FUNC(des_win), yd); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
236 gtk_widget_realize(yd->email_win); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
237 aol_icon(yd->email_win->window); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
238 |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
239 yd->email_label = gtk_label_new(buf); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
240 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(yd->email_win)->vbox), |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
241 yd->email_label, 0, 0, 5); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
242 gtk_widget_show(yd->email_label); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
243 |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
244 close = picture_button(yd->email_win, _("Close"), cancel_xpm); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
245 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(yd->email_win)->action_area), |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
246 close, 0, 0, 5); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
247 gtk_signal_connect(GTK_OBJECT(close), "clicked", GTK_SIGNAL_FUNC(des_win), yd); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
248 |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
249 gtk_widget_show(yd->email_win); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
250 } |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
251 gtk_label_set_text(GTK_LABEL(yd->email_label), buf); |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
252 } else if (yd->email_win) |
ff023d798372
[gaim-migrate @ 1458]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1443
diff
changeset
|
253 gtk_widget_destroy(yd->email_win); |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
254 |
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
255 return 1; |
1054 | 256 } |
257 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
258 static int yahoo_disconn(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
259 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
260 hide_login_progress(gc, "Disconnected"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
261 signoff(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
262 return 1; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
263 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
264 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
265 static int yahoo_authconnect(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
266 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
267 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
268 set_login_progress(gc, 2, "Connected to Auth"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
269 if (yahoo_send_login(sess, gc->username, gc->password) < 1) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
270 hide_login_progress(gc, "Authorizer error"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
271 signoff(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
272 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
273 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
274 return 1; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
275 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
276 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
277 static int yahoo_badpassword(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
278 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
279 hide_login_progress(gc, "Bad Password"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
280 signoff(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
281 return 1; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
282 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
283 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
284 static int yahoo_logincookie(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
285 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
286 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
287 set_login_progress(gc, 3, "Got login cookie"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
288 if (yahoo_major_connect(sess, NULL, 0) < 1) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
289 hide_login_progress(gc, "Login error"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
290 signoff(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
291 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
292 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
293 return 1; |
1395
567758889707
[gaim-migrate @ 1405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1351
diff
changeset
|
294 } |
567758889707
[gaim-migrate @ 1405]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1351
diff
changeset
|
295 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
296 static int yahoo_mainconnect(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
297 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
298 struct yahoo_data *yd = gc->proto_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
299 GList *grps; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
300 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
301 set_login_progress(gc, 4, "Connected to service"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
302 if (yahoo_finish_logon(sess, YAHOO_STATUS_AVAILABLE) < 1) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
303 hide_login_progress(gc, "Login error"); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
304 signoff(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
305 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
306 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
307 if (bud_list_cache_exists(gc)) |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
308 do_import(NULL, gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
309 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
310 grps = yd->sess->groups; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
311 while (grps) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
312 struct yahoo_group *grp = grps->data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
313 int i; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
314 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
315 for (i = 0; grp->buddies[i]; i++) |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
316 add_buddy(gc, grp->name, grp->buddies[i], NULL); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
317 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
318 grps = grps->next; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
319 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
320 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
321 return 1; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
322 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
323 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
324 static int yahoo_online(struct yahoo_session *sess, ...) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
325 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
326 struct yahoo_data *yd = gc->proto_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
327 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
328 account_online(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
329 serv_finish_login(gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
330 yd->active_id = g_strdup(gc->username); |
1553
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
331 yd->logged_in = TRUE; |
1815
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
332 |
f15d449b3167
[gaim-migrate @ 1825]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1764
diff
changeset
|
333 return 1; |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
334 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
335 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
336 static void yahoo_pending(gpointer data, gint source, GdkInputCondition condition) { |
1054 | 337 struct gaim_connection *gc = (struct gaim_connection *)data; |
338 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
339 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
340 yahoo_socket_handler(yd->sess, source, condition); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
341 } |
1054 | 342 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
343 static void yahoo_notify(struct yahoo_session *sess, int socket, int type, int cont) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
344 struct gaim_connection *gc = sess->user_data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
345 struct yahoo_data *yd = gc->proto_data; |
1054 | 346 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
347 if (cont) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
348 struct conn *c = g_new0(struct conn, 1); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
349 c->socket = socket; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
350 c->type = type; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
351 c->inpa = gdk_input_add(socket, type, yahoo_pending, gc); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
352 yd->conns = g_list_append(yd->conns, c); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
353 } else { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
354 GList *c = yd->conns; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
355 while (c) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
356 struct conn *m = c->data; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
357 if ((m->socket == socket) && (m->type == type)) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
358 yd->conns = g_list_remove(yd->conns, m); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
359 gdk_input_remove(m->inpa); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
360 g_free(m); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
361 return; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
362 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
363 c = g_list_next(c); |
1054 | 364 } |
365 } | |
366 } | |
367 | |
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
368 static void yahoo_got_connected(gpointer data, gint source, GdkInputCondition cond) { |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
369 struct connect *con = data; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
370 |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
371 debug_printf("got connected (possibly)\n"); |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
372 yahoo_connected(con->sess, con->data, source); |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
373 |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
374 g_free(con); |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
375 } |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
376 |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
377 static int yahoo_connect_to(struct yahoo_session *sess, const char *host, int port, gpointer data) { |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
378 struct connect *con = g_new0(struct connect, 1); |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
379 int fd; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
380 |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
381 con->sess = sess; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
382 con->data = data; |
1881
a02584b98823
[gaim-migrate @ 1891]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1879
diff
changeset
|
383 fd = proxy_connect((char *)host, port, yahoo_got_connected, con); |
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
384 if (fd < 0) { |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
385 g_free(con); |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
386 return -1; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
387 } |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
388 |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
389 return fd; |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
390 } |
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
391 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
392 static void yahoo_debug(struct yahoo_session *sess, int level, const char *string) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
393 debug_printf("Level %d: %s\n", level, string); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
394 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
395 |
1054 | 396 static void yahoo_login(struct aim_user *user) { |
1089
f0f5c10cce63
[gaim-migrate @ 1099]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1054
diff
changeset
|
397 struct gaim_connection *gc = new_gaim_conn(user); |
1054 | 398 struct yahoo_data *yd = gc->proto_data = g_new0(struct yahoo_data, 1); |
399 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
400 yd->sess = yahoo_new(); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
401 yd->sess->user_data = gc; |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
402 yd->current_status = YAHOO_STATUS_AVAILABLE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
403 yd->hash = g_hash_table_new(g_str_hash, g_str_equal); |
1054 | 404 |
405 set_login_progress(gc, 1, "Connecting"); | |
406 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
407 if (!yahoo_connect(yd->sess, NULL, 0)) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
408 hide_login_progress(gc, "Connection problem"); |
1096
c1dcba9f3a3a
[gaim-migrate @ 1106]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1090
diff
changeset
|
409 signoff(gc); |
1054 | 410 return; |
411 } | |
412 | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
413 yahoo_add_handler(yd->sess, YAHOO_HANDLE_DISCONNECT, yahoo_disconn); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
414 yahoo_add_handler(yd->sess, YAHOO_HANDLE_AUTHCONNECT, yahoo_authconnect); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
415 yahoo_add_handler(yd->sess, YAHOO_HANDLE_BADPASSWORD, yahoo_badpassword); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
416 yahoo_add_handler(yd->sess, YAHOO_HANDLE_LOGINCOOKIE, yahoo_logincookie); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
417 yahoo_add_handler(yd->sess, YAHOO_HANDLE_MAINCONNECT, yahoo_mainconnect); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
418 yahoo_add_handler(yd->sess, YAHOO_HANDLE_ONLINE, yahoo_online); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
419 yahoo_add_handler(yd->sess, YAHOO_HANDLE_NEWMAIL, yahoo_newmail); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
420 yahoo_add_handler(yd->sess, YAHOO_HANDLE_MESSAGE, yahoo_message); |
1562
12f16a852540
[gaim-migrate @ 1572]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1557
diff
changeset
|
421 yahoo_add_handler(yd->sess, YAHOO_HANDLE_BOUNCE, yahoo_bounce); |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
422 yahoo_add_handler(yd->sess, YAHOO_HANDLE_STATUS, yahoo_status); |
1563
393b23c8f494
[gaim-migrate @ 1573]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1562
diff
changeset
|
423 yahoo_add_handler(yd->sess, YAHOO_HANDLE_BUDDYADDED, yahoo_buddyadded); |
1054 | 424 } |
425 | |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
426 static gboolean yahoo_destroy_hash(gpointer key, gpointer val, gpointer data) { |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
427 g_free(key); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
428 g_free(val); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
429 return TRUE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
430 } |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
431 |
1054 | 432 static void yahoo_close(struct gaim_connection *gc) { |
433 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
434 g_hash_table_foreach_remove(yd->hash, yahoo_destroy_hash, NULL); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
435 g_hash_table_destroy(yd->hash); |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
436 yahoo_disconnect(yd->sess); |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
437 yahoo_delete(yd->sess); |
1054 | 438 g_free(yd); |
439 } | |
440 | |
441 static void yahoo_send_im(struct gaim_connection *gc, char *who, char *message, int away) { | |
442 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
443 | |
1554
c3afde736a8a
[gaim-migrate @ 1564]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1553
diff
changeset
|
444 if (away || !strlen(message)) return; |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
445 |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
446 yahoo_send_message(yd->sess, yd->active_id, who, message); |
1054 | 447 } |
448 | |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
449 static void yahoo_set_away(struct gaim_connection *gc, char *state, char *msg) { |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
450 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
451 |
1404
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
452 gc->away = NULL; |
96e93119268d
[gaim-migrate @ 1414]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1402
diff
changeset
|
453 |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
454 if (msg) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
455 yahoo_away(yd->sess, YAHOO_STATUS_CUSTOM, msg); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
456 yd->current_status = YAHOO_STATUS_CUSTOM; |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
457 gc->away = ""; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
458 } else if (state) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
459 gc->away = ""; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
460 if (!strcmp(state, "Available")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
461 yahoo_away(yd->sess, YAHOO_STATUS_AVAILABLE, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
462 yd->current_status = YAHOO_STATUS_AVAILABLE; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
463 } else if (!strcmp(state, "Be Right Back")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
464 yahoo_away(yd->sess, YAHOO_STATUS_BRB, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
465 yd->current_status = YAHOO_STATUS_BRB; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
466 } else if (!strcmp(state, "Busy")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
467 yahoo_away(yd->sess, YAHOO_STATUS_BUSY, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
468 yd->current_status = YAHOO_STATUS_BUSY; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
469 } else if (!strcmp(state, "Not At Home")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
470 yahoo_away(yd->sess, YAHOO_STATUS_NOTATHOME, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
471 yd->current_status = YAHOO_STATUS_NOTATHOME; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
472 } else if (!strcmp(state, "Not At Desk")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
473 yahoo_away(yd->sess, YAHOO_STATUS_NOTATDESK, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
474 yd->current_status = YAHOO_STATUS_NOTATDESK; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
475 } else if (!strcmp(state, "Not In Office")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
476 yahoo_away(yd->sess, YAHOO_STATUS_NOTINOFFICE, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
477 yd->current_status = YAHOO_STATUS_NOTINOFFICE; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
478 } else if (!strcmp(state, "On Phone")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
479 yahoo_away(yd->sess, YAHOO_STATUS_ONPHONE, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
480 yd->current_status = YAHOO_STATUS_ONPHONE; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
481 } else if (!strcmp(state, "On Vacation")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
482 yahoo_away(yd->sess, YAHOO_STATUS_ONVACATION, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
483 yd->current_status = YAHOO_STATUS_ONVACATION; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
484 } else if (!strcmp(state, "Out To Lunch")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
485 yahoo_away(yd->sess, YAHOO_STATUS_OUTTOLUNCH, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
486 yd->current_status = YAHOO_STATUS_OUTTOLUNCH; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
487 } else if (!strcmp(state, "Stepped Out")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
488 yahoo_away(yd->sess, YAHOO_STATUS_STEPPEDOUT, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
489 yd->current_status = YAHOO_STATUS_STEPPEDOUT; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
490 } else if (!strcmp(state, "Invisible")) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
491 yahoo_away(yd->sess, YAHOO_STATUS_INVISIBLE, msg); |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
492 yd->current_status = YAHOO_STATUS_INVISIBLE; |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
493 } else if (!strcmp(state, GAIM_AWAY_CUSTOM)) { |
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
494 if (gc->is_idle) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
495 yahoo_away(yd->sess, YAHOO_STATUS_IDLE, NULL); |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
496 yd->current_status = YAHOO_STATUS_IDLE; |
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
497 } else { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
498 yahoo_away(yd->sess, YAHOO_STATUS_AVAILABLE, NULL); |
1402
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
499 yd->current_status = YAHOO_STATUS_AVAILABLE; |
65f4a0325022
[gaim-migrate @ 1412]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1401
diff
changeset
|
500 } |
1554
c3afde736a8a
[gaim-migrate @ 1564]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1553
diff
changeset
|
501 gc->away = NULL; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
502 } |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
503 } else if (gc->is_idle) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
504 yahoo_away(yd->sess, YAHOO_STATUS_IDLE, NULL); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
505 yd->current_status = YAHOO_STATUS_IDLE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
506 } else { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
507 yahoo_away(yd->sess, YAHOO_STATUS_AVAILABLE, NULL); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
508 yd->current_status = YAHOO_STATUS_AVAILABLE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
509 } |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
510 } |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
511 |
1054 | 512 static void yahoo_set_idle(struct gaim_connection *gc, int idle) { |
513 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
514 | |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
515 if (idle && yd->current_status == YAHOO_STATUS_AVAILABLE) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
516 yahoo_away(yd->sess, YAHOO_STATUS_IDLE, NULL); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
517 yd->current_status = YAHOO_STATUS_IDLE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
518 } else if (!idle && yd->current_status == YAHOO_STATUS_IDLE) { |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
519 yahoo_back(yd->sess, YAHOO_STATUS_AVAILABLE, NULL); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
520 yd->current_status = YAHOO_STATUS_AVAILABLE; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
521 } |
1054 | 522 } |
523 | |
524 static void yahoo_keepalive(struct gaim_connection *gc) { | |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
525 yahoo_ping(((struct yahoo_data *)gc->proto_data)->sess); |
1054 | 526 } |
527 | |
528 static void gyahoo_add_buddy(struct gaim_connection *gc, char *name) { | |
529 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; | |
1552
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
530 struct yahoo_group *tmpgroup; |
1054 | 531 struct group *g = find_group_by_buddy(gc, name); |
532 char *group = NULL; | |
533 | |
1553
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
534 if (!yd->logged_in) |
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
535 return; |
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
536 |
1054 | 537 if (g) { |
538 group = g->name; | |
1552
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
539 } else if (yd->sess && yd->sess->groups) { |
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
540 tmpgroup = yd->sess->groups->data; |
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
541 group = tmpgroup->name; |
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
542 } else { |
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
543 group = "Buddies"; |
1054 | 544 } |
545 | |
546 if (group) | |
1553
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
547 yahoo_add_buddy(yd->sess, yd->active_id, group, name, ""); |
1054 | 548 } |
549 | |
1300
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
550 static void yahoo_add_buddies(struct gaim_connection *gc, GList *buddies) { |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
551 while (buddies) { |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
552 gyahoo_add_buddy(gc, buddies->data); |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
553 buddies = buddies->next; |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
554 } |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
555 } |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
556 |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
557 static void gyahoo_remove_buddy(struct gaim_connection *gc, char *name) { |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
558 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
559 struct group *g = find_group_by_buddy(gc, name); |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
560 char *group = NULL; |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
561 |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
562 if (g) { |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
563 group = g->name; |
1552
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
564 } else if (yd->sess && yd->sess->groups) { |
1557
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
565 GList *x = yd->sess->groups; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
566 while (x) { |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
567 struct yahoo_group *tmpgroup = x->data; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
568 char **bds = tmpgroup->buddies; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
569 while (*bds) { |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
570 if (!strcmp(*bds, name)) |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
571 break; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
572 bds++; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
573 } |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
574 if (*bds) { |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
575 group = tmpgroup->name; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
576 break; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
577 } |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
578 x = x->next; |
1ca5f5fcd483
[gaim-migrate @ 1567]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1554
diff
changeset
|
579 } |
1552
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
580 } else { |
b669f48f0990
[gaim-migrate @ 1562]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1546
diff
changeset
|
581 group = "Buddies"; |
1300
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
582 } |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
583 |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
584 if (group) |
1553
bf10d0673d34
[gaim-migrate @ 1563]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1552
diff
changeset
|
585 yahoo_remove_buddy(yd->sess, yd->active_id, group, name, ""); |
1300
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
586 } |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
587 |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
588 static char **yahoo_list_icon(int uc) { |
1232
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
589 if ((uc >> 5) == YAHOO_STATUS_IDLE) |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
590 return status_idle_xpm; |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
591 else if (uc == UC_NORMAL) |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
592 return status_here_xpm; |
0c7c659fc730
[gaim-migrate @ 1242]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1168
diff
changeset
|
593 return status_away_xpm; |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
594 } |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
595 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
596 static char *yahoo_get_status_string(enum yahoo_status a) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
597 switch (a) { |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
598 case YAHOO_STATUS_BRB: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
599 return "Be Right Back"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
600 case YAHOO_STATUS_BUSY: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
601 return "Busy"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
602 case YAHOO_STATUS_NOTATHOME: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
603 return "Not At Home"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
604 case YAHOO_STATUS_NOTATDESK: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
605 return "Not At Desk"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
606 case YAHOO_STATUS_NOTINOFFICE: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
607 return "Not In Office"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
608 case YAHOO_STATUS_ONPHONE: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
609 return "On Phone"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
610 case YAHOO_STATUS_ONVACATION: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
611 return "On Vacation"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
612 case YAHOO_STATUS_OUTTOLUNCH: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
613 return "Out To Lunch"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
614 case YAHOO_STATUS_STEPPEDOUT: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
615 return "Stepped Out"; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
616 default: |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
617 return NULL; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
618 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
619 } |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
620 |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
621 static void yahoo_buddy_menu(GtkWidget *menu, struct gaim_connection *gc, char *who) { |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
622 struct yahoo_data *yd = (struct yahoo_data *)gc->proto_data; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
623 GtkWidget *button; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
624 struct buddy *b = find_buddy(gc, who); /* this should never be null. if it is, |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
625 segfault and get the bug report. */ |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
626 char buf[1024]; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
627 |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
628 if (b->uc & UC_NORMAL) |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
629 return; |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
630 |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
631 if ((b->uc >> 5) != YAHOO_STATUS_CUSTOM) |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
632 g_snprintf(buf, sizeof buf, "Status: %s", yahoo_get_status_string(b->uc >> 5)); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
633 else |
1400
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1395
diff
changeset
|
634 g_snprintf(buf, sizeof buf, "Custom Status: %s", |
476b24cdfa32
[gaim-migrate @ 1410]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1395
diff
changeset
|
635 (char *)g_hash_table_lookup(yd->hash, b->name)); |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
636 button = gtk_menu_item_new_with_label(buf); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
637 gtk_menu_append(GTK_MENU(menu), button); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
638 gtk_widget_show(button); |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
639 } |
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
640 |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
641 static GList *yahoo_away_states() { |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
642 GList *m = NULL; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
643 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
644 m = g_list_append(m, "Available"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
645 m = g_list_append(m, "Be Right Back"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
646 m = g_list_append(m, "Busy"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
647 m = g_list_append(m, "Not At Home"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
648 m = g_list_append(m, "Not At Desk"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
649 m = g_list_append(m, "Not In Office"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
650 m = g_list_append(m, "On Phone"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
651 m = g_list_append(m, "On Vacation"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
652 m = g_list_append(m, "Out To Lunch"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
653 m = g_list_append(m, "Stepped Out"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
654 m = g_list_append(m, "Invisible"); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
655 m = g_list_append(m, GAIM_AWAY_CUSTOM); |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
656 |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
657 return m; |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
658 } |
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
659 |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
660 static void yahoo_act_id(gpointer data, char *entry) { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
661 struct gaim_connection *gc = data; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
662 struct yahoo_data *yd = gc->proto_data; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
663 |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
664 yahoo_activate_id(yd->sess, entry); |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
665 if (yd->active_id) |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
666 g_free(yd->active_id); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
667 yd->active_id = g_strdup(entry); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
668 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
669 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
670 static void yahoo_do_action(struct gaim_connection *gc, char *act) { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
671 if (!strcmp(act, "Activate ID")) { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
672 do_prompt_dialog("Activate which ID:", gc, yahoo_act_id, NULL); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
673 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
674 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
675 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
676 static GList *yahoo_actions() { |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
677 GList *m = NULL; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
678 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
679 m = g_list_append(m, "Activate ID"); |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
680 |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
681 return m; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
682 } |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
683 |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
684 struct mod_usr_opt { |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
685 struct aim_user *user; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
686 int opt; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
687 }; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
688 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
689 static void mod_opt(GtkWidget *b, struct mod_usr_opt *m) |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
690 { |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
691 if (m->user->proto_opt[m->opt][0] == '1') |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
692 m->user->proto_opt[m->opt][0] = '\0'; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
693 else |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
694 strcpy(m->user->proto_opt[m->opt],"1"); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
695 } |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
696 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
697 static void free_muo(GtkWidget *b, struct mod_usr_opt *m) |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
698 { |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
699 g_free(m); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
700 } |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
701 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
702 static GtkWidget *yahoo_protoopt_button(const char *text, struct aim_user *u, int option, GtkWidget *box) |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
703 { |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
704 GtkWidget *button; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
705 struct mod_usr_opt *muo = g_new0(struct mod_usr_opt, 1); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
706 button = gtk_check_button_new_with_label(text); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
707 gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(button), (u->proto_opt[option][0] == '1')); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
708 gtk_box_pack_start(GTK_BOX(box), button, FALSE, FALSE, 0); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
709 muo->user = u; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
710 muo->opt = option; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
711 gtk_signal_connect(GTK_OBJECT(button), "clicked", GTK_SIGNAL_FUNC(mod_opt), muo); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
712 gtk_signal_connect(GTK_OBJECT(button), "destroy", GTK_SIGNAL_FUNC(free_muo), muo); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
713 gtk_widget_show(button); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
714 return button; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
715 } |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
716 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
717 static void yahoo_user_opts(GtkWidget *book, struct aim_user *user) |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
718 { |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
719 GtkWidget *vbox; |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
720 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
721 vbox = gtk_vbox_new(FALSE, 5); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
722 gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
723 gtk_notebook_append_page(GTK_NOTEBOOK(book), vbox, gtk_label_new("Yahoo Options")); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
724 gtk_widget_show(vbox); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
725 |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
726 yahoo_protoopt_button("Notify me of new Yahoo! Mail", user, USEROPT_MAIL, vbox); |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
727 } |
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
728 |
1054 | 729 static struct prpl *my_protocol = NULL; |
730 | |
731 void Yahoo_init(struct prpl *ret) { | |
732 /* the NULL's aren't required but they're nice to have */ | |
733 ret->protocol = PROTO_YAHOO; | |
734 ret->name = yahoo_name; | |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
735 ret->list_icon = yahoo_list_icon; |
1401
bf041349b11e
[gaim-migrate @ 1411]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1400
diff
changeset
|
736 ret->away_states = yahoo_away_states; |
1500
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
737 ret->actions = yahoo_actions; |
a054c28735fb
[gaim-migrate @ 1510]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1499
diff
changeset
|
738 ret->do_action = yahoo_do_action; |
1499
de0b946e86a4
[gaim-migrate @ 1509]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1496
diff
changeset
|
739 ret->buddy_menu = yahoo_buddy_menu; |
1891
1c977d995da9
[gaim-migrate @ 1901]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1881
diff
changeset
|
740 ret->user_opts = yahoo_user_opts; |
1054 | 741 ret->login = yahoo_login; |
742 ret->close = yahoo_close; | |
743 ret->send_im = yahoo_send_im; | |
744 ret->set_info = NULL; | |
745 ret->get_info = NULL; | |
1143
403989ecc1cc
[gaim-migrate @ 1153]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1136
diff
changeset
|
746 ret->set_away = yahoo_set_away; |
1054 | 747 ret->get_away_msg = NULL; |
748 ret->set_dir = NULL; | |
749 ret->get_dir = NULL; | |
750 ret->dir_search = NULL; | |
751 ret->set_idle = yahoo_set_idle; | |
752 ret->change_passwd = NULL; | |
753 ret->add_buddy = gyahoo_add_buddy; | |
1300
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
754 ret->add_buddies = yahoo_add_buddies; |
59f08eb64017
[gaim-migrate @ 1310]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1298
diff
changeset
|
755 ret->remove_buddy = gyahoo_remove_buddy; |
1054 | 756 ret->add_permit = NULL; |
757 ret->add_deny = NULL; | |
758 ret->rem_permit = NULL; | |
759 ret->rem_deny = NULL; | |
760 ret->set_permit_deny = NULL; | |
761 ret->warn = NULL; | |
762 ret->accept_chat = NULL; | |
763 ret->join_chat = NULL; | |
764 ret->chat_invite = NULL; | |
765 ret->chat_leave = NULL; | |
766 ret->chat_whisper = NULL; | |
767 ret->chat_send = NULL; | |
768 ret->keepalive = yahoo_keepalive; | |
769 | |
770 my_protocol = ret; | |
771 } | |
772 | |
773 char *gaim_plugin_init(GModule *handle) { | |
1443
336fc98b7f90
[gaim-migrate @ 1453]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1404
diff
changeset
|
774 load_protocol(Yahoo_init, sizeof(struct prpl)); |
1546
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
775 yahoo_socket_notify = yahoo_notify; |
92b3dd1e4129
[gaim-migrate @ 1556]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1514
diff
changeset
|
776 yahoo_print = yahoo_debug; |
1879
6497ee3751cf
[gaim-migrate @ 1889]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
1815
diff
changeset
|
777 yahoo_connector = yahoo_connect_to; |
1054 | 778 return NULL; |
779 } | |
780 | |
781 void gaim_plugin_remove() { | |
782 struct prpl *p = find_prpl(PROTO_YAHOO); | |
783 if (p == my_protocol) | |
784 unload_protocol(p); | |
785 } |