comparison libpurple/server.c @ 15822:32c366eeeb99

sed -ie 's/gaim/purple/g'
author Sean Egan <seanegan@gmail.com>
date Mon, 19 Mar 2007 07:01:17 +0000
parents 8e24d43f529a
children 4999bbc52881
comparison
equal deleted inserted replaced
15821:84b0f9b23ede 15822:32c366eeeb99
1 /* 1 /*
2 * gaim 2 * purple
3 * 3 *
4 * Gaim is the legal property of its developers, whose names are too numerous 4 * Purple is the legal property of its developers, whose names are too numerous
5 * to list here. Please refer to the COPYRIGHT file distributed with this 5 * to list here. Please refer to the COPYRIGHT file distributed with this
6 * source distribution. 6 * source distribution.
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify 8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by 9 * it under the terms of the GNU General Public License as published by
37 37
38 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600 38 #define SECS_BEFORE_RESENDING_AUTORESPONSE 600
39 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married" 39 #define SEX_BEFORE_RESENDING_AUTORESPONSE "Only after you're married"
40 40
41 unsigned int 41 unsigned int
42 serv_send_typing(GaimConnection *gc, const char *name, GaimTypingState state) 42 serv_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
43 { 43 {
44 GaimPluginProtocolInfo *prpl_info = NULL; 44 PurplePluginProtocolInfo *prpl_info = NULL;
45 45
46 if (gc != NULL && gc->prpl != NULL) 46 if (gc != NULL && gc->prpl != NULL)
47 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 47 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
48 48
49 if (prpl_info && prpl_info->send_typing) 49 if (prpl_info && prpl_info->send_typing)
50 return prpl_info->send_typing(gc, name, state); 50 return prpl_info->send_typing(gc, name, state);
51 51
52 return 0; 52 return 0;
53 } 53 }
54 54
55 static GSList *last_auto_responses = NULL; 55 static GSList *last_auto_responses = NULL;
56 struct last_auto_response { 56 struct last_auto_response {
57 GaimConnection *gc; 57 PurpleConnection *gc;
58 char name[80]; 58 char name[80];
59 time_t sent; 59 time_t sent;
60 }; 60 };
61 61
62 static gboolean 62 static gboolean
80 80
81 return FALSE; /* do not run again */ 81 return FALSE; /* do not run again */
82 } 82 }
83 83
84 static struct last_auto_response * 84 static struct last_auto_response *
85 get_last_auto_response(GaimConnection *gc, const char *name) 85 get_last_auto_response(PurpleConnection *gc, const char *name)
86 { 86 {
87 GSList *tmp; 87 GSList *tmp;
88 struct last_auto_response *lar; 88 struct last_auto_response *lar;
89 89
90 /* because we're modifying or creating a lar, schedule the 90 /* because we're modifying or creating a lar, schedule the
91 * function to expire them as the pref dictates */ 91 * function to expire them as the pref dictates */
92 gaim_timeout_add((SECS_BEFORE_RESENDING_AUTORESPONSE + 1) * 1000, expire_last_auto_responses, NULL); 92 purple_timeout_add((SECS_BEFORE_RESENDING_AUTORESPONSE + 1) * 1000, expire_last_auto_responses, NULL);
93 93
94 tmp = last_auto_responses; 94 tmp = last_auto_responses;
95 95
96 while (tmp) { 96 while (tmp) {
97 lar = (struct last_auto_response *)tmp->data; 97 lar = (struct last_auto_response *)tmp->data;
109 last_auto_responses = g_slist_prepend(last_auto_responses, lar); 109 last_auto_responses = g_slist_prepend(last_auto_responses, lar);
110 110
111 return lar; 111 return lar;
112 } 112 }
113 113
114 int serv_send_im(GaimConnection *gc, const char *name, const char *message, 114 int serv_send_im(PurpleConnection *gc, const char *name, const char *message,
115 GaimMessageFlags flags) 115 PurpleMessageFlags flags)
116 { 116 {
117 GaimConversation *conv; 117 PurpleConversation *conv;
118 GaimAccount *account; 118 PurpleAccount *account;
119 GaimPresence *presence; 119 PurplePresence *presence;
120 GaimPluginProtocolInfo *prpl_info; 120 PurplePluginProtocolInfo *prpl_info;
121 int val = -EINVAL; 121 int val = -EINVAL;
122 const gchar *auto_reply_pref; 122 const gchar *auto_reply_pref;
123 123
124 g_return_val_if_fail(gc != NULL, val); 124 g_return_val_if_fail(gc != NULL, val);
125 g_return_val_if_fail(gc->prpl != NULL, val); 125 g_return_val_if_fail(gc->prpl != NULL, val);
126 126
127 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 127 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
128 128
129 account = gaim_connection_get_account(gc); 129 account = purple_connection_get_account(gc);
130 presence = gaim_account_get_presence(account); 130 presence = purple_account_get_presence(account);
131 131
132 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); 132 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
133 133
134 if (prpl_info && prpl_info->send_im) 134 if (prpl_info && prpl_info->send_im)
135 val = prpl_info->send_im(gc, name, message, flags); 135 val = prpl_info->send_im(gc, name, message, flags);
136 136
137 /* 137 /*
138 * XXX - If "only auto-reply when away & idle" is set, then shouldn't 138 * XXX - If "only auto-reply when away & idle" is set, then shouldn't
139 * this only reset lar->sent if we're away AND idle? 139 * this only reset lar->sent if we're away AND idle?
140 */ 140 */
141 auto_reply_pref = gaim_prefs_get_string("/core/away/auto_reply"); 141 auto_reply_pref = purple_prefs_get_string("/core/away/auto_reply");
142 if ((gc->flags & GAIM_CONNECTION_AUTO_RESP) && 142 if ((gc->flags & PURPLE_CONNECTION_AUTO_RESP) &&
143 !gaim_presence_is_available(presence) && 143 !purple_presence_is_available(presence) &&
144 strcmp(auto_reply_pref, "never")) { 144 strcmp(auto_reply_pref, "never")) {
145 145
146 struct last_auto_response *lar; 146 struct last_auto_response *lar;
147 lar = get_last_auto_response(gc, name); 147 lar = get_last_auto_response(gc, name);
148 lar->sent = time(NULL); 148 lar->sent = time(NULL);
149 } 149 }
150 150
151 if (conv && gaim_conv_im_get_send_typed_timeout(GAIM_CONV_IM(conv))) 151 if (conv && purple_conv_im_get_send_typed_timeout(PURPLE_CONV_IM(conv)))
152 gaim_conv_im_stop_send_typed_timeout(GAIM_CONV_IM(conv)); 152 purple_conv_im_stop_send_typed_timeout(PURPLE_CONV_IM(conv));
153 153
154 return val; 154 return val;
155 } 155 }
156 156
157 void serv_get_info(GaimConnection *gc, const char *name) 157 void serv_get_info(PurpleConnection *gc, const char *name)
158 { 158 {
159 GaimPluginProtocolInfo *prpl_info = NULL; 159 PurplePluginProtocolInfo *prpl_info = NULL;
160 160
161 if (gc != NULL && gc->prpl != NULL) 161 if (gc != NULL && gc->prpl != NULL)
162 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 162 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
163 163
164 if (gc && prpl_info && prpl_info->get_info) 164 if (gc && prpl_info && prpl_info->get_info)
165 prpl_info->get_info(gc, name); 165 prpl_info->get_info(gc, name);
166 } 166 }
167 167
168 void serv_set_info(GaimConnection *gc, const char *info) 168 void serv_set_info(PurpleConnection *gc, const char *info)
169 { 169 {
170 GaimPluginProtocolInfo *prpl_info = NULL; 170 PurplePluginProtocolInfo *prpl_info = NULL;
171 GaimAccount *account; 171 PurpleAccount *account;
172 172
173 if (gc != NULL && gc->prpl != NULL) 173 if (gc != NULL && gc->prpl != NULL)
174 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 174 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
175 175
176 if (prpl_info && prpl_info->set_info) { 176 if (prpl_info && prpl_info->set_info) {
177 177
178 account = gaim_connection_get_account(gc); 178 account = purple_connection_get_account(gc);
179 179
180 if (gaim_signal_emit_return_1(gaim_accounts_get_handle(), 180 if (purple_signal_emit_return_1(purple_accounts_get_handle(),
181 "account-setting-info", account, info)) 181 "account-setting-info", account, info))
182 return; 182 return;
183 183
184 prpl_info->set_info(gc, info); 184 prpl_info->set_info(gc, info);
185 185
186 gaim_signal_emit(gaim_accounts_get_handle(), 186 purple_signal_emit(purple_accounts_get_handle(),
187 "account-set-info", account, info); 187 "account-set-info", account, info);
188 } 188 }
189 } 189 }
190 190
191 /* 191 /*
192 * Set buddy's alias on server roster/list 192 * Set buddy's alias on server roster/list
193 */ 193 */
194 void serv_alias_buddy(GaimBuddy *b) 194 void serv_alias_buddy(PurpleBuddy *b)
195 { 195 {
196 GaimPluginProtocolInfo *prpl_info = NULL; 196 PurplePluginProtocolInfo *prpl_info = NULL;
197 197
198 if (b != NULL && b->account->gc->prpl != NULL) 198 if (b != NULL && b->account->gc->prpl != NULL)
199 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); 199 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
200 200
201 if (b && prpl_info && prpl_info->alias_buddy) { 201 if (b && prpl_info && prpl_info->alias_buddy) {
202 prpl_info->alias_buddy(b->account->gc, b->name, b->alias); 202 prpl_info->alias_buddy(b->account->gc, b->name, b->alias);
203 } 203 }
204 } 204 }
205 205
206 void 206 void
207 serv_got_alias(GaimConnection *gc, const char *who, const char *alias) 207 serv_got_alias(PurpleConnection *gc, const char *who, const char *alias)
208 { 208 {
209 GaimAccount *account = gaim_connection_get_account(gc); 209 PurpleAccount *account = purple_connection_get_account(gc);
210 GSList *buds, *buddies = gaim_find_buddies(account, who); 210 GSList *buds, *buddies = purple_find_buddies(account, who);
211 GaimBuddy *b; 211 PurpleBuddy *b;
212 GaimConversation *conv; 212 PurpleConversation *conv;
213 213
214 for (buds = buddies; buds; buds = buds->next) 214 for (buds = buddies; buds; buds = buds->next)
215 { 215 {
216 b = buds->data; 216 b = buds->data;
217 if ((b->server_alias == NULL && alias == NULL) || 217 if ((b->server_alias == NULL && alias == NULL) ||
218 (b->server_alias && alias && !strcmp(b->server_alias, alias))) 218 (b->server_alias && alias && !strcmp(b->server_alias, alias)))
219 { 219 {
220 continue; 220 continue;
221 } 221 }
222 gaim_blist_server_alias_buddy(b, alias); 222 purple_blist_server_alias_buddy(b, alias);
223 223
224 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, account); 224 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, account);
225 225
226 if (conv != NULL && alias != NULL && strcmp(alias, who)) 226 if (conv != NULL && alias != NULL && strcmp(alias, who))
227 { 227 {
228 char *tmp = g_strdup_printf(_("%s is now known as %s.\n"), 228 char *tmp = g_strdup_printf(_("%s is now known as %s.\n"),
229 who, alias); 229 who, alias);
230 230
231 gaim_conversation_write(conv, NULL, tmp, GAIM_MESSAGE_SYSTEM, 231 purple_conversation_write(conv, NULL, tmp, PURPLE_MESSAGE_SYSTEM,
232 time(NULL)); 232 time(NULL));
233 233
234 g_free(tmp); 234 g_free(tmp);
235 } 235 }
236 } 236 }
240 /* 240 /*
241 * Move a buddy from one group to another on server. 241 * Move a buddy from one group to another on server.
242 * 242 *
243 * Note: For now we'll not deal with changing gc's at the same time, but 243 * Note: For now we'll not deal with changing gc's at the same time, but
244 * it should be possible. Probably needs to be done, someday. Although, 244 * it should be possible. Probably needs to be done, someday. Although,
245 * the UI for that would be difficult, because groups are Gaim-wide. 245 * the UI for that would be difficult, because groups are Purple-wide.
246 */ 246 */
247 void serv_move_buddy(GaimBuddy *b, GaimGroup *og, GaimGroup *ng) 247 void serv_move_buddy(PurpleBuddy *b, PurpleGroup *og, PurpleGroup *ng)
248 { 248 {
249 GaimPluginProtocolInfo *prpl_info = NULL; 249 PurplePluginProtocolInfo *prpl_info = NULL;
250 250
251 g_return_if_fail(b != NULL); 251 g_return_if_fail(b != NULL);
252 g_return_if_fail(og != NULL); 252 g_return_if_fail(og != NULL);
253 g_return_if_fail(ng != NULL); 253 g_return_if_fail(ng != NULL);
254 254
255 if (b->account->gc != NULL && b->account->gc->prpl != NULL) 255 if (b->account->gc != NULL && b->account->gc->prpl != NULL)
256 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl); 256 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(b->account->gc->prpl);
257 257
258 if (b->account->gc && og && ng) { 258 if (b->account->gc && og && ng) {
259 if (prpl_info && prpl_info->group_buddy) { 259 if (prpl_info && prpl_info->group_buddy) {
260 prpl_info->group_buddy(b->account->gc, b->name, og->name, ng->name); 260 prpl_info->group_buddy(b->account->gc, b->name, og->name, ng->name);
261 } 261 }
262 } 262 }
263 } 263 }
264 264
265 void serv_add_permit(GaimConnection *g, const char *name) 265 void serv_add_permit(PurpleConnection *g, const char *name)
266 { 266 {
267 GaimPluginProtocolInfo *prpl_info = NULL; 267 PurplePluginProtocolInfo *prpl_info = NULL;
268 268
269 if (g != NULL && g->prpl != NULL) 269 if (g != NULL && g->prpl != NULL)
270 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 270 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
271 271
272 if (prpl_info && prpl_info->add_permit) 272 if (prpl_info && prpl_info->add_permit)
273 prpl_info->add_permit(g, name); 273 prpl_info->add_permit(g, name);
274 } 274 }
275 275
276 void serv_add_deny(GaimConnection *g, const char *name) 276 void serv_add_deny(PurpleConnection *g, const char *name)
277 { 277 {
278 GaimPluginProtocolInfo *prpl_info = NULL; 278 PurplePluginProtocolInfo *prpl_info = NULL;
279 279
280 if (g != NULL && g->prpl != NULL) 280 if (g != NULL && g->prpl != NULL)
281 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 281 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
282 282
283 if (prpl_info && prpl_info->add_deny) 283 if (prpl_info && prpl_info->add_deny)
284 prpl_info->add_deny(g, name); 284 prpl_info->add_deny(g, name);
285 } 285 }
286 286
287 void serv_rem_permit(GaimConnection *g, const char *name) 287 void serv_rem_permit(PurpleConnection *g, const char *name)
288 { 288 {
289 GaimPluginProtocolInfo *prpl_info = NULL; 289 PurplePluginProtocolInfo *prpl_info = NULL;
290 290
291 if (g != NULL && g->prpl != NULL) 291 if (g != NULL && g->prpl != NULL)
292 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 292 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
293 293
294 if (prpl_info && prpl_info->rem_permit) 294 if (prpl_info && prpl_info->rem_permit)
295 prpl_info->rem_permit(g, name); 295 prpl_info->rem_permit(g, name);
296 } 296 }
297 297
298 void serv_rem_deny(GaimConnection *g, const char *name) 298 void serv_rem_deny(PurpleConnection *g, const char *name)
299 { 299 {
300 GaimPluginProtocolInfo *prpl_info = NULL; 300 PurplePluginProtocolInfo *prpl_info = NULL;
301 301
302 if (g != NULL && g->prpl != NULL) 302 if (g != NULL && g->prpl != NULL)
303 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 303 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
304 304
305 if (prpl_info && prpl_info->rem_deny) 305 if (prpl_info && prpl_info->rem_deny)
306 prpl_info->rem_deny(g, name); 306 prpl_info->rem_deny(g, name);
307 } 307 }
308 308
309 void serv_set_permit_deny(GaimConnection *g) 309 void serv_set_permit_deny(PurpleConnection *g)
310 { 310 {
311 GaimPluginProtocolInfo *prpl_info = NULL; 311 PurplePluginProtocolInfo *prpl_info = NULL;
312 312
313 if (g != NULL && g->prpl != NULL) 313 if (g != NULL && g->prpl != NULL)
314 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 314 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
315 315
316 /* 316 /*
317 * this is called when either you import a buddy list, and make lots 317 * this is called when either you import a buddy list, and make lots
318 * of changes that way, or when the user toggles the permit/deny mode 318 * of changes that way, or when the user toggles the permit/deny mode
319 * in the prefs. In either case you should probably be resetting and 319 * in the prefs. In either case you should probably be resetting and
321 */ 321 */
322 if (prpl_info && prpl_info->set_permit_deny) 322 if (prpl_info && prpl_info->set_permit_deny)
323 prpl_info->set_permit_deny(g); 323 prpl_info->set_permit_deny(g);
324 } 324 }
325 325
326 void serv_join_chat(GaimConnection *g, GHashTable *data) 326 void serv_join_chat(PurpleConnection *g, GHashTable *data)
327 { 327 {
328 GaimPluginProtocolInfo *prpl_info = NULL; 328 PurplePluginProtocolInfo *prpl_info = NULL;
329 329
330 if (g != NULL && g->prpl != NULL) 330 if (g != NULL && g->prpl != NULL)
331 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 331 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
332 332
333 if (prpl_info && prpl_info->join_chat) 333 if (prpl_info && prpl_info->join_chat)
334 prpl_info->join_chat(g, data); 334 prpl_info->join_chat(g, data);
335 } 335 }
336 336
337 337
338 void serv_reject_chat(GaimConnection *g, GHashTable *data) 338 void serv_reject_chat(PurpleConnection *g, GHashTable *data)
339 { 339 {
340 GaimPluginProtocolInfo *prpl_info = NULL; 340 PurplePluginProtocolInfo *prpl_info = NULL;
341 341
342 if (g != NULL && g->prpl != NULL) 342 if (g != NULL && g->prpl != NULL)
343 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 343 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
344 344
345 if (prpl_info && prpl_info->reject_chat) 345 if (prpl_info && prpl_info->reject_chat)
346 prpl_info->reject_chat(g, data); 346 prpl_info->reject_chat(g, data);
347 } 347 }
348 348
349 void serv_chat_invite(GaimConnection *g, int id, const char *message, const char *name) 349 void serv_chat_invite(PurpleConnection *g, int id, const char *message, const char *name)
350 { 350 {
351 GaimPluginProtocolInfo *prpl_info = NULL; 351 PurplePluginProtocolInfo *prpl_info = NULL;
352 GaimConversation *conv; 352 PurpleConversation *conv;
353 char *buffy = message && *message ? g_strdup(message) : NULL; 353 char *buffy = message && *message ? g_strdup(message) : NULL;
354 354
355 conv = gaim_find_chat(g, id); 355 conv = purple_find_chat(g, id);
356 356
357 if (conv == NULL) 357 if (conv == NULL)
358 return; 358 return;
359 359
360 if (g != NULL && g->prpl != NULL) 360 if (g != NULL && g->prpl != NULL)
361 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 361 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
362 362
363 gaim_signal_emit(gaim_conversations_get_handle(), "chat-inviting-user", 363 purple_signal_emit(purple_conversations_get_handle(), "chat-inviting-user",
364 conv, name, &buffy); 364 conv, name, &buffy);
365 365
366 if (prpl_info && prpl_info->chat_invite) 366 if (prpl_info && prpl_info->chat_invite)
367 prpl_info->chat_invite(g, id, buffy, name); 367 prpl_info->chat_invite(g, id, buffy, name);
368 368
369 gaim_signal_emit(gaim_conversations_get_handle(), "chat-invited-user", 369 purple_signal_emit(purple_conversations_get_handle(), "chat-invited-user",
370 conv, name, buffy); 370 conv, name, buffy);
371 371
372 g_free(buffy); 372 g_free(buffy);
373 } 373 }
374 374
375 /* Ya know, nothing uses this except gaim_conversation_destroy(), 375 /* Ya know, nothing uses this except purple_conversation_destroy(),
376 * I think I'll just merge it into that later... 376 * I think I'll just merge it into that later...
377 * Then again, something might want to use this, from outside prpl-land 377 * Then again, something might want to use this, from outside prpl-land
378 * to leave a chat without destroying the conversation. 378 * to leave a chat without destroying the conversation.
379 */ 379 */
380 380
381 void serv_chat_leave(GaimConnection *g, int id) 381 void serv_chat_leave(PurpleConnection *g, int id)
382 { 382 {
383 GaimPluginProtocolInfo *prpl_info = NULL; 383 PurplePluginProtocolInfo *prpl_info = NULL;
384 384
385 if (g->prpl != NULL) 385 if (g->prpl != NULL)
386 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 386 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
387 387
388 if (prpl_info && prpl_info->chat_leave) 388 if (prpl_info && prpl_info->chat_leave)
389 prpl_info->chat_leave(g, id); 389 prpl_info->chat_leave(g, id);
390 } 390 }
391 391
392 void serv_chat_whisper(GaimConnection *g, int id, const char *who, const char *message) 392 void serv_chat_whisper(PurpleConnection *g, int id, const char *who, const char *message)
393 { 393 {
394 GaimPluginProtocolInfo *prpl_info = NULL; 394 PurplePluginProtocolInfo *prpl_info = NULL;
395 395
396 if (g != NULL && g->prpl != NULL) 396 if (g != NULL && g->prpl != NULL)
397 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(g->prpl); 397 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(g->prpl);
398 398
399 if (prpl_info && prpl_info->chat_whisper) 399 if (prpl_info && prpl_info->chat_whisper)
400 prpl_info->chat_whisper(g, id, who, message); 400 prpl_info->chat_whisper(g, id, who, message);
401 } 401 }
402 402
403 int serv_chat_send(GaimConnection *gc, int id, const char *message, GaimMessageFlags flags) 403 int serv_chat_send(PurpleConnection *gc, int id, const char *message, PurpleMessageFlags flags)
404 { 404 {
405 int val = -EINVAL; 405 int val = -EINVAL;
406 GaimPluginProtocolInfo *prpl_info = NULL; 406 PurplePluginProtocolInfo *prpl_info = NULL;
407 407
408 if (gc->prpl != NULL) 408 if (gc->prpl != NULL)
409 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 409 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
410 410
411 if (prpl_info && prpl_info->chat_send) 411 if (prpl_info && prpl_info->chat_send)
412 val = prpl_info->chat_send(gc, id, message, flags); 412 val = prpl_info->chat_send(gc, id, message, flags);
413 413
414 return val; 414 return val;
416 416
417 /* 417 /*
418 * woo. i'm actually going to comment this function. isn't that fun. make 418 * woo. i'm actually going to comment this function. isn't that fun. make
419 * sure to follow along, kids 419 * sure to follow along, kids
420 */ 420 */
421 void serv_got_im(GaimConnection *gc, const char *who, const char *msg, 421 void serv_got_im(PurpleConnection *gc, const char *who, const char *msg,
422 GaimMessageFlags flags, time_t mtime) 422 PurpleMessageFlags flags, time_t mtime)
423 { 423 {
424 GaimAccount *account; 424 PurpleAccount *account;
425 GaimConversation *cnv; 425 PurpleConversation *cnv;
426 char *message, *name; 426 char *message, *name;
427 char *angel, *buffy; 427 char *angel, *buffy;
428 int plugin_return; 428 int plugin_return;
429 429
430 g_return_if_fail(msg != NULL); 430 g_return_if_fail(msg != NULL);
431 431
432 account = gaim_connection_get_account(gc); 432 account = purple_connection_get_account(gc);
433 433
434 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { 434 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) {
435 /* protocol does not support privacy, handle it ourselves */ 435 /* protocol does not support privacy, handle it ourselves */
436 if (!gaim_privacy_check(account, who)) 436 if (!purple_privacy_check(account, who))
437 return; 437 return;
438 } 438 }
439 439
440 /* 440 /*
441 * We should update the conversation window buttons and menu, 441 * We should update the conversation window buttons and menu,
442 * if it exists. 442 * if it exists.
443 */ 443 */
444 cnv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, gc->account); 444 cnv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, gc->account);
445 445
446 /* 446 /*
447 * Plugin stuff. we pass a char ** but we don't want to pass what's 447 * Plugin stuff. we pass a char ** but we don't want to pass what's
448 * been given us by the prpls. So we create temp holders and pass 448 * been given us by the prpls. So we create temp holders and pass
449 * those instead. It's basically just to avoid segfaults. 449 * those instead. It's basically just to avoid segfaults.
452 buffy = g_malloc(MAX(strlen(msg) + 1, BUF_LONG)); 452 buffy = g_malloc(MAX(strlen(msg) + 1, BUF_LONG));
453 strcpy(buffy, msg); 453 strcpy(buffy, msg);
454 angel = g_strdup(who); 454 angel = g_strdup(who);
455 455
456 plugin_return = GPOINTER_TO_INT( 456 plugin_return = GPOINTER_TO_INT(
457 gaim_signal_emit_return_1(gaim_conversations_get_handle(), 457 purple_signal_emit_return_1(purple_conversations_get_handle(),
458 "receiving-im-msg", gc->account, 458 "receiving-im-msg", gc->account,
459 &angel, &buffy, cnv, &flags)); 459 &angel, &buffy, cnv, &flags));
460 460
461 if (!buffy || !angel || plugin_return) { 461 if (!buffy || !angel || plugin_return) {
462 g_free(buffy); 462 g_free(buffy);
465 } 465 }
466 466
467 name = angel; 467 name = angel;
468 message = buffy; 468 message = buffy;
469 469
470 gaim_signal_emit(gaim_conversations_get_handle(), "received-im-msg", gc->account, 470 purple_signal_emit(purple_conversations_get_handle(), "received-im-msg", gc->account,
471 name, message, cnv, flags); 471 name, message, cnv, flags);
472 472
473 /* search for conversation again in case it was created by received-im-msg handler */ 473 /* search for conversation again in case it was created by received-im-msg handler */
474 if (cnv == NULL) 474 if (cnv == NULL)
475 cnv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); 475 cnv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
476 476
477 /* 477 /*
478 * XXX: Should we be setting this here, or relying on prpls to set it? 478 * XXX: Should we be setting this here, or relying on prpls to set it?
479 */ 479 */
480 flags |= GAIM_MESSAGE_RECV; 480 flags |= PURPLE_MESSAGE_RECV;
481 481
482 if (cnv == NULL) 482 if (cnv == NULL)
483 cnv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); 483 cnv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name);
484 484
485 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, message, flags, mtime); 485 purple_conv_im_write(PURPLE_CONV_IM(cnv), NULL, message, flags, mtime);
486 g_free(message); 486 g_free(message);
487 487
488 /* 488 /*
489 * Don't autorespond if: 489 * Don't autorespond if:
490 * 490 *
492 * - we are available 492 * - we are available
493 * - or it's disabled 493 * - or it's disabled
494 * - or we're not idle and the 'only auto respond if idle' pref 494 * - or we're not idle and the 'only auto respond if idle' pref
495 * is set 495 * is set
496 */ 496 */
497 if (gc->flags & GAIM_CONNECTION_AUTO_RESP) 497 if (gc->flags & PURPLE_CONNECTION_AUTO_RESP)
498 { 498 {
499 GaimPresence *presence; 499 PurplePresence *presence;
500 GaimStatus *status; 500 PurpleStatus *status;
501 GaimStatusType *status_type; 501 PurpleStatusType *status_type;
502 GaimStatusPrimitive primitive; 502 PurpleStatusPrimitive primitive;
503 const gchar *auto_reply_pref; 503 const gchar *auto_reply_pref;
504 const char *away_msg = NULL; 504 const char *away_msg = NULL;
505 505
506 auto_reply_pref = gaim_prefs_get_string("/core/away/auto_reply"); 506 auto_reply_pref = purple_prefs_get_string("/core/away/auto_reply");
507 507
508 presence = gaim_account_get_presence(account); 508 presence = purple_account_get_presence(account);
509 status = gaim_presence_get_active_status(presence); 509 status = purple_presence_get_active_status(presence);
510 status_type = gaim_status_get_type(status); 510 status_type = purple_status_get_type(status);
511 primitive = gaim_status_type_get_primitive(status_type); 511 primitive = purple_status_type_get_primitive(status_type);
512 if ((primitive == GAIM_STATUS_AVAILABLE) || 512 if ((primitive == PURPLE_STATUS_AVAILABLE) ||
513 (primitive == GAIM_STATUS_INVISIBLE) || 513 (primitive == PURPLE_STATUS_INVISIBLE) ||
514 (primitive == GAIM_STATUS_MOBILE) || 514 (primitive == PURPLE_STATUS_MOBILE) ||
515 !strcmp(auto_reply_pref, "never") || 515 !strcmp(auto_reply_pref, "never") ||
516 (!gaim_presence_is_idle(presence) && !strcmp(auto_reply_pref, "awayidle"))) 516 (!purple_presence_is_idle(presence) && !strcmp(auto_reply_pref, "awayidle")))
517 { 517 {
518 g_free(name); 518 g_free(name);
519 return; 519 return;
520 } 520 }
521 521
522 away_msg = gaim_value_get_string( 522 away_msg = purple_value_get_string(
523 gaim_status_get_attr_value(status, "message")); 523 purple_status_get_attr_value(status, "message"));
524 524
525 if ((away_msg != NULL) && (*away_msg != '\0')) { 525 if ((away_msg != NULL) && (*away_msg != '\0')) {
526 struct last_auto_response *lar; 526 struct last_auto_response *lar;
527 time_t now = time(NULL); 527 time_t now = time(NULL);
528 528
543 * autoresponse. We do, however, not want to then send one in response to the 543 * autoresponse. We do, however, not want to then send one in response to the
544 * _next_ message, so we still set lar->sent to now. 544 * _next_ message, so we still set lar->sent to now.
545 */ 545 */
546 lar->sent = now; 546 lar->sent = now;
547 547
548 if (!(flags & GAIM_MESSAGE_AUTO_RESP)) 548 if (!(flags & PURPLE_MESSAGE_AUTO_RESP))
549 { 549 {
550 serv_send_im(gc, name, away_msg, GAIM_MESSAGE_AUTO_RESP); 550 serv_send_im(gc, name, away_msg, PURPLE_MESSAGE_AUTO_RESP);
551 551
552 gaim_conv_im_write(GAIM_CONV_IM(cnv), NULL, away_msg, 552 purple_conv_im_write(PURPLE_CONV_IM(cnv), NULL, away_msg,
553 GAIM_MESSAGE_SEND | GAIM_MESSAGE_AUTO_RESP, 553 PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_AUTO_RESP,
554 mtime); 554 mtime);
555 } 555 }
556 } 556 }
557 } 557 }
558 } 558 }
559 559
560 g_free(name); 560 g_free(name);
561 } 561 }
562 562
563 void serv_got_typing(GaimConnection *gc, const char *name, int timeout, 563 void serv_got_typing(PurpleConnection *gc, const char *name, int timeout,
564 GaimTypingState state) { 564 PurpleTypingState state) {
565 GaimConversation *conv; 565 PurpleConversation *conv;
566 GaimConvIm *im = NULL; 566 PurpleConvIm *im = NULL;
567 567
568 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); 568 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
569 if (conv != NULL) { 569 if (conv != NULL) {
570 im = GAIM_CONV_IM(conv); 570 im = PURPLE_CONV_IM(conv);
571 571
572 gaim_conv_im_set_typing_state(im, state); 572 purple_conv_im_set_typing_state(im, state);
573 gaim_conv_im_update_typing(im); 573 purple_conv_im_update_typing(im);
574 } else { 574 } else {
575 if (state == GAIM_TYPING) 575 if (state == PURPLE_TYPING)
576 { 576 {
577 gaim_signal_emit(gaim_conversations_get_handle(), 577 purple_signal_emit(purple_conversations_get_handle(),
578 "buddy-typing", gc->account, name); 578 "buddy-typing", gc->account, name);
579 } 579 }
580 else 580 else
581 { 581 {
582 gaim_signal_emit(gaim_conversations_get_handle(), 582 purple_signal_emit(purple_conversations_get_handle(),
583 "buddy-typed", gc->account, name); 583 "buddy-typed", gc->account, name);
584 } 584 }
585 } 585 }
586 586
587 if (conv != NULL && timeout > 0) 587 if (conv != NULL && timeout > 0)
588 gaim_conv_im_start_typing_timeout(im, timeout); 588 purple_conv_im_start_typing_timeout(im, timeout);
589 } 589 }
590 590
591 void serv_got_typing_stopped(GaimConnection *gc, const char *name) { 591 void serv_got_typing_stopped(PurpleConnection *gc, const char *name) {
592 592
593 GaimConversation *conv; 593 PurpleConversation *conv;
594 GaimConvIm *im; 594 PurpleConvIm *im;
595 595
596 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, name, gc->account); 596 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, name, gc->account);
597 if (conv != NULL) 597 if (conv != NULL)
598 { 598 {
599 im = GAIM_CONV_IM(conv); 599 im = PURPLE_CONV_IM(conv);
600 600
601 if (im->typing_state == GAIM_NOT_TYPING) 601 if (im->typing_state == PURPLE_NOT_TYPING)
602 return; 602 return;
603 603
604 gaim_conv_im_stop_typing_timeout(im); 604 purple_conv_im_stop_typing_timeout(im);
605 gaim_conv_im_set_typing_state(im, GAIM_NOT_TYPING); 605 purple_conv_im_set_typing_state(im, PURPLE_NOT_TYPING);
606 gaim_conv_im_update_typing(im); 606 purple_conv_im_update_typing(im);
607 } 607 }
608 else 608 else
609 { 609 {
610 gaim_signal_emit(gaim_conversations_get_handle(), 610 purple_signal_emit(purple_conversations_get_handle(),
611 "buddy-typing-stopped", gc->account, name); 611 "buddy-typing-stopped", gc->account, name);
612 } 612 }
613 } 613 }
614 614
615 struct chat_invite_data { 615 struct chat_invite_data {
616 GaimConnection *gc; 616 PurpleConnection *gc;
617 GHashTable *components; 617 GHashTable *components;
618 }; 618 };
619 619
620 static void chat_invite_data_free(struct chat_invite_data *cid) 620 static void chat_invite_data_free(struct chat_invite_data *cid)
621 { 621 {
638 chat_invite_data_free(cid); 638 chat_invite_data_free(cid);
639 } 639 }
640 640
641 641
642 642
643 void serv_got_chat_invite(GaimConnection *gc, const char *name, 643 void serv_got_chat_invite(PurpleConnection *gc, const char *name,
644 const char *who, const char *message, GHashTable *data) 644 const char *who, const char *message, GHashTable *data)
645 { 645 {
646 GaimAccount *account; 646 PurpleAccount *account;
647 char buf2[BUF_LONG]; 647 char buf2[BUF_LONG];
648 struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1); 648 struct chat_invite_data *cid = g_new0(struct chat_invite_data, 1);
649 int plugin_return; 649 int plugin_return;
650 650
651 account = gaim_connection_get_account(gc); 651 account = purple_connection_get_account(gc);
652 if (GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) { 652 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->set_permit_deny == NULL) {
653 /* protocol does not support privacy, handle it ourselves */ 653 /* protocol does not support privacy, handle it ourselves */
654 if (!gaim_privacy_check(account, who)) 654 if (!purple_privacy_check(account, who))
655 return; 655 return;
656 } 656 }
657 657
658 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( 658 plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1(
659 gaim_conversations_get_handle(), 659 purple_conversations_get_handle(),
660 "chat-invited", account, who, name, message, data)); 660 "chat-invited", account, who, name, message, data));
661 661
662 cid->gc = gc; 662 cid->gc = gc;
663 cid->components = data; 663 cid->components = data;
664 664
666 { 666 {
667 if (message != NULL) 667 if (message != NULL)
668 { 668 {
669 g_snprintf(buf2, sizeof(buf2), 669 g_snprintf(buf2, sizeof(buf2),
670 _("%s has invited %s to the chat room %s:\n%s"), 670 _("%s has invited %s to the chat room %s:\n%s"),
671 who, gaim_account_get_username(account), name, message); 671 who, purple_account_get_username(account), name, message);
672 } 672 }
673 else 673 else
674 g_snprintf(buf2, sizeof(buf2), 674 g_snprintf(buf2, sizeof(buf2),
675 _("%s has invited %s to the chat room %s\n"), 675 _("%s has invited %s to the chat room %s\n"),
676 who, gaim_account_get_username(account), name); 676 who, purple_account_get_username(account), name);
677 677
678 678
679 gaim_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2, 679 purple_request_accept_cancel(gc, NULL, _("Accept chat invitation?"), buf2,
680 GAIM_DEFAULT_ACTION_NONE, cid, 680 PURPLE_DEFAULT_ACTION_NONE, cid,
681 G_CALLBACK(chat_invite_accept), 681 G_CALLBACK(chat_invite_accept),
682 G_CALLBACK(chat_invite_reject)); 682 G_CALLBACK(chat_invite_reject));
683 } 683 }
684 else if (plugin_return > 0) 684 else if (plugin_return > 0)
685 chat_invite_accept(cid); 685 chat_invite_accept(cid);
686 else 686 else
687 chat_invite_reject(cid); 687 chat_invite_reject(cid);
688 } 688 }
689 689
690 GaimConversation *serv_got_joined_chat(GaimConnection *gc, 690 PurpleConversation *serv_got_joined_chat(PurpleConnection *gc,
691 int id, const char *name) 691 int id, const char *name)
692 { 692 {
693 GaimConversation *conv; 693 PurpleConversation *conv;
694 GaimConvChat *chat; 694 PurpleConvChat *chat;
695 GaimAccount *account; 695 PurpleAccount *account;
696 696
697 account = gaim_connection_get_account(gc); 697 account = purple_connection_get_account(gc);
698 698
699 conv = gaim_conversation_new(GAIM_CONV_TYPE_CHAT, account, name); 699 conv = purple_conversation_new(PURPLE_CONV_TYPE_CHAT, account, name);
700 chat = GAIM_CONV_CHAT(conv); 700 chat = PURPLE_CONV_CHAT(conv);
701 701
702 if (!g_slist_find(gc->buddy_chats, conv)) 702 if (!g_slist_find(gc->buddy_chats, conv))
703 gc->buddy_chats = g_slist_append(gc->buddy_chats, conv); 703 gc->buddy_chats = g_slist_append(gc->buddy_chats, conv);
704 704
705 gaim_conv_chat_set_id(chat, id); 705 purple_conv_chat_set_id(chat, id);
706 706
707 gaim_signal_emit(gaim_conversations_get_handle(), "chat-joined", conv); 707 purple_signal_emit(purple_conversations_get_handle(), "chat-joined", conv);
708 708
709 return conv; 709 return conv;
710 } 710 }
711 711
712 void serv_got_chat_left(GaimConnection *g, int id) 712 void serv_got_chat_left(PurpleConnection *g, int id)
713 { 713 {
714 GSList *bcs; 714 GSList *bcs;
715 GaimConversation *conv = NULL; 715 PurpleConversation *conv = NULL;
716 GaimConvChat *chat = NULL; 716 PurpleConvChat *chat = NULL;
717 717
718 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { 718 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
719 conv = (GaimConversation *)bcs->data; 719 conv = (PurpleConversation *)bcs->data;
720 720
721 chat = GAIM_CONV_CHAT(conv); 721 chat = PURPLE_CONV_CHAT(conv);
722 722
723 if (gaim_conv_chat_get_id(chat) == id) 723 if (purple_conv_chat_get_id(chat) == id)
724 break; 724 break;
725 725
726 conv = NULL; 726 conv = NULL;
727 } 727 }
728 728
729 if (!conv) 729 if (!conv)
730 return; 730 return;
731 731
732 gaim_debug(GAIM_DEBUG_INFO, "server", "Leaving room: %s\n", 732 purple_debug(PURPLE_DEBUG_INFO, "server", "Leaving room: %s\n",
733 gaim_conversation_get_name(conv)); 733 purple_conversation_get_name(conv));
734 734
735 g->buddy_chats = g_slist_remove(g->buddy_chats, conv); 735 g->buddy_chats = g_slist_remove(g->buddy_chats, conv);
736 736
737 gaim_conv_chat_left(GAIM_CONV_CHAT(conv)); 737 purple_conv_chat_left(PURPLE_CONV_CHAT(conv));
738 738
739 gaim_signal_emit(gaim_conversations_get_handle(), "chat-left", conv); 739 purple_signal_emit(purple_conversations_get_handle(), "chat-left", conv);
740 } 740 }
741 741
742 void serv_got_chat_in(GaimConnection *g, int id, const char *who, 742 void serv_got_chat_in(PurpleConnection *g, int id, const char *who,
743 GaimMessageFlags flags, const char *message, time_t mtime) 743 PurpleMessageFlags flags, const char *message, time_t mtime)
744 { 744 {
745 GSList *bcs; 745 GSList *bcs;
746 GaimConversation *conv = NULL; 746 PurpleConversation *conv = NULL;
747 GaimConvChat *chat = NULL; 747 PurpleConvChat *chat = NULL;
748 char *buffy, *angel; 748 char *buffy, *angel;
749 int plugin_return; 749 int plugin_return;
750 750
751 g_return_if_fail(who != NULL); 751 g_return_if_fail(who != NULL);
752 g_return_if_fail(message != NULL); 752 g_return_if_fail(message != NULL);
753 753
754 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) { 754 for (bcs = g->buddy_chats; bcs != NULL; bcs = bcs->next) {
755 conv = (GaimConversation *)bcs->data; 755 conv = (PurpleConversation *)bcs->data;
756 756
757 chat = GAIM_CONV_CHAT(conv); 757 chat = PURPLE_CONV_CHAT(conv);
758 758
759 if (gaim_conv_chat_get_id(chat) == id) 759 if (purple_conv_chat_get_id(chat) == id)
760 break; 760 break;
761 761
762 conv = NULL; 762 conv = NULL;
763 } 763 }
764 764
776 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG)); 776 buffy = g_malloc(MAX(strlen(message) + 1, BUF_LONG));
777 strcpy(buffy, message); 777 strcpy(buffy, message);
778 angel = g_strdup(who); 778 angel = g_strdup(who);
779 779
780 plugin_return = GPOINTER_TO_INT( 780 plugin_return = GPOINTER_TO_INT(
781 gaim_signal_emit_return_1(gaim_conversations_get_handle(), 781 purple_signal_emit_return_1(purple_conversations_get_handle(),
782 "receiving-chat-msg", g->account, 782 "receiving-chat-msg", g->account,
783 &angel, &buffy, conv, &flags)); 783 &angel, &buffy, conv, &flags));
784 784
785 if (!buffy || !angel || plugin_return) { 785 if (!buffy || !angel || plugin_return) {
786 g_free(buffy); 786 g_free(buffy);
788 return; 788 return;
789 } 789 }
790 who = angel; 790 who = angel;
791 message = buffy; 791 message = buffy;
792 792
793 gaim_signal_emit(gaim_conversations_get_handle(), "received-chat-msg", g->account, 793 purple_signal_emit(purple_conversations_get_handle(), "received-chat-msg", g->account,
794 who, message, conv, flags); 794 who, message, conv, flags);
795 795
796 gaim_conv_chat_write(chat, who, message, flags, mtime); 796 purple_conv_chat_write(chat, who, message, flags, mtime);
797 797
798 g_free(angel); 798 g_free(angel);
799 g_free(buffy); 799 g_free(buffy);
800 } 800 }
801 801
802 void serv_send_file(GaimConnection *gc, const char *who, const char *file) 802 void serv_send_file(PurpleConnection *gc, const char *who, const char *file)
803 { 803 {
804 GaimPluginProtocolInfo *prpl_info = NULL; 804 PurplePluginProtocolInfo *prpl_info = NULL;
805 805
806 if (gc != NULL && gc->prpl != NULL) 806 if (gc != NULL && gc->prpl != NULL)
807 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); 807 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
808 808
809 if (prpl_info && prpl_info->send_file) { 809 if (prpl_info && prpl_info->send_file) {
810 if (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)) { 810 if (!prpl_info->can_receive_file || prpl_info->can_receive_file(gc, who)) {
811 prpl_info->send_file(gc, who, file); 811 prpl_info->send_file(gc, who, file);
812 } 812 }