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