Mercurial > pidgin
annotate src/protocols/gg/gg.c @ 13644:d70f4e25eab5
[gaim-migrate @ 16042]
GG PRPL: Display a more meaningful status of a buddy is User Info.
committer: Tailor Script <tailor@pidgin.im>
author | Bartoz Oler <bartosz@pidgin.im> |
---|---|
date | Sun, 16 Apr 2006 20:18:17 +0000 |
parents | c99d04f8a42b |
children | 4fa4f2909b0d |
rev | line source |
---|---|
11394 | 1 /** |
2 * @file gg.c Gadu-Gadu protocol plugin | |
3 * | |
4 * gaim | |
5 * | |
6 * Copyright (C) 2005 Bartosz Oler <bartosz@bzimage.us> | |
7 * | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
8 * Some parts of the code are adapted or taken from the previous implementation |
11394 | 9 * of this plugin written by Arkadiusz Miskiewicz <misiek@pld.org.pl> |
10 * | |
11 * Thanks to Google's Summer of Code Program. | |
12 * | |
13 * This program is free software; you can redistribute it and/or modify | |
14 * it under the terms of the GNU General Public License as published by | |
15 * the Free Software Foundation; either version 2 of the License, or | |
16 * (at your option) any later version. | |
17 * | |
18 * This program is distributed in the hope that it will be useful, | |
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 * GNU General Public License for more details. | |
22 * | |
23 * You should have received a copy of the GNU General Public License | |
24 * along with this program; if not, write to the Free Software | |
25 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
26 */ | |
27 | |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
28 #include "internal.h" |
2393 | 29 |
11360 | 30 #include "plugin.h" |
31 #include "version.h" | |
32 #include "notify.h" | |
33 #include "status.h" | |
9030 | 34 #include "blist.h" |
11360 | 35 #include "accountopt.h" |
5872
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
36 #include "debug.h" |
059d95c67cda
[gaim-migrate @ 6304]
Christian Hammond <chipx86@chipx86.com>
parents:
5681
diff
changeset
|
37 #include "util.h" |
11360 | 38 #include "request.h" |
2393 | 39 |
13317
41747a38a1a8
[gaim-migrate @ 15686]
Richard Laager <rlaager@wiktel.com>
parents:
13308
diff
changeset
|
40 #include <libgadu.h> |
5603 | 41 |
11414 | 42 #include "gg.h" |
43 #include "confer.h" | |
44 #include "search.h" | |
45 #include "buddylist.h" | |
13626
fa7313d125ac
[gaim-migrate @ 16013]
Evan Schoenberg <evan.s@dreskin.net>
parents:
13572
diff
changeset
|
46 #include "gg-utils.h" |
11394 | 47 |
11414 | 48 static GaimPlugin *my_protocol = NULL; |
11394 | 49 |
11360 | 50 /* ---------------------------------------------------------------------- */ |
11414 | 51 /* ----- EXTERNAL CALLBACKS --------------------------------------------- */ |
11360 | 52 /* ---------------------------------------------------------------------- */ |
9950 | 53 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
54 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
55 /* ----- HELPERS -------------------------------------------------------- */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
56 |
13514 | 57 /** |
58 * Set up libgadu's proxy. | |
59 * | |
60 * @param account Account for which to set up the proxy. | |
61 * | |
62 * @return Zero if proxy setup is valid, otherwise -1. | |
63 */ | |
64 /* static int ggp_setup_proxy(GaimAccount *account) {{{ */ | |
65 static int ggp_setup_proxy(GaimAccount *account) | |
66 { | |
67 GaimProxyInfo *gpi; | |
68 | |
69 gpi = gaim_proxy_get_setup(account); | |
70 | |
71 if ((gaim_proxy_info_get_type(gpi) != GAIM_PROXY_NONE) && | |
72 (gaim_proxy_info_get_host(gpi) == NULL || | |
73 gaim_proxy_info_get_port(gpi) <= 0)) { | |
74 | |
75 gg_proxy_enabled = 0; | |
76 gaim_notify_error(NULL, NULL, _("Invalid proxy settings"), | |
77 _("Either the host name or port number specified for your given proxy type is invalid.")); | |
78 return -1; | |
79 } else if (gaim_proxy_info_get_type(gpi) != GAIM_PROXY_NONE) { | |
80 gg_proxy_enabled = 1; | |
81 gg_proxy_host = g_strdup(gaim_proxy_info_get_host(gpi)); | |
82 gg_proxy_port = gaim_proxy_info_get_port(gpi); | |
83 gg_proxy_username = g_strdup(gaim_proxy_info_get_username(gpi)); | |
84 gg_proxy_password = g_strdup(gaim_proxy_info_get_password(gpi)); | |
85 } else { | |
86 gg_proxy_enabled = 0; | |
87 } | |
88 | |
89 return 0; | |
90 } | |
91 /* }}} */ | |
92 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
93 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
94 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
95 /* static void ggp_async_token_handler(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
96 static void ggp_async_token_handler(gpointer _gc, gint fd, GaimInputCondition cond) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
97 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
98 GaimConnection *gc = _gc; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
99 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
100 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
101 GGPTokenCallback cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
102 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
103 struct gg_token *t = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
104 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
105 gaim_debug_info("gg", "token_handler: token->req: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
106 token->req->check, token->req->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
107 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
108 if (gg_token_watch_fd(token->req) == -1 || token->req->state == GG_STATE_ERROR) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
109 gaim_debug_error("gg", "token error (1): %d\n", token->req->error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
110 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
111 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
112 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
113 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
114 gaim_notify_error(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
115 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
116 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
117 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
118 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
119 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
120 if (token->req->state != GG_STATE_DONE) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
121 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
122 token->inpa = gaim_input_add(token->req->fd, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
123 (token->req->check == 1) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
124 ? GAIM_INPUT_WRITE |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
125 : GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
126 ggp_async_token_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
127 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
128 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
129 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
130 if (!(t = token->req->data) || !token->req->body) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
131 gaim_debug_error("gg", "token error (2): %d\n", token->req->error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
132 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
133 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
134 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
135 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
136 gaim_notify_error(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
137 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
138 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
139 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
140 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
141 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
142 gaim_input_remove(token->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
143 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
144 token->id = g_strdup(t->tokenid); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
145 token->size = token->req->body_size; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
146 token->data = g_new0(char, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
147 memcpy(token->data, token->req->body, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
148 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
149 gaim_debug_info("gg", "TOKEN! tokenid = %s; size = %d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
150 token->id, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
151 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
152 gg_token_free(token->req); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
153 token->req = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
154 token->inpa = 0; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
155 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
156 cb = token->cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
157 token->cb = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
158 cb(gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
159 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
160 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
161 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
162 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
163 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
164 /* static void ggp_token_request(GaimConnection *gc, GGPTokenCallback cb) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
165 static void ggp_token_request(GaimConnection *gc, GGPTokenCallback cb) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
166 { |
13514 | 167 GaimAccount *account; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
168 struct gg_http *req; |
13514 | 169 GGPInfo *info; |
170 | |
171 account = gaim_connection_get_account(gc); | |
172 | |
173 if (ggp_setup_proxy(account) == -1) | |
174 return; | |
175 | |
176 info = gc->proto_data; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
177 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
178 if ((req = gg_token(1)) == NULL) { |
13514 | 179 gaim_notify_error(account, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
180 _("Token Error"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
181 _("Unable to fetch the token.\n"), NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
182 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
183 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
184 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
185 info->token = g_new(GGPToken, 1); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
186 info->token->cb = cb; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
187 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
188 info->token->req = req; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
189 info->token->inpa = gaim_input_add(req->fd, GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
190 ggp_async_token_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
191 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
192 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
193 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
194 /* ---------------------------------------------------------------------- */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
195 |
11360 | 196 /** |
197 * Request buddylist from the server. | |
198 * Buddylist is received in the ggp_callback_recv(). | |
199 * | |
200 * @param Current action handler. | |
201 */ | |
202 /* static void ggp_action_buddylist_get(GaimPluginAction *action) {{{ */ | |
203 static void ggp_action_buddylist_get(GaimPluginAction *action) | |
204 { | |
205 GaimConnection *gc = (GaimConnection *)action->context; | |
206 GGPInfo *info = gc->proto_data; | |
207 | |
208 gaim_debug_info("gg", "Downloading...\n"); | |
209 | |
210 gg_userlist_request(info->session, GG_USERLIST_GET, NULL); | |
211 } | |
212 /* }}} */ | |
213 | |
214 /** | |
215 * Upload the buddylist to the server. | |
216 * | |
217 * @param action Current action handler. | |
218 */ | |
219 /* static void ggp_action_buddylist_put(GaimPluginAction *action) {{{ */ | |
220 static void ggp_action_buddylist_put(GaimPluginAction *action) | |
221 { | |
222 GaimConnection *gc = (GaimConnection *)action->context; | |
223 GGPInfo *info = gc->proto_data; | |
224 | |
225 char *buddylist = ggp_buddylist_dump(gaim_connection_get_account(gc)); | |
226 | |
227 gaim_debug_info("gg", "Uploading...\n"); | |
228 | |
229 if (buddylist == NULL) | |
230 return; | |
231 | |
232 gg_userlist_request(info->session, GG_USERLIST_PUT, buddylist); | |
233 g_free(buddylist); | |
234 } | |
235 /* }}} */ | |
236 | |
237 /** | |
238 * Delete buddylist from the server. | |
239 * | |
240 * @param action Current action handler. | |
241 */ | |
242 /* static void ggp_action_buddylist_delete(GaimPluginAction *action) {{{ */ | |
243 static void ggp_action_buddylist_delete(GaimPluginAction *action) | |
244 { | |
245 GaimConnection *gc = (GaimConnection *)action->context; | |
246 GGPInfo *info = gc->proto_data; | |
247 | |
248 gaim_debug_info("gg", "Deleting...\n"); | |
249 | |
250 gg_userlist_request(info->session, GG_USERLIST_PUT, NULL); | |
251 } | |
252 /* }}} */ | |
253 | |
254 /* | |
255 */ | |
256 /* static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file) {{{ */ | |
257 static void ggp_callback_buddylist_save_ok(GaimConnection *gc, gchar *file) | |
258 { | |
259 GaimAccount *account = gaim_connection_get_account(gc); | |
260 | |
261 FILE *fh; | |
262 char *buddylist = ggp_buddylist_dump(account); | |
263 gchar *msg; | |
264 | |
265 gaim_debug_info("gg", "Saving...\n"); | |
266 gaim_debug_info("gg", "file = %s\n", file); | |
267 | |
268 if (buddylist == NULL) { | |
269 gaim_notify_info(account, _("Save Buddylist..."), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
270 _("Your buddylist is empty, nothing was written to the file."), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
271 NULL); |
2792
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
272 return; |
9123abd0db92
[gaim-migrate @ 2805]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2791
diff
changeset
|
273 } |
2393 | 274 |
11360 | 275 if ((fh = g_fopen(file, "wb")) == NULL) { |
276 msg = g_strconcat(_("Couldn't open file"), ": ", file, "\n", NULL); | |
277 gaim_debug_error("gg", "Could not open file: %s\n", file); | |
278 gaim_notify_error(account, _("Couldn't open file"), msg, NULL); | |
279 g_free(msg); | |
280 g_free(file); | |
281 return; | |
282 } | |
283 | |
284 fwrite(buddylist, sizeof(char), g_utf8_strlen(buddylist, -1), fh); | |
285 fclose(fh); | |
286 g_free(buddylist); | |
287 | |
288 gaim_notify_info(account, _("Save Buddylist..."), | |
289 _("Buddylist saved successfully!"), NULL); | |
290 } | |
291 /* }}} */ | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
292 |
11360 | 293 /* |
294 */ | |
295 /* static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file) {{{ */ | |
296 static void ggp_callback_buddylist_load_ok(GaimConnection *gc, gchar *file) | |
297 { | |
298 GaimAccount *account = gaim_connection_get_account(gc); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
299 GError *error = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
300 char *buddylist = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
301 gsize length; |
11360 | 302 |
303 gaim_debug_info("gg", "file_name = %s\n", file); | |
304 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
305 if (!g_file_get_contents(file, &buddylist, &length, &error)) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
306 gaim_notify_error(account, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
307 _("Couldn't load buddylist"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
308 _("Couldn't load buddylist"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
309 error->message); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
310 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
311 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
312 "Couldn't load buddylist. file = %s; error = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
313 file, error->message); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
314 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
315 g_error_free(error); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
316 |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
317 return; |
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
318 } |
11360 | 319 |
320 ggp_buddylist_load(gc, buddylist); | |
321 g_free(buddylist); | |
322 | |
323 gaim_notify_info(account, | |
324 _("Load Buddylist..."), | |
325 _("Buddylist loaded successfully!"), NULL); | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
326 } |
11360 | 327 /* }}} */ |
328 | |
329 /* | |
330 */ | |
331 /* static void ggp_action_buddylist_save(GaimPluginAction *action) {{{ */ | |
332 static void ggp_action_buddylist_save(GaimPluginAction *action) | |
333 { | |
334 GaimConnection *gc = (GaimConnection *)action->context; | |
335 | |
336 gaim_request_file(action, _("Save buddylist..."), NULL, TRUE, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
337 G_CALLBACK(ggp_callback_buddylist_save_ok), NULL, gc); |
11360 | 338 } |
339 /* }}} */ | |
2806
1ffac7cf4e94
[gaim-migrate @ 2819]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2792
diff
changeset
|
340 |
11360 | 341 /* |
342 */ | |
343 /* static void ggp_action_buddylist_load(GaimPluginAction *action) {{{ */ | |
344 static void ggp_action_buddylist_load(GaimPluginAction *action) | |
345 { | |
346 GaimConnection *gc = (GaimConnection *)action->context; | |
347 | |
348 gaim_request_file(action, "Load buddylist from file...", NULL, FALSE, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
349 G_CALLBACK(ggp_callback_buddylist_load_ok), NULL, gc); |
11360 | 350 } |
351 /* }}} */ | |
352 | |
353 /* | |
354 */ | |
11414 | 355 /* static void ggp_callback_register_account_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
356 static void ggp_callback_register_account_ok(GaimConnection *gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
357 GaimRequestFields *fields) |
11414 | 358 { |
359 GaimAccount *account; | |
360 GGPInfo *info = gc->proto_data; | |
361 struct gg_http *h = NULL; | |
362 struct gg_pubdir *s; | |
363 uin_t uin; | |
364 gchar *email, *p1, *p2, *t; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
365 GGPToken *token = info->token; |
11414 | 366 |
367 email = charset_convert(gaim_request_fields_get_string(fields, "email"), | |
368 "UTF-8", "CP1250"); | |
369 p1 = charset_convert(gaim_request_fields_get_string(fields, "password1"), | |
370 "UTF-8", "CP1250"); | |
371 p2 = charset_convert(gaim_request_fields_get_string(fields, "password2"), | |
372 "UTF-8", "CP1250"); | |
373 t = charset_convert(gaim_request_fields_get_string(fields, "token"), | |
374 "UTF-8", "CP1250"); | |
375 | |
376 account = gaim_connection_get_account(gc); | |
377 | |
378 if (email == NULL || p1 == NULL || p2 == NULL || t == NULL || | |
379 *email == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
380 gaim_connection_error(gc, _("Fill in the registration fields.")); |
11414 | 381 goto exit_err; |
382 } | |
383 | |
384 if (g_utf8_collate(p1, p2) != 0) { | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
385 gaim_connection_error(gc, _("Passwords do not match.")); |
11414 | 386 goto exit_err; |
387 } | |
388 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
389 gaim_debug_info("gg", "register_account_ok: token_id = %d; t = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
390 token->id, t); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
391 h = gg_register3(email, p1, token->id, t, 0); |
11414 | 392 if (h == NULL || !(s = h->data) || !s->success) { |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
393 gaim_connection_error(gc, |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
394 _("Unable to register new account. Error occurred.\n")); |
11414 | 395 goto exit_err; |
396 } | |
397 | |
398 uin = s->uin; | |
399 gaim_debug_info("gg", "registered uin: %d\n", uin); | |
400 | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
401 g_free(t); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
402 t = g_strdup_printf("%u", uin); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
403 gaim_account_set_username(account, t); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
404 /* Save the password if remembering passwords for the account */ |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
405 gaim_account_set_password(account, p1); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
406 |
11414 | 407 gaim_notify_info(NULL, _("New Gadu-Gadu Account Registered"), |
408 _("Registration completed successfully!"), NULL); | |
409 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
410 /* TODO: the currently open Accounts Window will not be updated withthe |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
411 * new username and etc, we need to somehow have it refresh at this |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
412 * point |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
413 */ |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
414 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
415 /* Need to disconnect or actually log in. For now, we disconnect. */ |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
416 gaim_connection_destroy(gc); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
417 |
11414 | 418 exit_err: |
419 gg_register_free(h); | |
420 g_free(email); | |
421 g_free(p1); | |
422 g_free(p2); | |
423 g_free(t); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
424 g_free(token->id); |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
425 g_free(token); |
11414 | 426 } |
427 /* }}} */ | |
428 | |
11565 | 429 /* |
430 */ | |
431 /* static void ggp_callback_register_account_cancel(GaimConnection *gc, GaimRequestFields *fields) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
432 static void ggp_callback_register_account_cancel(GaimConnection *gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
433 GaimRequestFields *fields) |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
434 { |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
435 GGPInfo *info = gc->proto_data; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
436 GGPToken *token = info->token; |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
437 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
438 gaim_connection_destroy(gc); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
439 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
440 g_free(token->id); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
441 g_free(token->data); |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
442 g_free(token); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
443 |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
444 } |
11565 | 445 /* }}} */ |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
446 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
447 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
448 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
449 /* static void ggp_register_user_dialog(GaimConnection *gc) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
450 static void ggp_register_user_dialog(GaimConnection *gc) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
451 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
452 GaimAccount *account; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
453 GaimRequestFields *fields; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
454 GaimRequestFieldGroup *group; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
455 GaimRequestField *field; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
456 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
457 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
458 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
459 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
460 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
461 account = gaim_connection_get_account(gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
462 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
463 fields = gaim_request_fields_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
464 group = gaim_request_field_group_new(NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
465 gaim_request_fields_add_group(fields, group); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
466 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
467 field = gaim_request_field_string_new("email", |
13545
cfc2f7fcb3dd
[gaim-migrate @ 15922]
Richard Laager <rlaager@wiktel.com>
parents:
13517
diff
changeset
|
468 _("E-mail"), "", FALSE); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
469 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
470 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
471 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
472 field = gaim_request_field_string_new("password1", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
473 _("Password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
474 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
475 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
476 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
477 field = gaim_request_field_string_new("password2", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
478 _("Password (retype)"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
479 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
480 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
481 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
482 field = gaim_request_field_string_new("token", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
483 _("Enter current token"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
484 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
485 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
486 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
487 /* original size: 60x24 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
488 field = gaim_request_field_image_new("token_img", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
489 _("Current token"), token->data, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
490 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
491 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
492 gaim_request_fields(account, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
493 _("Register New Gadu-Gadu Account"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
494 _("Register New Gadu-Gadu Account"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
495 _("Please, fill in the following fields"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
496 fields, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
497 _("OK"), G_CALLBACK(ggp_callback_register_account_ok), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
498 _("Cancel"), G_CALLBACK(ggp_callback_register_account_cancel), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
499 gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
500 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
501 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
502 |
11414 | 503 /* ----- PUBLIC DIRECTORY SEARCH ---------------------------------------- */ |
504 | |
505 /* | |
506 */ | |
13641 | 507 /* static void ggp_callback_show_next(GaimConnection *gc, GList *row, gpointer user_data) {{{ */ |
508 static void ggp_callback_show_next(GaimConnection *gc, GList *row, gpointer user_data) | |
11414 | 509 { |
510 GGPInfo *info = gc->proto_data; | |
13640 | 511 GGPSearchForm *form = user_data; |
512 guint32 seq; | |
11414 | 513 |
13640 | 514 g_free(form->offset); |
515 form->offset = g_strdup(form->last_uin); | |
516 | |
517 ggp_search_remove(info->searches, form->seq); | |
518 | |
519 seq = ggp_search_start(gc, form); | |
520 ggp_search_add(info->searches, seq, form); | |
11414 | 521 } |
522 /* }}} */ | |
523 | |
524 /* | |
525 */ | |
13641 | 526 /* static void ggp_callback_add_buddy(GaimConnection *gc, GList *row, gpointer user_data) {{{ */ |
527 static void ggp_callback_add_buddy(GaimConnection *gc, GList *row, gpointer user_data) | |
11414 | 528 { |
529 gaim_blist_request_add_buddy(gaim_connection_get_account(gc), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
530 g_list_nth_data(row, 0), NULL, NULL); |
11414 | 531 } |
532 /* }}} */ | |
533 | |
534 /* | |
535 */ | |
13641 | 536 /* static void ggp_callback_im(GaimConnection *gc, GList *row, gpointer user_data) {{{ */ |
537 static void ggp_callback_im(GaimConnection *gc, GList *row, gpointer user_data) | |
538 { | |
539 GaimAccount *account; | |
540 GaimConversation *conv; | |
541 char *name; | |
542 | |
543 account = gaim_connection_get_account(gc); | |
544 | |
545 name = g_list_nth_data(row, 0); | |
546 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); | |
547 gaim_conversation_present(conv); | |
548 } | |
549 /* }}} */ | |
550 | |
551 /* | |
552 */ | |
11414 | 553 /* static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields) {{{ */ |
554 static void ggp_callback_find_buddies(GaimConnection *gc, GaimRequestFields *fields) | |
555 { | |
556 GGPInfo *info = gc->proto_data; | |
557 GGPSearchForm *form; | |
13640 | 558 guint32 seq; |
11414 | 559 |
13640 | 560 form = ggp_search_form_new(GGP_SEARCH_TYPE_FULL); |
11414 | 561 |
13640 | 562 form->user_data = info; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
563 form->lastname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
564 gaim_request_fields_get_string(fields, "lastname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
565 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
566 form->firstname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
567 gaim_request_fields_get_string(fields, "firstname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
568 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
569 form->nickname = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
570 gaim_request_fields_get_string(fields, "nickname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
571 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
572 form->city = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
573 gaim_request_fields_get_string(fields, "city"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
574 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
575 form->birthyear = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
576 gaim_request_fields_get_string(fields, "year"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
577 "UTF-8", "CP1250"); |
11414 | 578 |
579 switch (gaim_request_fields_get_choice(fields, "gender")) { | |
580 case 1: | |
581 form->gender = g_strdup(GG_PUBDIR50_GENDER_MALE); | |
582 break; | |
583 case 2: | |
584 form->gender = g_strdup(GG_PUBDIR50_GENDER_FEMALE); | |
585 break; | |
586 default: | |
587 form->gender = NULL; | |
588 break; | |
589 } | |
590 | |
591 form->active = gaim_request_fields_get_bool(fields, "active") | |
592 ? g_strdup(GG_PUBDIR50_ACTIVE_TRUE) : NULL; | |
593 | |
594 form->offset = g_strdup("0"); | |
595 | |
13640 | 596 seq = ggp_search_start(gc, form); |
597 ggp_search_add(info->searches, seq, form); | |
11414 | 598 } |
599 /* }}} */ | |
600 | |
601 /* | |
602 */ | |
603 /* static void ggp_find_buddies(GaimPluginAction *action) {{{ */ | |
604 static void ggp_find_buddies(GaimPluginAction *action) | |
605 { | |
606 GaimConnection *gc = (GaimConnection *)action->context; | |
607 | |
608 GaimRequestFields *fields; | |
609 GaimRequestFieldGroup *group; | |
610 GaimRequestField *field; | |
611 | |
612 fields = gaim_request_fields_new(); | |
613 group = gaim_request_field_group_new(NULL); | |
614 gaim_request_fields_add_group(fields, group); | |
615 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
616 field = gaim_request_field_string_new("lastname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
617 _("Last name"), NULL, FALSE); |
11414 | 618 gaim_request_field_string_set_masked(field, FALSE); |
619 gaim_request_field_group_add_field(group, field); | |
620 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
621 field = gaim_request_field_string_new("firstname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
622 _("First name"), NULL, FALSE); |
11414 | 623 gaim_request_field_string_set_masked(field, FALSE); |
624 gaim_request_field_group_add_field(group, field); | |
625 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
626 field = gaim_request_field_string_new("nickname", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
627 _("Nickname"), NULL, FALSE); |
11414 | 628 gaim_request_field_string_set_masked(field, FALSE); |
629 gaim_request_field_group_add_field(group, field); | |
630 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
631 field = gaim_request_field_string_new("city", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
632 _("City"), NULL, FALSE); |
11414 | 633 gaim_request_field_string_set_masked(field, FALSE); |
634 gaim_request_field_group_add_field(group, field); | |
635 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
636 field = gaim_request_field_string_new("year", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
637 _("Year of birth"), NULL, FALSE); |
11414 | 638 gaim_request_field_group_add_field(group, field); |
639 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
640 field = gaim_request_field_choice_new("gender", _("Gender"), 0); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
641 gaim_request_field_choice_add(field, _("Male or female")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
642 gaim_request_field_choice_add(field, _("Male")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
643 gaim_request_field_choice_add(field, _("Female")); |
11414 | 644 gaim_request_field_group_add_field(group, field); |
645 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
646 field = gaim_request_field_bool_new("active", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
647 _("Only online"), FALSE); |
11414 | 648 gaim_request_field_group_add_field(group, field); |
649 | |
650 gaim_request_fields(gc, | |
651 _("Find buddies"), | |
652 _("Find buddies"), | |
653 _("Please, enter your search criteria below"), | |
654 fields, | |
655 _("OK"), G_CALLBACK(ggp_callback_find_buddies), | |
656 _("Cancel"), NULL, | |
657 gc); | |
658 } | |
659 /* }}} */ | |
660 | |
661 /* ----- CHANGE PASSWORD ------------------------------------------------ */ | |
662 | |
663 /* | |
664 */ | |
11360 | 665 /* static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ |
666 static void ggp_callback_change_passwd_ok(GaimConnection *gc, GaimRequestFields *fields) | |
2393 | 667 { |
11360 | 668 GaimAccount *account; |
669 GGPInfo *info = gc->proto_data; | |
670 struct gg_http *h; | |
671 gchar *cur, *p1, *p2, *t; | |
672 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
673 cur = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
674 gaim_request_fields_get_string(fields, "password_cur"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
675 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
676 p1 = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
677 gaim_request_fields_get_string(fields, "password1"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
678 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
679 p2 = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
680 gaim_request_fields_get_string(fields, "password2"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
681 "UTF-8", "CP1250"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
682 t = charset_convert( |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
683 gaim_request_fields_get_string(fields, "token"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
684 "UTF-8", "CP1250"); |
11360 | 685 |
686 account = gaim_connection_get_account(gc); | |
687 | |
688 if (cur == NULL || p1 == NULL || p2 == NULL || t == NULL || | |
689 *cur == '\0' || *p1 == '\0' || *p2 == '\0' || *t == '\0') { | |
690 gaim_notify_error(account, NULL, _("Fill in the fields."), NULL); | |
691 goto exit_err; | |
692 } | |
693 | |
694 if (g_utf8_collate(p1, p2) != 0) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
695 gaim_notify_error(account, NULL, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
696 _("New passwords do not match."), NULL); |
11360 | 697 goto exit_err; |
698 } | |
2393 | 699 |
11360 | 700 if (g_utf8_collate(cur, gaim_account_get_password(account)) != 0) { |
701 gaim_notify_error(account, NULL, | |
702 _("Your current password is different from the one that you specified."), | |
703 NULL); | |
704 goto exit_err; | |
705 } | |
706 | |
12457 | 707 gaim_debug_info("gg", "Changing password\n"); |
11360 | 708 |
709 /* XXX: this e-mail should be a pref... */ | |
710 h = gg_change_passwd4(ggp_get_uin(account), | |
711 "user@example.net", gaim_account_get_password(account), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
712 p1, info->token->id, t, 0); |
2393 | 713 |
11360 | 714 if (h == NULL) { |
715 gaim_notify_error(account, NULL, | |
716 _("Unable to change password. Error occured.\n"), | |
717 NULL); | |
718 goto exit_err; | |
719 } | |
720 | |
721 gaim_account_set_password(account, p1); | |
722 | |
723 gg_change_passwd_free(h); | |
724 | |
725 gaim_notify_info(account, _("Change password for the Gadu-Gadu account"), | |
726 _("Password was changed successfully!"), NULL); | |
727 | |
728 exit_err: | |
729 g_free(cur); | |
730 g_free(p1); | |
731 g_free(p2); | |
732 g_free(t); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
733 g_free(info->token->id); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
734 g_free(info->token->data); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
735 g_free(info->token); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
736 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
737 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
738 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
739 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
740 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
741 /* static void ggp_change_passwd_dialog(GaimConnection *gc) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
742 static void ggp_change_passwd_dialog(GaimConnection *gc) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
743 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
744 GaimRequestFields *fields; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
745 GaimRequestFieldGroup *group; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
746 GaimRequestField *field; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
747 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
748 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
749 GGPToken *token = info->token; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
750 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
751 char *msg; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
752 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
753 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
754 fields = gaim_request_fields_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
755 group = gaim_request_field_group_new(NULL); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
756 gaim_request_fields_add_group(fields, group); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
757 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
758 field = gaim_request_field_string_new("password_cur", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
759 _("Current password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
760 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
761 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
762 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
763 field = gaim_request_field_string_new("password1", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
764 _("Password"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
765 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
766 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
767 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
768 field = gaim_request_field_string_new("password2", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
769 _("Password (retype)"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
770 gaim_request_field_string_set_masked(field, TRUE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
771 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
772 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
773 field = gaim_request_field_string_new("token", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
774 _("Enter current token"), "", FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
775 gaim_request_field_string_set_masked(field, FALSE); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
776 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
777 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
778 /* original size: 60x24 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
779 field = gaim_request_field_image_new("token_img", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
780 _("Current token"), token->data, token->size); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
781 gaim_request_field_group_add_field(group, field); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
782 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
783 msg = g_strdup_printf("%s %d", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
784 _("Please, enter your current password and your new password for UIN: "), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
785 ggp_get_uin(gaim_connection_get_account(gc))); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
786 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
787 gaim_request_fields(gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
788 _("Change Gadu-Gadu Password"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
789 _("Change Gadu-Gadu Password"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
790 msg, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
791 fields, _("OK"), G_CALLBACK(ggp_callback_change_passwd_ok), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
792 _("Cancel"), NULL, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
793 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
794 g_free(msg); |
11360 | 795 } |
796 /* }}} */ | |
2393 | 797 |
11360 | 798 /* |
799 */ | |
800 /* static void ggp_change_passwd(GaimPluginAction *action) {{{ */ | |
801 static void ggp_change_passwd(GaimPluginAction *action) | |
802 { | |
803 GaimConnection *gc = (GaimConnection *)action->context; | |
804 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
805 ggp_token_request(gc, ggp_change_passwd_dialog); |
11360 | 806 } |
807 /* }}} */ | |
808 | |
11414 | 809 /* ----- CONFERENCES ---------------------------------------------------- */ |
810 | |
11394 | 811 /* |
812 */ | |
813 /* static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields) {{{ */ | |
814 static void ggp_callback_add_to_chat_ok(GaimConnection *gc, GaimRequestFields *fields) | |
815 { | |
816 GGPInfo *info = gc->proto_data; | |
817 GaimRequestField *field; | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
818 const GList *sel; |
11394 | 819 |
820 field = gaim_request_fields_get_field(fields, "name"); | |
821 sel = gaim_request_field_list_get_selected(field); | |
822 | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
823 ggp_confer_participants_add_uin(gc, sel->data, info->tmp_buddy); |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
824 info->tmp_buddy = 0; |
11394 | 825 } |
826 /* }}} */ | |
827 | |
828 /* | |
829 */ | |
830 /* static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored) {{{ */ | |
831 static void ggp_bmenu_add_to_chat(GaimBlistNode *node, gpointer ignored) | |
832 { | |
833 GaimBuddy *buddy; | |
834 GaimConnection *gc; | |
835 GGPInfo *info; | |
836 | |
837 GaimRequestFields *fields; | |
838 GaimRequestFieldGroup *group; | |
839 GaimRequestField *field; | |
840 | |
841 GList *l; | |
842 gchar *msg; | |
843 | |
844 buddy = (GaimBuddy *)node; | |
845 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy)); | |
846 info = gc->proto_data; | |
847 | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
848 /* TODO: It tmp_buddy != 0 then stop! */ |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
849 info->tmp_buddy = ggp_str_to_uin(gaim_buddy_get_name(buddy)); |
11394 | 850 |
851 fields = gaim_request_fields_new(); | |
852 group = gaim_request_field_group_new(NULL); | |
853 gaim_request_fields_add_group(fields, group); | |
854 | |
855 field = gaim_request_field_list_new("name", "Chat name"); | |
856 for (l = info->chats; l != NULL; l = l->next) { | |
857 GGPChat *chat = l->data; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
858 gaim_request_field_list_add(field, g_strdup(chat->name), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
859 g_strdup(chat->name)); |
11394 | 860 } |
861 gaim_request_field_group_add_field(group, field); | |
862 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
863 msg = g_strdup_printf(_("Select a chat for buddy: %s"), |
13465 | 864 gaim_buddy_get_alias(buddy)); |
11394 | 865 gaim_request_fields(gc, |
866 _("Add to chat..."), | |
867 _("Add to chat..."), | |
868 msg, | |
869 fields, | |
870 _("Add"), G_CALLBACK(ggp_callback_add_to_chat_ok), | |
871 _("Cancel"), NULL, gc); | |
872 g_free(msg); | |
873 } | |
874 /* }}} */ | |
875 | |
11414 | 876 /* ----- BLOCK BUDDIES -------------------------------------------------- */ |
877 | |
11410 | 878 /* |
879 */ | |
880 /* static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) {{{ */ | |
881 static void ggp_bmenu_block(GaimBlistNode *node, gpointer ignored) | |
882 { | |
883 GaimConnection *gc; | |
884 GaimBuddy *buddy; | |
885 GGPInfo *info; | |
886 uin_t uin; | |
887 | |
888 buddy = (GaimBuddy *)node; | |
889 gc = gaim_account_get_connection(gaim_buddy_get_account(buddy)); | |
890 info = gc->proto_data; | |
891 | |
892 uin = ggp_str_to_uin(gaim_buddy_get_name(buddy)); | |
893 | |
894 if (gaim_blist_node_get_bool(node, "blocked")) { | |
895 gaim_blist_node_set_bool(node, "blocked", FALSE); | |
896 gg_remove_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
897 gg_add_notify_ex(info->session, uin, GG_USER_NORMAL); | |
898 gaim_debug_info("gg", "send: uin=%d; mode=NORMAL\n", uin); | |
899 } else { | |
900 gaim_blist_node_set_bool(node, "blocked", TRUE); | |
901 gg_remove_notify_ex(info->session, uin, GG_USER_NORMAL); | |
902 gg_add_notify_ex(info->session, uin, GG_USER_BLOCKED); | |
903 gaim_debug_info("gg", "send: uin=%d; mode=BLOCKED\n", uin); | |
904 } | |
905 } | |
906 /* }}} */ | |
907 | |
11360 | 908 /* ---------------------------------------------------------------------- */ |
11414 | 909 /* ----- INTERNAL CALLBACKS --------------------------------------------- */ |
910 /* ---------------------------------------------------------------------- */ | |
911 | |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
912 /* just a prototype */ |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
913 static void ggp_set_status(GaimAccount *account, GaimStatus *status); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
914 |
11414 | 915 /** |
916 * Handle change of the status of the buddy. | |
917 * | |
918 * @param gc GaimConnection | |
919 * @param uin UIN of the buddy. | |
920 * @param status ID of the status. | |
921 * @param descr Description. | |
922 */ | |
923 /* static void ggp_generic_status_handler(GaimConnection *gc, uin_t uin, int status, const char *descr) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
924 static void ggp_generic_status_handler(GaimConnection *gc, uin_t uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
925 int status, const char *descr) |
11414 | 926 { |
927 gchar *from; | |
928 const char *st; | |
929 gchar *msg; | |
930 | |
931 from = g_strdup_printf("%ld", (unsigned long int)uin); | |
932 switch (status) { | |
933 case GG_STATUS_NOT_AVAIL: | |
934 case GG_STATUS_NOT_AVAIL_DESCR: | |
935 st = "offline"; | |
936 break; | |
937 case GG_STATUS_AVAIL: | |
938 case GG_STATUS_AVAIL_DESCR: | |
11638 | 939 st = "available"; |
11414 | 940 break; |
941 case GG_STATUS_BUSY: | |
942 case GG_STATUS_BUSY_DESCR: | |
12718
b5fb60cb3bad
[gaim-migrate @ 15062]
Richard Laager <rlaager@wiktel.com>
parents:
12717
diff
changeset
|
943 st = "away"; |
11414 | 944 break; |
945 case GG_STATUS_BLOCKED: | |
946 /* user is blocking us.... */ | |
947 st = "blocked"; | |
948 break; | |
949 default: | |
11638 | 950 st = "available"; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
951 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
952 "GG_EVENT_NOTIFY: Unknown status: %d\n", status); |
11414 | 953 break; |
954 } | |
955 | |
956 gaim_debug_info("gg", "st = %s\n", st); | |
957 msg = charset_convert(descr, "CP1250", "UTF-8"); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
958 gaim_prpl_got_user_status(gaim_connection_get_account(gc), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
959 from, st, "message", msg, NULL); |
11414 | 960 g_free(from); |
961 g_free(msg); | |
962 } | |
963 /* }}} */ | |
964 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
965 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
966 */ |
13642 | 967 /* static void ggp_sr_close_cb(gpointer user_data) {{{ */ |
968 static void ggp_sr_close_cb(gpointer user_data) | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
969 { |
13642 | 970 GGPSearchForm *form = user_data; |
13640 | 971 GGPInfo *info = form->user_data; |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
972 |
13640 | 973 ggp_search_remove(info->searches, form->seq); |
974 ggp_search_form_destroy(form); | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
975 } |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
976 /* }}} */ |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
977 |
13644 | 978 /** |
979 * Translate a status' ID to a more user-friendly name. | |
980 * | |
981 * @param id The ID of the status. | |
982 * | |
983 * @return The user-friendly name of the status. | |
984 */ | |
985 /* static const char *ggp_status_by_id(unsigned int id) {{{ */ | |
986 static const char *ggp_status_by_id(unsigned int id) | |
987 { | |
988 const char *st; | |
989 | |
990 gaim_debug_info("gg", "ggp_status_by_id: %d\n", id); | |
991 switch (id) { | |
992 case GG_STATUS_NOT_AVAIL: | |
993 st = _("Offline"); | |
994 break; | |
995 case GG_STATUS_AVAIL: | |
996 st = _("Available"); | |
997 break; | |
998 case GG_STATUS_BUSY: | |
999 st = _("Away"); | |
1000 break; | |
1001 default: | |
1002 st = _("Unknown"); | |
1003 break; | |
1004 } | |
1005 | |
1006 return st; | |
1007 } | |
1008 /* }}} */ | |
1009 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1010 /* |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1011 */ |
13642 | 1012 /* static void ggp_pubdir_handle_info(GaimConnection *gc, gg_pubdir50_t req, GGPSearchForm *form) {{{ */ |
1013 static void ggp_pubdir_handle_info(GaimConnection *gc, gg_pubdir50_t req, | |
1014 GGPSearchForm *form) | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1015 { |
13642 | 1016 GString *text; |
1017 char *val, *who; | |
1018 | |
1019 text = g_string_new(""); | |
1020 | |
1021 val = ggp_search_get_result(req, 0, GG_PUBDIR50_STATUS); | |
13644 | 1022 /* XXX: Use of ggp_str_to_uin() is an ugly hack! */ |
13642 | 1023 g_string_append_printf(text, "<b>%s:</b> %s<br/>", |
13644 | 1024 _("Status"), ggp_status_by_id(ggp_str_to_uin(val))); |
13642 | 1025 g_free(val); |
1026 | |
1027 who = ggp_search_get_result(req, 0, GG_PUBDIR50_UIN); | |
1028 g_string_append_printf(text, "<b>%s:</b> %s<br/>", | |
1029 _("UIN"), who); | |
1030 | |
1031 val = ggp_search_get_result(req, 0, GG_PUBDIR50_FIRSTNAME); | |
1032 g_string_append_printf(text, "<b>%s:</b> %s<br/>", | |
1033 _("First Name"), val); | |
1034 g_free(val); | |
1035 | |
1036 val = ggp_search_get_result(req, 0, GG_PUBDIR50_NICKNAME); | |
1037 g_string_append_printf(text, "<b>%s:</b> %s<br/>", | |
1038 _("Nickname"), val); | |
1039 g_free(val); | |
1040 | |
1041 val = ggp_search_get_result(req, 0, GG_PUBDIR50_CITY); | |
1042 g_string_append_printf(text, "<b>%s:</b> %s<br/>", | |
1043 _("City"), val); | |
1044 g_free(val); | |
1045 | |
1046 val = ggp_search_get_result(req, 0, GG_PUBDIR50_BIRTHYEAR); | |
1047 if (strncmp(val, "0", 1) == 0) { | |
1048 g_free(val); | |
1049 val = g_strdup(""); | |
1050 } | |
1051 g_string_append_printf(text, "<b>%s:</b> %s<br/>", | |
1052 _("Birth Year"), val); | |
1053 g_free(val); | |
1054 | |
1055 val = ggp_buddy_get_name(gc, ggp_str_to_uin(who)); | |
1056 g_free(who); | |
1057 who = val; | |
1058 | |
1059 val = gaim_strdup_withhtml(text->str); | |
1060 | |
1061 gaim_notify_userinfo(gc, who, val, ggp_sr_close_cb, form); | |
1062 | |
1063 g_string_free(text, TRUE); | |
1064 g_free(val); | |
1065 g_free(who); | |
1066 } | |
1067 /* }}} */ | |
1068 | |
1069 /* | |
1070 */ | |
1071 /* static void ggp_pubdir_handle_full(GaimConnection *gc, gg_pubdir50_t req, GGPSearchForm *form) {{{ */ | |
1072 static void ggp_pubdir_handle_full(GaimConnection *gc, gg_pubdir50_t req, | |
1073 GGPSearchForm *form) | |
1074 { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1075 GaimNotifySearchResults *results; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1076 GaimNotifySearchColumn *column; |
13642 | 1077 int res_count; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1078 int start; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1079 int i; |
13640 | 1080 |
13642 | 1081 g_return_if_fail(form != NULL); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1082 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1083 res_count = gg_pubdir50_count(req); |
13642 | 1084 res_count = (res_count > PUBDIR_RESULTS_MAX) ? PUBDIR_RESULTS_MAX : res_count; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1085 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1086 results = gaim_notify_searchresults_new(); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1087 |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1088 if (results == NULL) { |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1089 gaim_debug_error("gg", "ggp_pubdir_reply_handler: " |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1090 "Unable to display the search results.\n"); |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1091 gaim_notify_error(gc, NULL, |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1092 _("Unable to display the search results."), |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1093 NULL); |
13640 | 1094 ggp_sr_close_cb(form); |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1095 return; |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1096 } |
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1097 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1098 column = gaim_notify_searchresults_column_new(_("UIN")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1099 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1100 |
13572
7773c79bbe01
[gaim-migrate @ 15951]
Richard Laager <rlaager@wiktel.com>
parents:
13545
diff
changeset
|
1101 column = gaim_notify_searchresults_column_new(_("First Name")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1102 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1103 |
12489 | 1104 column = gaim_notify_searchresults_column_new(_("Nickname")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1105 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1106 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1107 column = gaim_notify_searchresults_column_new(_("City")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1108 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1109 |
13572
7773c79bbe01
[gaim-migrate @ 15951]
Richard Laager <rlaager@wiktel.com>
parents:
13545
diff
changeset
|
1110 column = gaim_notify_searchresults_column_new(_("Birth Year")); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1111 gaim_notify_searchresults_column_add(results, column); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1112 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1113 gaim_debug_info("gg", "Going with %d entries\n", res_count); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1114 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1115 start = (int)ggp_str_to_uin(gg_pubdir50_get(req, 0, GG_PUBDIR50_START)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1116 gaim_debug_info("gg", "start = %d\n", start); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1117 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1118 for (i = 0; i < res_count; i++) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1119 GList *row = NULL; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1120 char *birth = ggp_search_get_result(req, i, GG_PUBDIR50_BIRTHYEAR); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1121 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1122 /* TODO: Status will be displayed as an icon. */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1123 /* row = g_list_append(row, ggp_search_get_result(req, i, GG_PUBDIR50_STATUS)); */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1124 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1125 GG_PUBDIR50_UIN)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1126 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1127 GG_PUBDIR50_FIRSTNAME)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1128 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1129 GG_PUBDIR50_NICKNAME)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1130 row = g_list_append(row, ggp_search_get_result(req, i, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1131 GG_PUBDIR50_CITY)); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1132 row = g_list_append(row, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1133 (birth && strncmp(birth, "0", 1)) ? birth : g_strdup("-")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1134 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1135 gaim_notify_searchresults_row_add(results, row); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1136 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1137 if (i == res_count - 1) { |
13640 | 1138 g_free(form->last_uin); |
1139 form->last_uin = ggp_search_get_result(req, i, GG_PUBDIR50_UIN); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1140 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1141 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1142 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1143 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_CONTINUE, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1144 ggp_callback_show_next); |
12624
851b0bd7eb52
[gaim-migrate @ 14960]
Christopher O'Brien <siege@pidgin.im>
parents:
12600
diff
changeset
|
1145 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_ADD, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1146 ggp_callback_add_buddy); |
13641 | 1147 gaim_notify_searchresults_button_add(results, GAIM_NOTIFY_BUTTON_IM, |
1148 ggp_callback_im); | |
13642 | 1149 |
13640 | 1150 if (form->window == NULL) { |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1151 void *h = gaim_notify_searchresults(gc, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1152 _("Gadu-Gadu Public Directory"), |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1153 _("Search results"), NULL, results, |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1154 (GaimNotifyCloseCallback)ggp_sr_close_cb, |
13640 | 1155 form); |
12257
ca27de274225
[gaim-migrate @ 14559]
Richard Laager <rlaager@wiktel.com>
parents:
12220
diff
changeset
|
1156 |
12277
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1157 if (h == NULL) { |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1158 gaim_debug_error("gg", "ggp_pubdir_reply_handler: " |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1159 "Unable to display the search results.\n"); |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1160 gaim_notify_error(gc, NULL, |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1161 _("Unable to display the search results."), |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1162 NULL); |
13640 | 1163 ggp_sr_close_cb(form); |
12277
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1164 return; |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1165 } |
739e3aca067a
[gaim-migrate @ 14581]
Richard Laager <rlaager@wiktel.com>
parents:
12258
diff
changeset
|
1166 |
13640 | 1167 form->window = h; |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1168 } else { |
13640 | 1169 gaim_notify_searchresults_new_rows(gc, results, form->window); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1170 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1171 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1172 /* }}} */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1173 |
13642 | 1174 /* |
1175 */ | |
1176 /* static void ggp_pubdir_reply_handler(GaimConnection *gc, gg_pubdir50_t req) {{{ */ | |
1177 static void ggp_pubdir_reply_handler(GaimConnection *gc, gg_pubdir50_t req) | |
1178 { | |
1179 GGPInfo *info = gc->proto_data; | |
1180 GGPSearchForm *form; | |
1181 int res_count; | |
1182 guint32 seq; | |
1183 | |
1184 seq = gg_pubdir50_seq(req); | |
1185 form = ggp_search_get(info->searches, seq); | |
1186 | |
1187 /* | |
1188 * this can happen when user will request more results | |
1189 * and close the results window before they arrive. | |
1190 */ | |
1191 g_return_if_fail(form != NULL); | |
1192 | |
1193 res_count = gg_pubdir50_count(req); | |
1194 if (res_count < 1) { | |
1195 gaim_debug_info("gg", "GG_EVENT_PUBDIR50_SEARCH_REPLY: Nothing found\n"); | |
1196 gaim_notify_error(gc, NULL, | |
1197 _("No matching users found"), | |
1198 _("There are no users matching your search criteria.")); | |
1199 ggp_sr_close_cb(form); | |
1200 return; | |
1201 } | |
1202 | |
1203 switch (form->search_type) { | |
1204 case GGP_SEARCH_TYPE_INFO: | |
1205 ggp_pubdir_handle_info(gc, req, form); | |
1206 break; | |
1207 case GGP_SEARCH_TYPE_FULL: | |
1208 ggp_pubdir_handle_full(gc, req, form); | |
1209 break; | |
1210 default: | |
1211 gaim_debug_warning("gg", "Unknown search_type!\n"); | |
1212 break; | |
1213 } | |
1214 } | |
1215 /* }}} */ | |
1216 | |
11414 | 1217 /** |
1218 * Dispatch a message received from a buddy. | |
1219 * | |
1220 * @param gc GaimConnection. | |
1221 * @param ev Gadu-Gadu event structure. | |
1222 */ | |
1223 /* static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev) {{{ */ | |
1224 static void ggp_recv_message_handler(GaimConnection *gc, const struct gg_event *ev) | |
1225 { | |
1226 GGPInfo *info = gc->proto_data; | |
1227 GaimConversation *conv; | |
1228 gchar *from; | |
1229 gchar *msg; | |
1230 gchar *tmp; | |
1231 | |
1232 from = g_strdup_printf("%lu", (unsigned long int)ev->event.msg.sender); | |
1233 | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1234 tmp = charset_convert((const char *)ev->event.msg.message, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1235 "CP1250", "UTF-8"); |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1236 gaim_str_strip_char(tmp, '\r'); |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1237 msg = g_markup_escape_text(tmp, -1); |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1238 g_free(tmp); |
11414 | 1239 |
1240 gaim_debug_info("gg", "msg form (%s): %s (class = %d; rcpt_count = %d)\n", | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1241 from, msg, ev->event.msg.msgclass, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1242 ev->event.msg.recipients_count); |
11414 | 1243 |
1244 if (ev->event.msg.recipients_count == 0) { | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1245 serv_got_im(gc, from, msg, 0, ev->event.msg.time); |
11414 | 1246 } else { |
12373
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1247 const char *chat_name; |
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1248 int chat_id; |
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1249 char *buddy_name; |
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1250 |
11414 | 1251 chat_name = ggp_confer_find_by_participants(gc, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1252 ev->event.msg.recipients, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1253 ev->event.msg.recipients_count); |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1254 |
11414 | 1255 if (chat_name == NULL) { |
1256 chat_name = ggp_confer_add_new(gc, NULL); | |
1257 serv_got_joined_chat(gc, info->chats_count, chat_name); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1258 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1259 ggp_confer_participants_add_uin(gc, chat_name, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1260 ev->event.msg.sender); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1261 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1262 ggp_confer_participants_add(gc, chat_name, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1263 ev->event.msg.recipients, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1264 ev->event.msg.recipients_count); |
11414 | 1265 } |
1266 conv = ggp_confer_find_by_name(gc, chat_name); | |
1267 chat_id = gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)); | |
12373
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1268 |
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1269 buddy_name = ggp_buddy_get_name(gc, ev->event.msg.sender); |
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1270 serv_got_chat_in(gc, chat_id, buddy_name, |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1271 GAIM_MESSAGE_RECV, msg, ev->event.msg.time); |
12373
508512caa22e
[gaim-migrate @ 14677]
Richard Laager <rlaager@wiktel.com>
parents:
12277
diff
changeset
|
1272 g_free(buddy_name); |
11414 | 1273 } |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1274 g_free(msg); |
11414 | 1275 g_free(from); |
1276 } | |
1277 /* }}} */ | |
1278 | |
1279 /* | |
1280 */ | |
1281 /* static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ | |
1282 static void ggp_callback_recv(gpointer _gc, gint fd, GaimInputCondition cond) | |
1283 { | |
1284 GaimConnection *gc = _gc; | |
1285 GGPInfo *info = gc->proto_data; | |
1286 struct gg_event *ev; | |
1287 int i; | |
1288 | |
1289 if (!(ev = gg_watch_fd(info->session))) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1290 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1291 "ggp_callback_recv: gg_watch_fd failed -- CRITICAL!\n"); |
11414 | 1292 gaim_connection_error(gc, _("Unable to read socket")); |
1293 return; | |
1294 } | |
1295 | |
1296 switch (ev->type) { | |
1297 case GG_EVENT_NONE: | |
1298 /* Nothing happened. */ | |
1299 break; | |
1300 case GG_EVENT_MSG: | |
1301 ggp_recv_message_handler(gc, ev); | |
1302 break; | |
1303 case GG_EVENT_ACK: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1304 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1305 "message sent to: %ld, delivery status=%d, seq=%d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1306 ev->event.ack.recipient, ev->event.ack.status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1307 ev->event.ack.seq); |
11414 | 1308 break; |
1309 case GG_EVENT_NOTIFY: | |
1310 case GG_EVENT_NOTIFY_DESCR: | |
1311 { | |
1312 struct gg_notify_reply *n; | |
1313 char *descr; | |
1314 | |
1315 gaim_debug_info("gg", "notify_pre: (%d) status: %d\n", | |
1316 ev->event.notify->uin, | |
1317 ev->event.notify->status); | |
1318 | |
1319 n = (ev->type == GG_EVENT_NOTIFY) ? ev->event.notify | |
1320 : ev->event.notify_descr.notify; | |
1321 | |
1322 for (; n->uin; n++) { | |
1323 descr = (ev->type == GG_EVENT_NOTIFY) ? NULL | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1324 : ev->event.notify_descr.descr; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1325 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1326 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1327 "notify: (%d) status: %d; descr: %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1328 n->uin, n->status, descr); |
11414 | 1329 |
1330 ggp_generic_status_handler(gc, | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1331 n->uin, n->status, descr); |
11414 | 1332 } |
1333 } | |
1334 break; | |
1335 case GG_EVENT_NOTIFY60: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1336 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1337 "notify60_pre: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1338 ev->event.notify60->uin, ev->event.notify60->status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1339 ev->event.notify60->version, ev->event.notify60->descr); |
11414 | 1340 |
1341 for (i = 0; ev->event.notify60[i].uin; i++) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1342 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1343 "notify60: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1344 ev->event.notify60[i].uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1345 ev->event.notify60[i].status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1346 ev->event.notify60[i].version, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1347 ev->event.notify60[i].descr); |
11414 | 1348 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1349 ggp_generic_status_handler(gc, ev->event.notify60[i].uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1350 ev->event.notify60[i].status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1351 ev->event.notify60[i].descr); |
11414 | 1352 } |
1353 break; | |
1354 case GG_EVENT_STATUS: | |
1355 gaim_debug_info("gg", "status: (%d) status=%d; descr=%s\n", | |
1356 ev->event.status.uin, ev->event.status.status, | |
1357 ev->event.status.descr); | |
1358 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1359 ggp_generic_status_handler(gc, ev->event.status.uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1360 ev->event.status.status, ev->event.status.descr); |
11414 | 1361 break; |
1362 case GG_EVENT_STATUS60: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1363 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1364 "status60: (%d) status=%d; version=%d; descr=%s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1365 ev->event.status60.uin, ev->event.status60.status, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1366 ev->event.status60.version, ev->event.status60.descr); |
11414 | 1367 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1368 ggp_generic_status_handler(gc, ev->event.status60.uin, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1369 ev->event.status60.status, ev->event.status60.descr); |
11414 | 1370 break; |
1371 case GG_EVENT_USERLIST: | |
1372 if (ev->event.userlist.type == GG_USERLIST_GET_REPLY) { | |
1373 gaim_debug_info("gg", "GG_USERLIST_GET_REPLY\n"); | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1374 gaim_notify_info(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1375 _("Buddy list downloaded"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1376 _("Your buddy list was downloaded from the server.")); |
11414 | 1377 if (ev->event.userlist.reply != NULL) { |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1378 ggp_buddylist_load(gc, ev->event.userlist.reply); |
11414 | 1379 } |
1380 } else { | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1381 gaim_debug_info("gg", "GG_USERLIST_PUT_REPLY\n"); |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1382 gaim_notify_info(gc, NULL, |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1383 _("Buddy list uploaded"), |
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1384 _("Your buddy list was stored on the server.")); |
11414 | 1385 } |
1386 break; | |
1387 case GG_EVENT_PUBDIR50_SEARCH_REPLY: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1388 ggp_pubdir_reply_handler(gc, ev->event.pubdir50); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1389 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1390 default: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1391 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1392 "unsupported event type=%d\n", ev->type); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1393 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1394 } |
11414 | 1395 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1396 gg_free_event(ev); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1397 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1398 /* }}} */ |
11414 | 1399 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1400 /* |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1401 */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1402 /* static void ggp_async_login_handler(gpointer _gc, gint fd, GaimInputCondition cond) {{{ */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1403 static void ggp_async_login_handler(gpointer _gc, gint fd, GaimInputCondition cond) |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1404 { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1405 GaimConnection *gc = _gc; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1406 GGPInfo *info = gc->proto_data; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1407 struct gg_event *ev; |
11414 | 1408 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1409 gaim_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1410 info->session->check, info->session->state); |
11414 | 1411 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1412 switch (info->session->state) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1413 case GG_STATE_RESOLVING: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1414 gaim_debug_info("gg", "GG_STATE_RESOLVING\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1415 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1416 case GG_STATE_CONNECTING_HUB: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1417 gaim_debug_info("gg", "GG_STATE_CONNECTING_HUB\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1418 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1419 case GG_STATE_READING_DATA: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1420 gaim_debug_info("gg", "GG_STATE_READING_DATA\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1421 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1422 case GG_STATE_CONNECTING_GG: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1423 gaim_debug_info("gg", "GG_STATE_CONNECTING_GG\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1424 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1425 case GG_STATE_READING_KEY: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1426 gaim_debug_info("gg", "GG_STATE_READING_KEY\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1427 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1428 case GG_STATE_READING_REPLY: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1429 gaim_debug_info("gg", "GG_STATE_READING_REPLY\n"); |
11414 | 1430 break; |
1431 default: | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1432 gaim_debug_error("gg", "unknown state = %d\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1433 info->session->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1434 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1435 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1436 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1437 if (!(ev = gg_watch_fd(info->session))) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1438 gaim_debug_error("gg", "login_handler: gg_watch_fd failed!\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1439 gaim_connection_error(gc, _("Unable to read socket")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1440 return; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1441 } |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1442 gaim_debug_info("gg", "login_handler: session->fd = %d\n", info->session->fd); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1443 gaim_debug_info("gg", "login_handler: session: check = %d; state = %d;\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1444 info->session->check, info->session->state); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1445 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1446 gaim_input_remove(gc->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1447 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1448 /** XXX I think that this shouldn't be done if ev->type is GG_EVENT_CONN_FAILED or GG_EVENT_CONN_SUCCESS -datallah */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1449 gc->inpa = gaim_input_add(info->session->fd, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1450 (info->session->check == 1) ? GAIM_INPUT_WRITE |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1451 : GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1452 ggp_async_login_handler, gc); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1453 |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1454 switch (ev->type) { |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1455 case GG_EVENT_NONE: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1456 /* Nothing happened. */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1457 gaim_debug_info("gg", "GG_EVENT_NONE\n"); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1458 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1459 case GG_EVENT_CONN_SUCCESS: |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1460 { |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1461 GaimAccount *account; |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1462 GaimPresence *presence; |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1463 GaimStatus *status; |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1464 |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1465 gaim_debug_info("gg", "GG_EVENT_CONN_SUCCESS\n"); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1466 gaim_input_remove(gc->inpa); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1467 gc->inpa = gaim_input_add(info->session->fd, |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1468 GAIM_INPUT_READ, |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1469 ggp_callback_recv, gc); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1470 |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1471 /* gg_change_status(info->session, GG_STATUS_AVAIL); */ |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1472 |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1473 account = gaim_connection_get_account(gc); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1474 presence = gaim_account_get_presence(account); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1475 status = gaim_presence_get_active_status(presence); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1476 |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1477 ggp_set_status(account, status); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1478 gaim_connection_set_state(gc, GAIM_CONNECTED); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1479 ggp_buddylist_send(gc); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1480 } |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1481 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1482 case GG_EVENT_CONN_FAILED: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1483 gaim_input_remove(gc->inpa); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1484 gc->inpa = 0; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1485 gaim_connection_error(gc, _("Connection failed.")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1486 break; |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1487 default: |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1488 gaim_debug_error("gg", "strange event: %d\n", ev->type); |
11414 | 1489 break; |
1490 } | |
1491 | |
1492 gg_free_event(ev); | |
1493 } | |
1494 /* }}} */ | |
1495 | |
1496 /* ---------------------------------------------------------------------- */ | |
11360 | 1497 /* ----- GaimPluginProtocolInfo ----------------------------------------- */ |
1498 /* ---------------------------------------------------------------------- */ | |
1499 | |
1500 /* static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy) {{{ */ | |
1501 static const char *ggp_list_icon(GaimAccount *account, GaimBuddy *buddy) | |
1502 { | |
1503 return "gadu-gadu"; | |
1504 } | |
1505 /* }}} */ | |
1506 | |
1507 /* static void ggp_list_emblems(GaimBuddy *b, const char **se, const char **sw, const char **nw, const char **ne) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1508 static void ggp_list_emblems(GaimBuddy *b, const char **se, const char **sw, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1509 const char **nw, const char **ne) |
11360 | 1510 { |
1511 GaimPresence *presence = gaim_buddy_get_presence(b); | |
1512 | |
1513 /* | |
1514 * Note to myself: | |
1515 * The only valid status types are those defined | |
1516 * in prpl_info->status_types. | |
1517 * | |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1518 * Usable icons: away, blocked, dnd, extended_away, |
11360 | 1519 * freeforchat, ignored, invisible, na, offline. |
1520 */ | |
1521 | |
1522 if (!GAIM_BUDDY_IS_ONLINE(b)) { | |
1523 *se = "offline"; | |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1524 } else if (gaim_presence_is_status_primitive_active(presence, GAIM_STATUS_AWAY)) { |
11360 | 1525 *se = "away"; |
1526 } else if (gaim_presence_is_status_active(presence, "blocked")) { | |
1527 *se = "blocked"; | |
1528 } | |
2393 | 1529 } |
11360 | 1530 /* }}} */ |
2393 | 1531 |
11360 | 1532 /* static char *ggp_status_text(GaimBuddy *b) {{{ */ |
1533 static char *ggp_status_text(GaimBuddy *b) | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1534 { |
11360 | 1535 GaimStatus *status; |
1536 const char *msg; | |
1537 char *text; | |
1538 char *tmp; | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1539 |
11360 | 1540 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b)); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1541 |
11360 | 1542 msg = gaim_status_get_attr_string(status, "message"); |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1543 |
11360 | 1544 if (msg != NULL) { |
1545 tmp = gaim_markup_strip_html(msg); | |
1546 text = g_markup_escape_text(tmp, -1); | |
1547 g_free(tmp); | |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1548 |
11360 | 1549 return text; |
1550 } else { | |
1551 tmp = g_strdup(gaim_status_get_name(status)); | |
1552 text = g_markup_escape_text(tmp, -1); | |
1553 g_free(tmp); | |
1554 | |
1555 return text; | |
8997 | 1556 } |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1557 } |
11360 | 1558 /* }}} */ |
2846
4b3f17ca66bf
[gaim-migrate @ 2859]
Eric Warmenhoven <eric@warmenhoven.org>
parents:
2835
diff
changeset
|
1559 |
12970
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1560 /* static void ggp_tooltip_text(GaimBuddy *b, GString *str, gboolean full) {{{ */ |
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1561 static void ggp_tooltip_text(GaimBuddy *b, GString *str, gboolean full) |
11360 | 1562 { |
1563 GaimStatus *status; | |
1564 char *text; | |
1565 const char *msg, *name; | |
1566 | |
1567 status = gaim_presence_get_active_status(gaim_buddy_get_presence(b)); | |
1568 msg = gaim_status_get_attr_string(status, "message"); | |
1569 name = gaim_status_get_name(status); | |
1570 | |
1571 if (msg != NULL) { | |
13454
1b5bf4b215f0
[gaim-migrate @ 15829]
Richard Laager <rlaager@wiktel.com>
parents:
13317
diff
changeset
|
1572 text = g_markup_escape_text(msg, -1); |
12970
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1573 g_string_append_printf(str, "\n<b>%s:</b> %s: %s", |
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1574 _("Status"), name, text); |
11360 | 1575 g_free(text); |
1576 } else { | |
12970
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1577 g_string_append_printf(str, "\n<b>%s:</b> %s", |
ec9b92104904
[gaim-migrate @ 15323]
Richard Laager <rlaager@wiktel.com>
parents:
12964
diff
changeset
|
1578 _("Status"), name); |
11360 | 1579 } |
1580 } | |
1581 /* }}} */ | |
1582 | |
1583 /* static GList *ggp_status_types(GaimAccount *account) {{{ */ | |
1584 static GList *ggp_status_types(GaimAccount *account) | |
1585 { | |
1586 GaimStatusType *type; | |
1587 GList *types = NULL; | |
1588 | |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1589 type = gaim_status_type_new_with_attrs( |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1590 GAIM_STATUS_AVAILABLE, NULL, NULL, TRUE, TRUE, FALSE, |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1591 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1592 NULL); |
11360 | 1593 types = g_list_append(types, type); |
1594 | |
1595 /* | |
11638 | 1596 * Without this selecting Invisible as own status doesn't |
11360 | 1597 * work. It's not used and not needed to show status of buddies. |
1598 */ | |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1599 type = gaim_status_type_new_with_attrs( |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1600 GAIM_STATUS_INVISIBLE, NULL, NULL, TRUE, TRUE, FALSE, |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1601 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1602 NULL); |
11360 | 1603 types = g_list_append(types, type); |
1604 | |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1605 type = gaim_status_type_new_with_attrs( |
12718
b5fb60cb3bad
[gaim-migrate @ 15062]
Richard Laager <rlaager@wiktel.com>
parents:
12717
diff
changeset
|
1606 GAIM_STATUS_AWAY, NULL, NULL, TRUE, TRUE, FALSE, |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1607 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), |
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1608 NULL); |
11360 | 1609 types = g_list_append(types, type); |
1610 | |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1611 /* |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1612 * This status is necessary to display guys who are blocking *us*. |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1613 */ |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1614 type = gaim_status_type_new_with_attrs( |
12641
e0e8b0735c5a
[gaim-migrate @ 14977]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
1615 GAIM_STATUS_INVISIBLE, "blocked", _("Blocked"), TRUE, FALSE, FALSE, |
12595
3169cd6727ad
[gaim-migrate @ 14925]
Richard Laager <rlaager@wiktel.com>
parents:
12489
diff
changeset
|
1616 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), NULL); |
11360 | 1617 types = g_list_append(types, type); |
1618 | |
12658 | 1619 type = gaim_status_type_new_with_attrs( |
1620 GAIM_STATUS_OFFLINE, NULL, NULL, TRUE, TRUE, FALSE, | |
1621 "message", _("Message"), gaim_value_new(GAIM_TYPE_STRING), | |
1622 NULL); | |
1623 types = g_list_append(types, type); | |
1624 | |
11360 | 1625 return types; |
1626 } | |
1627 /* }}} */ | |
1628 | |
1629 /* static GList *ggp_blist_node_menu(GaimBlistNode *node) {{{ */ | |
1630 static GList *ggp_blist_node_menu(GaimBlistNode *node) | |
2393 | 1631 { |
12919
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1632 GaimMenuAction *act; |
2393 | 1633 GList *m = NULL; |
4333 | 1634 |
11360 | 1635 if (!GAIM_BLIST_NODE_IS_BUDDY(node)) |
1636 return NULL; | |
4333 | 1637 |
12919
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1638 act = gaim_menu_action_new(_("Add to chat"), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1639 GAIM_CALLBACK(ggp_bmenu_add_to_chat), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1640 NULL, NULL); |
11410 | 1641 m = g_list_append(m, act); |
1642 | |
12641
e0e8b0735c5a
[gaim-migrate @ 14977]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
1643 /* Using a blist node boolean here is also wrong. |
e0e8b0735c5a
[gaim-migrate @ 14977]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
1644 * Once the Block and Unblock actions are added to the core, |
e0e8b0735c5a
[gaim-migrate @ 14977]
Richard Laager <rlaager@wiktel.com>
parents:
12624
diff
changeset
|
1645 * this will have to go. -- rlaager */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1646 if (gaim_blist_node_get_bool(node, "blocked")) { |
12919
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1647 act = gaim_menu_action_new(_("Unblock"), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1648 GAIM_CALLBACK(ggp_bmenu_block), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1649 NULL, NULL); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1650 } else { |
12919
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1651 act = gaim_menu_action_new(_("Block"), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1652 GAIM_CALLBACK(ggp_bmenu_block), |
248b8b39c671
[gaim-migrate @ 15272]
Etan Reisner <pidgin@unreliablesource.net>
parents:
12736
diff
changeset
|
1653 NULL, NULL); |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1654 } |
11394 | 1655 m = g_list_append(m, act); |
2393 | 1656 |
1657 return m; | |
1658 } | |
11360 | 1659 /* }}} */ |
2393 | 1660 |
11394 | 1661 /* static GList *ggp_chat_info(GaimConnection *gc) {{{ */ |
1662 static GList *ggp_chat_info(GaimConnection *gc) | |
1663 { | |
1664 GList *m = NULL; | |
1665 struct proto_chat_entry *pce; | |
1666 | |
1667 pce = g_new0(struct proto_chat_entry, 1); | |
1668 pce->label = _("Chat _name:"); | |
1669 pce->identifier = "name"; | |
1670 pce->required = TRUE; | |
1671 m = g_list_append(m, pce); | |
1672 | |
1673 return m; | |
1674 } | |
1675 /* }}} */ | |
1676 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1677 /* static void ggp_login(GaimAccount *account) {{{ */ |
11837 | 1678 static void ggp_login(GaimAccount *account) |
2393 | 1679 { |
13514 | 1680 GaimConnection *gc; |
1681 struct gg_login_params *glp; | |
1682 GGPInfo *info; | |
1683 | |
1684 if (ggp_setup_proxy(account) == -1) | |
1685 return; | |
1686 | |
1687 gc = gaim_account_get_connection(account); | |
1688 glp = g_new0(struct gg_login_params, 1); | |
1689 info = g_new0(GGPInfo, 1); | |
11360 | 1690 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1691 /* Probably this should be moved to *_new() function. */ |
11360 | 1692 info->session = NULL; |
11394 | 1693 info->chats = NULL; |
1694 info->chats_count = 0; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1695 info->token = NULL; |
13640 | 1696 info->searches = ggp_search_new(); |
11360 | 1697 |
1698 gc->proto_data = info; | |
1699 | |
1700 glp->uin = ggp_get_uin(account); | |
1701 glp->password = (char *)gaim_account_get_password(account); | |
1702 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1703 glp->async = 1; |
11360 | 1704 glp->status = GG_STATUS_AVAIL; |
1705 glp->tls = 0; | |
1706 | |
1707 info->session = gg_login(glp); | |
1708 if (info->session == NULL) { | |
1709 gaim_connection_error(gc, _("Connection failed.")); | |
1710 g_free(glp); | |
1711 return; | |
1712 } | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1713 gc->inpa = gaim_input_add(info->session->fd, GAIM_INPUT_READ, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1714 ggp_async_login_handler, gc); |
11360 | 1715 } |
1716 /* }}} */ | |
1717 | |
1718 /* static void ggp_close(GaimConnection *gc) {{{ */ | |
1719 static void ggp_close(GaimConnection *gc) | |
1720 { | |
8997 | 1721 |
11360 | 1722 if (gc == NULL) { |
1723 gaim_debug_info("gg", "gc == NULL\n"); | |
1724 return; | |
1725 } | |
1726 | |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1727 if (gc->proto_data) { |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1728 GaimAccount *account = gaim_connection_get_account(gc); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1729 GaimStatus *status; |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1730 GGPInfo *info = gc->proto_data; |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1731 |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1732 status = gaim_account_get_active_status(account); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1733 |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1734 if (info->session != NULL) { |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1735 ggp_set_status(account, status); |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1736 gg_logoff(info->session); |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1737 gg_free_session(info->session); |
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1738 } |
13640 | 1739 |
1740 ggp_search_destroy(info->searches); | |
11545
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
1741 g_free(info); |
85abf1deac05
[gaim-migrate @ 13800]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11544
diff
changeset
|
1742 gc->proto_data = NULL; |
11538
5c6c2e893803
[gaim-migrate @ 13792]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11522
diff
changeset
|
1743 } |
11360 | 1744 |
1745 if (gc->inpa > 0) | |
1746 gaim_input_remove(gc->inpa); | |
1747 | |
1748 ggp_buddylist_offline(gc); | |
2393 | 1749 |
11360 | 1750 gaim_debug_info("gg", "Connection closed.\n"); |
1751 } | |
1752 /* }}} */ | |
1753 | |
12216 | 1754 /* static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, GaimMessageFlags flags) {{{ */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1755 static int ggp_send_im(GaimConnection *gc, const char *who, const char *msg, |
12216 | 1756 GaimMessageFlags flags) |
11360 | 1757 { |
1758 GGPInfo *info = gc->proto_data; | |
12216 | 1759 char *tmp, *plain; |
11360 | 1760 |
1761 if (strlen(msg) == 0) | |
1762 return 1; | |
1763 | |
12216 | 1764 plain = gaim_unescape_html(msg); |
11565 | 1765 gaim_debug_info("gg", "ggp_send_im: msg = %s\n", msg); |
12216 | 1766 tmp = charset_convert(plain, "UTF-8", "CP1250"); |
1767 g_free(plain); | |
2393 | 1768 |
11360 | 1769 if (tmp != NULL && strlen(tmp) > 0) { |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1770 if (gg_send_message(info->session, GG_CLASS_CHAT, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1771 ggp_str_to_uin(who), (unsigned char *)tmp) < 0) { |
11360 | 1772 return -1; |
1773 } | |
1774 } | |
11565 | 1775 g_free(tmp); |
11360 | 1776 |
1777 return 1; | |
1778 } | |
1779 /* }}} */ | |
1780 | |
1781 /* static void ggp_get_info(GaimConnection *gc, const char *name) { {{{ */ | |
1782 static void ggp_get_info(GaimConnection *gc, const char *name) | |
1783 { | |
1784 GGPInfo *info = gc->proto_data; | |
1785 GGPSearchForm *form; | |
13640 | 1786 guint32 seq; |
2393 | 1787 |
13640 | 1788 form = ggp_search_form_new(GGP_SEARCH_TYPE_INFO); |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
1789 |
13640 | 1790 form->user_data = info; |
11360 | 1791 form->uin = g_strdup(name); |
1792 form->offset = g_strdup("0"); | |
1793 form->last_uin = g_strdup("0"); | |
1794 | |
13640 | 1795 seq = ggp_search_start(gc, form); |
1796 ggp_search_add(info->searches, seq, form); | |
11360 | 1797 } |
1798 /* }}} */ | |
1799 | |
1800 /* static void ggp_set_status(GaimAccount *account, GaimStatus *status) {{{ */ | |
1801 static void ggp_set_status(GaimAccount *account, GaimStatus *status) | |
1802 { | |
1803 GaimConnection *gc; | |
1804 GGPInfo *info; | |
11397 | 1805 const char *status_id, *msg; |
11360 | 1806 int new_status, new_status_descr; |
1807 | |
1808 if (!gaim_status_is_active(status)) | |
1809 return; | |
1810 | |
1811 gc = gaim_account_get_connection(account); | |
1812 info = gc->proto_data; | |
1813 | |
1814 status_id = gaim_status_get_id(status); | |
1815 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1816 gaim_debug_info("gg", "ggp_set_status: Requested status = %s\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1817 status_id); |
2393 | 1818 |
11360 | 1819 if (strcmp(status_id, "available") == 0) { |
1820 new_status = GG_STATUS_AVAIL; | |
1821 new_status_descr = GG_STATUS_AVAIL_DESCR; | |
1822 } else if (strcmp(status_id, "away") == 0) { | |
1823 new_status = GG_STATUS_BUSY; | |
1824 new_status_descr = GG_STATUS_BUSY_DESCR; | |
1825 } else if (strcmp(status_id, "invisible") == 0) { | |
1826 new_status = GG_STATUS_INVISIBLE; | |
1827 new_status_descr = GG_STATUS_INVISIBLE_DESCR; | |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1828 } else if (strcmp(status_id, "offline") == 0) { |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1829 new_status = GG_STATUS_NOT_AVAIL; |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1830 new_status_descr = GG_STATUS_NOT_AVAIL_DESCR; |
11360 | 1831 } else { |
1832 new_status = GG_STATUS_AVAIL; | |
1833 new_status_descr = GG_STATUS_AVAIL_DESCR; | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1834 gaim_debug_info("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1835 "ggp_set_status: uknown status requested (status_id=%s)\n", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1836 status_id); |
11360 | 1837 } |
4916 | 1838 |
11397 | 1839 msg = gaim_status_get_attr_string(status, "message"); |
11360 | 1840 |
1841 if (msg == NULL) { | |
1842 gg_change_status(info->session, new_status); | |
1843 } else { | |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1844 gchar *tmp, *new_msg; |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1845 |
13454
1b5bf4b215f0
[gaim-migrate @ 15829]
Richard Laager <rlaager@wiktel.com>
parents:
13317
diff
changeset
|
1846 tmp = charset_convert(msg, "UTF-8", "CP1250"); |
1b5bf4b215f0
[gaim-migrate @ 15829]
Richard Laager <rlaager@wiktel.com>
parents:
13317
diff
changeset
|
1847 new_msg = gaim_markup_strip_html(tmp); |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1848 g_free(tmp); |
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1849 |
13454
1b5bf4b215f0
[gaim-migrate @ 15829]
Richard Laager <rlaager@wiktel.com>
parents:
13317
diff
changeset
|
1850 gg_change_status_descr(info->session, new_status_descr, new_msg); |
12964
c0f68043854a
[gaim-migrate @ 15317]
Richard Laager <rlaager@wiktel.com>
parents:
12961
diff
changeset
|
1851 g_free(new_msg); |
11360 | 1852 } |
1853 } | |
1854 /* }}} */ | |
1855 | |
1856 /* static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {{{ */ | |
1857 static void ggp_add_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) | |
1858 { | |
1859 GGPInfo *info = gc->proto_data; | |
1860 | |
1861 gg_add_notify(info->session, ggp_str_to_uin(buddy->name)); | |
1862 } | |
1863 /* }}} */ | |
1864 | |
1865 /* static void ggp_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, GaimGroup *group) {{{ */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1866 static void ggp_remove_buddy(GaimConnection *gc, GaimBuddy *buddy, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1867 GaimGroup *group) |
11360 | 1868 { |
1869 GGPInfo *info = gc->proto_data; | |
1870 | |
1871 gg_remove_notify(info->session, ggp_str_to_uin(buddy->name)); | |
1872 } | |
1873 /* }}} */ | |
1874 | |
11394 | 1875 /* static void ggp_join_chat(GaimConnection *gc, GHashTable *data) {{{ */ |
1876 static void ggp_join_chat(GaimConnection *gc, GHashTable *data) | |
1877 { | |
1878 GGPInfo *info = gc->proto_data; | |
1879 GGPChat *chat; | |
1880 char *chat_name; | |
1881 GList *l; | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1882 GaimConversation *conv; |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1883 GaimAccount *account = gaim_connection_get_account(gc); |
11394 | 1884 |
1885 chat_name = g_hash_table_lookup(data, "name"); | |
1886 | |
1887 if (chat_name == NULL) | |
1888 return; | |
1889 | |
1890 gaim_debug_info("gg", "joined %s chat\n", chat_name); | |
1891 | |
1892 for (l = info->chats; l != NULL; l = l->next) { | |
1893 chat = l->data; | |
1894 | |
1895 if (chat != NULL && g_utf8_collate(chat->name, chat_name) == 0) { | |
1896 gaim_notify_error(gc, _("Chat error"), | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1897 _("This chat name is already in use"), NULL); |
11394 | 1898 return; |
1899 } | |
1900 } | |
1901 | |
11414 | 1902 ggp_confer_add_new(gc, chat_name); |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1903 conv = serv_got_joined_chat(gc, info->chats_count, chat_name); |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1904 gaim_conv_chat_add_user(GAIM_CONV_CHAT(conv), |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1905 gaim_account_get_username(account), NULL, |
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1906 GAIM_CBFLAGS_NONE, TRUE); |
11394 | 1907 } |
1908 /* }}} */ | |
1909 | |
1910 /* static char *ggp_get_chat_name(GHashTable *data) { {{{ */ | |
1911 static char *ggp_get_chat_name(GHashTable *data) { | |
1912 return g_strdup(g_hash_table_lookup(data, "name")); | |
1913 } | |
1914 /* }}} */ | |
1915 | |
12216 | 1916 /* static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) {{{ */ |
1917 static int ggp_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) | |
11394 | 1918 { |
1919 GaimConversation *conv; | |
1920 GGPInfo *info = gc->proto_data; | |
1921 GGPChat *chat = NULL; | |
1922 GList *l; | |
12216 | 1923 char *msg, *plain; |
11394 | 1924 uin_t *uins; |
1925 int count = 0; | |
1926 | |
1927 if ((conv = gaim_find_chat(gc, id)) == NULL) | |
1928 return -EINVAL; | |
1929 | |
1930 for (l = info->chats; l != NULL; l = l->next) { | |
1931 chat = l->data; | |
1932 | |
1933 if (g_utf8_collate(chat->name, conv->name) == 0) { | |
1934 break; | |
1935 } | |
1936 | |
1937 chat = NULL; | |
1938 } | |
1939 | |
1940 if (chat == NULL) { | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1941 gaim_debug_error("gg", |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1942 "ggp_chat_send: Hm... that's strange. No such chat?\n"); |
11394 | 1943 return -EINVAL; |
1944 } | |
1945 | |
1946 uins = g_new0(uin_t, g_list_length(chat->participants)); | |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1947 |
11394 | 1948 for (l = chat->participants; l != NULL; l = l->next) { |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1949 uin_t uin = GPOINTER_TO_INT(l->data); |
11394 | 1950 |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1951 uins[count++] = uin; |
11394 | 1952 } |
1953 | |
12216 | 1954 plain = gaim_unescape_html(message); |
1955 msg = charset_convert(plain, "UTF-8", "CP1250"); | |
1956 g_free(plain); | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1957 gg_send_message_confer(info->session, GG_CLASS_CHAT, count, uins, |
12961
4eae108efdde
[gaim-migrate @ 15314]
Richard Laager <rlaager@wiktel.com>
parents:
12943
diff
changeset
|
1958 (unsigned char *)msg); |
11394 | 1959 g_free(msg); |
1960 g_free(uins); | |
1961 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1962 serv_got_chat_in(gc, id, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1963 gaim_account_get_username(gaim_connection_get_account(gc)), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1964 0, message, time(NULL)); |
11394 | 1965 |
1966 return 0; | |
1967 } | |
1968 /* }}} */ | |
1969 | |
11360 | 1970 /* static void ggp_keepalive(GaimConnection *gc) {{{ */ |
1971 static void ggp_keepalive(GaimConnection *gc) | |
1972 { | |
1973 GGPInfo *info = gc->proto_data; | |
1974 | |
1975 /* gaim_debug_info("gg", "Keeping connection alive....\n"); */ | |
1976 | |
1977 if (gg_ping(info->session) < 0) { | |
1978 gaim_debug_info("gg", "Not connected to the server " | |
1979 "or gg_session is not correct\n"); | |
1980 gaim_connection_error(gc, _("Not connected to the server.")); | |
4916 | 1981 } |
2393 | 1982 } |
11360 | 1983 /* }}} */ |
1984 | |
1985 /* static void ggp_register_user(GaimAccount *account) {{{ */ | |
1986 static void ggp_register_user(GaimAccount *account) | |
1987 { | |
11542
cda814bad7f8
[gaim-migrate @ 13797]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11541
diff
changeset
|
1988 GaimConnection *gc = gaim_account_get_connection(account); |
11360 | 1989 GGPInfo *info; |
1990 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1991 info = gc->proto_data = g_new0(GGPInfo, 1); |
11360 | 1992 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
1993 ggp_token_request(gc, ggp_register_user_dialog); |
2393 | 1994 } |
11360 | 1995 /* }}} */ |
2393 | 1996 |
11360 | 1997 /* static GList *ggp_actions(GaimPlugin *plugin, gpointer context) {{{ */ |
1998 static GList *ggp_actions(GaimPlugin *plugin, gpointer context) | |
8775 | 1999 { |
11360 | 2000 GList *m = NULL; |
2001 GaimPluginAction *act; | |
2002 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
2003 act = gaim_plugin_action_new(_("Find buddies..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2004 ggp_find_buddies); |
11360 | 2005 m = g_list_append(m, act); |
2006 | |
2007 m = g_list_append(m, NULL); | |
2008 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
2009 act = gaim_plugin_action_new(_("Change password..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2010 ggp_change_passwd); |
11360 | 2011 m = g_list_append(m, act); |
2012 | |
2013 m = g_list_append(m, NULL); | |
2014 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2015 act = gaim_plugin_action_new(_("Upload buddylist to Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2016 ggp_action_buddylist_put); |
11360 | 2017 m = g_list_append(m, act); |
8775 | 2018 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2019 act = gaim_plugin_action_new(_("Download buddylist from Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2020 ggp_action_buddylist_get); |
11360 | 2021 m = g_list_append(m, act); |
2022 | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2023 act = gaim_plugin_action_new(_("Delete buddylist from Server"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2024 ggp_action_buddylist_delete); |
11360 | 2025 m = g_list_append(m, act); |
2026 | |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
2027 act = gaim_plugin_action_new(_("Save buddylist to file..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2028 ggp_action_buddylist_save); |
11360 | 2029 m = g_list_append(m, act); |
8775 | 2030 |
12220
64254fbabc7b
[gaim-migrate @ 14522]
Richard Laager <rlaager@wiktel.com>
parents:
12216
diff
changeset
|
2031 act = gaim_plugin_action_new(_("Load buddylist from file..."), |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2032 ggp_action_buddylist_load); |
11360 | 2033 m = g_list_append(m, act); |
2034 | |
2035 return m; | |
8775 | 2036 } |
11360 | 2037 /* }}} */ |
8775 | 2038 |
13299
b2b26d2ac2ef
[gaim-migrate @ 15665]
Richard Laager <rlaager@wiktel.com>
parents:
13297
diff
changeset
|
2039 /* static gboolean ggp_offline_message(const GaimBuddy *buddy) {{{ */ |
b2b26d2ac2ef
[gaim-migrate @ 15665]
Richard Laager <rlaager@wiktel.com>
parents:
13297
diff
changeset
|
2040 static gboolean ggp_offline_message(const GaimBuddy *buddy) |
13297
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2041 { |
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2042 return TRUE; |
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2043 } |
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2044 /* }}} */ |
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2045 |
11360 | 2046 /* prpl_info setup {{{ */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2047 static GaimPluginProtocolInfo prpl_info = |
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2048 { |
11360 | 2049 OPT_PROTO_REGISTER_NOSCREENNAME, |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2050 NULL, /* user_splits */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2051 NULL, /* protocol_options */ |
9950 | 2052 NO_BUDDY_ICONS, /* icon_spec */ |
11360 | 2053 ggp_list_icon, /* list_icon */ |
2054 ggp_list_emblems, /* list_emblems */ | |
2055 ggp_status_text, /* status_text */ | |
2056 ggp_tooltip_text, /* tooltip_text */ | |
2057 ggp_status_types, /* status_types */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2058 ggp_blist_node_menu, /* blist_node_menu */ |
11394 | 2059 ggp_chat_info, /* chat_info */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2060 NULL, /* chat_info_defaults */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2061 ggp_login, /* login */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2062 ggp_close, /* close */ |
11360 | 2063 ggp_send_im, /* send_im */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2064 NULL, /* set_info */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2065 NULL, /* send_typing */ |
11360 | 2066 ggp_get_info, /* get_info */ |
2067 ggp_set_status, /* set_away */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2068 NULL, /* set_idle */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2069 NULL, /* change_passwd */ |
11360 | 2070 ggp_add_buddy, /* add_buddy */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2071 NULL, /* add_buddies */ |
11360 | 2072 ggp_remove_buddy, /* remove_buddy */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2073 NULL, /* remove_buddies */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2074 NULL, /* add_permit */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2075 NULL, /* add_deny */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2076 NULL, /* rem_permit */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2077 NULL, /* rem_deny */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2078 NULL, /* set_permit_deny */ |
11394 | 2079 ggp_join_chat, /* join_chat */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2080 NULL, /* reject_chat */ |
11394 | 2081 ggp_get_chat_name, /* get_chat_name */ |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2082 NULL, /* chat_invite */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2083 NULL, /* chat_leave */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2084 NULL, /* chat_whisper */ |
11394 | 2085 ggp_chat_send, /* chat_send */ |
11360 | 2086 ggp_keepalive, /* keepalive */ |
2087 ggp_register_user, /* register_user */ | |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2088 NULL, /* get_cb_info */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2089 NULL, /* get_cb_away */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2090 NULL, /* alias_buddy */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2091 NULL, /* group_buddy */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2092 NULL, /* rename_group */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2093 NULL, /* buddy_free */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2094 NULL, /* convo_closed */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2095 NULL, /* normalize */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2096 NULL, /* set_buddy_icon */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2097 NULL, /* remove_group */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2098 NULL, /* get_cb_real_name */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2099 NULL, /* set_chat_topic */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2100 NULL, /* find_blist_chat */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2101 NULL, /* roomlist_get_list */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2102 NULL, /* roomlist_cancel */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2103 NULL, /* roomlist_expand_category */ |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2104 NULL, /* can_receive_file */ |
12143
cbebda5f019c
[gaim-migrate @ 14444]
Richard Laager <rlaager@wiktel.com>
parents:
12007
diff
changeset
|
2105 NULL, /* send_file */ |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12595
diff
changeset
|
2106 NULL, /* new_xfer */ |
13297
ec4e72c12863
[gaim-migrate @ 15663]
Richard Laager <rlaager@wiktel.com>
parents:
13296
diff
changeset
|
2107 ggp_offline_message, /* offline_message */ |
12600
e856f985a0b9
[gaim-migrate @ 14934]
Richard Laager <rlaager@wiktel.com>
parents:
12595
diff
changeset
|
2108 NULL, /* whiteboard_prpl_ops */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2109 }; |
11360 | 2110 /* }}} */ |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2111 |
11360 | 2112 /* GaimPluginInfo setup {{{ */ |
2113 static GaimPluginInfo info = { | |
2114 GAIM_PLUGIN_MAGIC, /* magic */ | |
2115 GAIM_MAJOR_VERSION, /* major_version */ | |
2116 GAIM_MINOR_VERSION, /* minor_version */ | |
2117 GAIM_PLUGIN_PROTOCOL, /* plugin type */ | |
2118 NULL, /* ui_requirement */ | |
2119 0, /* flags */ | |
2120 NULL, /* dependencies */ | |
2121 GAIM_PRIORITY_DEFAULT, /* priority */ | |
2122 | |
2123 "prpl-gg", /* id */ | |
2124 "Gadu-Gadu", /* name */ | |
2125 VERSION, /* version */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2126 |
11360 | 2127 N_("Gadu-Gadu Protocol Plugin"), /* summary */ |
2128 N_("Polish popular IM"), /* description */ | |
2129 "boler@sourceforge.net", /* author */ | |
2130 GAIM_WEBSITE, /* homepage */ | |
2131 | |
2132 NULL, /* load */ | |
2133 NULL, /* unload */ | |
2134 NULL, /* destroy */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2135 |
11360 | 2136 NULL, /* ui_info */ |
2137 &prpl_info, /* extra_info */ | |
2138 NULL, /* prefs_info */ | |
2139 ggp_actions /* actions */ | |
2140 }; | |
2141 /* }}} */ | |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2142 |
11565 | 2143 /* static void gaim_gg_debug_handler(int level, const char * format, va_list args) {{{ */ |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2144 static void gaim_gg_debug_handler(int level, const char * format, va_list args) { |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2145 GaimDebugLevel gaim_level; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2146 char *msg = g_strdup_vprintf(format, args); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2147 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2148 /* This is pretty pointless since the GG_DEBUG levels don't correspond to |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2149 * the gaim ones */ |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2150 switch (level) { |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2151 case GG_DEBUG_FUNCTION: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2152 gaim_level = GAIM_DEBUG_INFO; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2153 break; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2154 case GG_DEBUG_MISC: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2155 case GG_DEBUG_NET: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2156 case GG_DEBUG_DUMP: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2157 case GG_DEBUG_TRAFFIC: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2158 default: |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2159 gaim_level = GAIM_DEBUG_MISC; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2160 break; |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2161 } |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2162 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2163 gaim_debug(gaim_level, "gg", msg); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2164 g_free(msg); |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2165 } |
11565 | 2166 /* }}} */ |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2167 |
11360 | 2168 /* |
2169 */ | |
2170 /* static void init_plugin(GaimPlugin *plugin) {{{ */ | |
2171 static void init_plugin(GaimPlugin *plugin) | |
2393 | 2172 { |
5638
0bdfa28c678e
[gaim-migrate @ 6047]
Christian Hammond <chipx86@chipx86.com>
parents:
5618
diff
changeset
|
2173 GaimAccountOption *option; |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2174 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2175 option = gaim_account_option_string_new(_("Nickname"), |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2176 "nick", _("Gadu-Gadu User")); |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2177 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, |
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2178 option); |
3572 | 2179 |
5205
fefad67de2c7
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5136
diff
changeset
|
2180 my_protocol = plugin; |
11541
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2181 |
5fc015909164
[gaim-migrate @ 13796]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11538
diff
changeset
|
2182 gg_debug_handler = gaim_gg_debug_handler; |
2393 | 2183 } |
11360 | 2184 /* }}} */ |
2393 | 2185 |
11909
1b029c5898af
[gaim-migrate @ 14200]
Richard Laager <rlaager@wiktel.com>
parents:
11837
diff
changeset
|
2186 GAIM_INIT_PLUGIN(gg, init_plugin, info); |
11360 | 2187 |
12007
8724718d387f
[gaim-migrate @ 14300]
Daniel Atallah <daniel.atallah@gmail.com>
parents:
11920
diff
changeset
|
2188 /* vim: set ts=8 sts=0 sw=8 noet: */ |