Mercurial > pidgin.yaz
comparison pidgin/gtkconv.c @ 15823:32c366eeeb99
sed -ie 's/gaim/purple/g'
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 19 Mar 2007 07:01:17 +0000 |
parents | 84b0f9b23ede |
children | 66dff3dfdea6 |
comparison
equal
deleted
inserted
replaced
15822:84b0f9b23ede | 15823:32c366eeeb99 |
---|---|
1 /** | 1 /** |
2 * @file gtkconv.c GTK+ Conversation API | 2 * @file gtkconv.c GTK+ Conversation API |
3 * @ingroup gtkui | 3 * @ingroup gtkui |
4 * | 4 * |
5 * gaim | 5 * purple |
6 * | 6 * |
7 * Gaim is the legal property of its developers, whose names are too numerous | 7 * Purple is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | 8 * to list here. Please refer to the COPYRIGHT file distributed with this |
9 * source distribution. | 9 * source distribution. |
10 * | 10 * |
11 * This program is free software; you can redistribute it and/or modify | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | 12 * it under the terms of the GNU General Public License as published by |
134 GtkWidget *window; | 134 GtkWidget *window; |
135 | 135 |
136 GtkWidget *entry; | 136 GtkWidget *entry; |
137 GtkWidget *message; | 137 GtkWidget *message; |
138 | 138 |
139 GaimConversation *conv; | 139 PurpleConversation *conv; |
140 | 140 |
141 } InviteBuddyInfo; | 141 } InviteBuddyInfo; |
142 | 142 |
143 static GtkWidget *invite_dialog = NULL; | 143 static GtkWidget *invite_dialog = NULL; |
144 static GtkWidget *warn_close_dialog = NULL; | 144 static GtkWidget *warn_close_dialog = NULL; |
160 static void generate_send_to_items(PidginWindow *win); | 160 static void generate_send_to_items(PidginWindow *win); |
161 | 161 |
162 /* Prototypes. <-- because Paco-Paco hates this comment. */ | 162 /* Prototypes. <-- because Paco-Paco hates this comment. */ |
163 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); | 163 static void got_typing_keypress(PidginConversation *gtkconv, gboolean first); |
164 static void gray_stuff_out(PidginConversation *gtkconv); | 164 static void gray_stuff_out(PidginConversation *gtkconv); |
165 static GList *generate_invite_user_names(GaimConnection *gc); | 165 static GList *generate_invite_user_names(PurpleConnection *gc); |
166 static void add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name); | 166 static void add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name); |
167 static gboolean tab_complete(GaimConversation *conv); | 167 static gboolean tab_complete(PurpleConversation *conv); |
168 static void pidgin_conv_updated(GaimConversation *conv, GaimConvUpdateType type); | 168 static void pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type); |
169 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); | 169 static void gtkconv_set_unseen(PidginConversation *gtkconv, PidginUnseenState state); |
170 static void update_typing_icon(PidginConversation *gtkconv); | 170 static void update_typing_icon(PidginConversation *gtkconv); |
171 static const char *item_factory_translate_func (const char *path, gpointer func_data); | 171 static const char *item_factory_translate_func (const char *path, gpointer func_data); |
172 gboolean pidgin_conv_has_focus(GaimConversation *conv); | 172 gboolean pidgin_conv_has_focus(PurpleConversation *conv); |
173 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); | 173 static void pidgin_conv_custom_smiley_allocated(GdkPixbufLoader *loader, gpointer user_data); |
174 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data); | 174 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data); |
175 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); | 175 static GdkColor* generate_nick_colors(guint *numcolors, GdkColor background); |
176 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); | 176 static gboolean color_is_visible(GdkColor foreground, GdkColor background, int color_contrast, int brightness_contrast); |
177 static void pidgin_conv_update_fields(GaimConversation *conv, PidginConvFields fields); | 177 static void pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields); |
178 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win); | 178 static void focus_out_from_menubar(GtkWidget *wid, PidginWindow *win); |
179 | 179 |
180 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) { | 180 static GdkColor *get_nick_color(PidginConversation *gtkconv, const char *name) { |
181 static GdkColor col; | 181 static GdkColor col; |
182 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); | 182 GtkStyle *style = gtk_widget_get_style(gtkconv->imhtml); |
203 static gint | 203 static gint |
204 close_conv_cb(GtkWidget *w, PidginConversation *gtkconv) | 204 close_conv_cb(GtkWidget *w, PidginConversation *gtkconv) |
205 { | 205 { |
206 GList *list = g_list_copy(gtkconv->convs); | 206 GList *list = g_list_copy(gtkconv->convs); |
207 | 207 |
208 g_list_foreach(list, (GFunc)gaim_conversation_destroy, NULL); | 208 g_list_foreach(list, (GFunc)purple_conversation_destroy, NULL); |
209 g_list_free(list); | 209 g_list_free(list); |
210 | 210 |
211 return TRUE; | 211 return TRUE; |
212 } | 212 } |
213 | 213 |
214 static gboolean | 214 static gboolean |
215 lbox_size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, gpointer data) | 215 lbox_size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, gpointer data) |
216 { | 216 { |
217 gaim_prefs_set_int("/gaim/gtk/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); | 217 purple_prefs_set_int("/purple/gtk/conversations/chat/userlist_width", allocation->width == 1 ? 0 : allocation->width); |
218 | 218 |
219 return FALSE; | 219 return FALSE; |
220 } | 220 } |
221 | 221 |
222 static gboolean | 222 static gboolean |
223 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) | 223 size_allocate_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) |
224 { | 224 { |
225 GaimConversation *conv = gtkconv->active_conv; | 225 PurpleConversation *conv = gtkconv->active_conv; |
226 | 226 |
227 if (!GTK_WIDGET_VISIBLE(w)) | 227 if (!GTK_WIDGET_VISIBLE(w)) |
228 return FALSE; | 228 return FALSE; |
229 | 229 |
230 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 230 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
238 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see | 238 * tab bar will fit, but then I don't want new windows taking up the entire screen. I check to see |
239 * if there is only one conversation in the window. This way we'll be setting new windows to the | 239 * if there is only one conversation in the window. This way we'll be setting new windows to the |
240 * size of the last resized new window. */ | 240 * size of the last resized new window. */ |
241 /* I think that the above justification is not the majority, and that the new tab resizing should | 241 /* I think that the above justification is not the majority, and that the new tab resizing should |
242 * negate it anyway. --luke */ | 242 * negate it anyway. --luke */ |
243 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 243 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
244 { | 244 { |
245 if (w == gtkconv->imhtml) { | 245 if (w == gtkconv->imhtml) { |
246 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_width", allocation->width); | 246 purple_prefs_set_int("/purple/gtk/conversations/im/default_width", allocation->width); |
247 gaim_prefs_set_int("/gaim/gtk/conversations/im/default_height", allocation->height); | 247 purple_prefs_set_int("/purple/gtk/conversations/im/default_height", allocation->height); |
248 } | 248 } |
249 if (w == gtkconv->lower_hbox) | 249 if (w == gtkconv->lower_hbox) |
250 gaim_prefs_set_int("/gaim/gtk/conversations/im/entry_height", allocation->height); | 250 purple_prefs_set_int("/purple/gtk/conversations/im/entry_height", allocation->height); |
251 } | 251 } |
252 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 252 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
253 { | 253 { |
254 if (w == gtkconv->imhtml) { | 254 if (w == gtkconv->imhtml) { |
255 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_width", allocation->width); | 255 purple_prefs_set_int("/purple/gtk/conversations/chat/default_width", allocation->width); |
256 gaim_prefs_set_int("/gaim/gtk/conversations/chat/default_height", allocation->height); | 256 purple_prefs_set_int("/purple/gtk/conversations/chat/default_height", allocation->height); |
257 } | 257 } |
258 if (w == gtkconv->lower_hbox) | 258 if (w == gtkconv->lower_hbox) |
259 gaim_prefs_set_int("/gaim/gtk/conversations/chat/entry_height", allocation->height); | 259 purple_prefs_set_int("/purple/gtk/conversations/chat/entry_height", allocation->height); |
260 } | 260 } |
261 | 261 |
262 return FALSE; | 262 return FALSE; |
263 } | 263 } |
264 | 264 |
265 static void | 265 static void |
266 default_formatize(PidginConversation *c) | 266 default_formatize(PidginConversation *c) |
267 { | 267 { |
268 GaimConversation *conv = c->active_conv; | 268 PurpleConversation *conv = c->active_conv; |
269 | 269 |
270 if (conv->features & GAIM_CONNECTION_HTML) | 270 if (conv->features & PURPLE_CONNECTION_HTML) |
271 { | 271 { |
272 char color[8]; | 272 char color[8]; |
273 GdkColor fg_color, bg_color; | 273 GdkColor fg_color, bg_color; |
274 | 274 |
275 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_bold") != GTK_IMHTML(c->entry)->edit.bold) | 275 if (purple_prefs_get_bool("/purple/gtk/conversations/send_bold") != GTK_IMHTML(c->entry)->edit.bold) |
276 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); | 276 gtk_imhtml_toggle_bold(GTK_IMHTML(c->entry)); |
277 | 277 |
278 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_italic") != GTK_IMHTML(c->entry)->edit.italic) | 278 if (purple_prefs_get_bool("/purple/gtk/conversations/send_italic") != GTK_IMHTML(c->entry)->edit.italic) |
279 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); | 279 gtk_imhtml_toggle_italic(GTK_IMHTML(c->entry)); |
280 | 280 |
281 if (gaim_prefs_get_bool("/gaim/gtk/conversations/send_underline") != GTK_IMHTML(c->entry)->edit.underline) | 281 if (purple_prefs_get_bool("/purple/gtk/conversations/send_underline") != GTK_IMHTML(c->entry)->edit.underline) |
282 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); | 282 gtk_imhtml_toggle_underline(GTK_IMHTML(c->entry)); |
283 | 283 |
284 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), | 284 gtk_imhtml_toggle_fontface(GTK_IMHTML(c->entry), |
285 gaim_prefs_get_string("/gaim/gtk/conversations/font_face")); | 285 purple_prefs_get_string("/purple/gtk/conversations/font_face")); |
286 | 286 |
287 if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE)) | 287 if (!(conv->features & PURPLE_CONNECTION_NO_FONTSIZE)) |
288 { | 288 { |
289 int size = gaim_prefs_get_int("/gaim/gtk/conversations/font_size"); | 289 int size = purple_prefs_get_int("/purple/gtk/conversations/font_size"); |
290 | 290 |
291 /* 3 is the default. */ | 291 /* 3 is the default. */ |
292 if (size != 3) | 292 if (size != 3) |
293 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), size); | 293 gtk_imhtml_font_set_size(GTK_IMHTML(c->entry), size); |
294 } | 294 } |
295 | 295 |
296 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), "") != 0) | 296 if(strcmp(purple_prefs_get_string("/purple/gtk/conversations/fgcolor"), "") != 0) |
297 { | 297 { |
298 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/fgcolor"), | 298 gdk_color_parse(purple_prefs_get_string("/purple/gtk/conversations/fgcolor"), |
299 &fg_color); | 299 &fg_color); |
300 g_snprintf(color, sizeof(color), "#%02x%02x%02x", | 300 g_snprintf(color, sizeof(color), "#%02x%02x%02x", |
301 fg_color.red / 256, | 301 fg_color.red / 256, |
302 fg_color.green / 256, | 302 fg_color.green / 256, |
303 fg_color.blue / 256); | 303 fg_color.blue / 256); |
304 } else | 304 } else |
305 strcpy(color, ""); | 305 strcpy(color, ""); |
306 | 306 |
307 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); | 307 gtk_imhtml_toggle_forecolor(GTK_IMHTML(c->entry), color); |
308 | 308 |
309 if(!(conv->features & GAIM_CONNECTION_NO_BGCOLOR) && | 309 if(!(conv->features & PURPLE_CONNECTION_NO_BGCOLOR) && |
310 strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), "") != 0) | 310 strcmp(purple_prefs_get_string("/purple/gtk/conversations/bgcolor"), "") != 0) |
311 { | 311 { |
312 gdk_color_parse(gaim_prefs_get_string("/gaim/gtk/conversations/bgcolor"), | 312 gdk_color_parse(purple_prefs_get_string("/purple/gtk/conversations/bgcolor"), |
313 &bg_color); | 313 &bg_color); |
314 g_snprintf(color, sizeof(color), "#%02x%02x%02x", | 314 g_snprintf(color, sizeof(color), "#%02x%02x%02x", |
315 bg_color.red / 256, | 315 bg_color.red / 256, |
316 bg_color.green / 256, | 316 bg_color.green / 256, |
317 bg_color.blue / 256); | 317 bg_color.blue / 256); |
318 } else | 318 } else |
319 strcpy(color, ""); | 319 strcpy(color, ""); |
320 | 320 |
321 gtk_imhtml_toggle_background(GTK_IMHTML(c->entry), color); | 321 gtk_imhtml_toggle_background(GTK_IMHTML(c->entry), color); |
322 | 322 |
323 if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO) | 323 if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO) |
324 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); | 324 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), TRUE); |
325 else | 325 else |
326 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); | 326 gtk_imhtml_set_whole_buffer_formatting_only(GTK_IMHTML(c->entry), FALSE); |
327 } | 327 } |
328 } | 328 } |
337 pidgin_get_cmd_prefix(void) | 337 pidgin_get_cmd_prefix(void) |
338 { | 338 { |
339 return "/"; | 339 return "/"; |
340 } | 340 } |
341 | 341 |
342 static GaimCmdRet | 342 static PurpleCmdRet |
343 say_command_cb(GaimConversation *conv, | 343 say_command_cb(PurpleConversation *conv, |
344 const char *cmd, char **args, char **error, void *data) | 344 const char *cmd, char **args, char **error, void *data) |
345 { | 345 { |
346 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 346 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
347 gaim_conv_im_send(GAIM_CONV_IM(conv), args[0]); | 347 purple_conv_im_send(PURPLE_CONV_IM(conv), args[0]); |
348 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 348 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
349 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), args[0]); | 349 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), args[0]); |
350 | 350 |
351 return GAIM_CMD_RET_OK; | 351 return PURPLE_CMD_RET_OK; |
352 } | 352 } |
353 | 353 |
354 static GaimCmdRet | 354 static PurpleCmdRet |
355 me_command_cb(GaimConversation *conv, | 355 me_command_cb(PurpleConversation *conv, |
356 const char *cmd, char **args, char **error, void *data) | 356 const char *cmd, char **args, char **error, void *data) |
357 { | 357 { |
358 char *tmp; | 358 char *tmp; |
359 | 359 |
360 tmp = g_strdup_printf("/me %s", args[0]); | 360 tmp = g_strdup_printf("/me %s", args[0]); |
361 | 361 |
362 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 362 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
363 gaim_conv_im_send(GAIM_CONV_IM(conv), tmp); | 363 purple_conv_im_send(PURPLE_CONV_IM(conv), tmp); |
364 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 364 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
365 gaim_conv_chat_send(GAIM_CONV_CHAT(conv), tmp); | 365 purple_conv_chat_send(PURPLE_CONV_CHAT(conv), tmp); |
366 | 366 |
367 g_free(tmp); | 367 g_free(tmp); |
368 return GAIM_CMD_RET_OK; | 368 return PURPLE_CMD_RET_OK; |
369 } | 369 } |
370 | 370 |
371 static GaimCmdRet | 371 static PurpleCmdRet |
372 debug_command_cb(GaimConversation *conv, | 372 debug_command_cb(PurpleConversation *conv, |
373 const char *cmd, char **args, char **error, void *data) | 373 const char *cmd, char **args, char **error, void *data) |
374 { | 374 { |
375 char *tmp, *markup; | 375 char *tmp, *markup; |
376 GaimCmdStatus status; | 376 PurpleCmdStatus status; |
377 | 377 |
378 if (!g_ascii_strcasecmp(args[0], "version")) { | 378 if (!g_ascii_strcasecmp(args[0], "version")) { |
379 tmp = g_strdup_printf("me is using " PIDGIN_NAME " v%s.", VERSION); | 379 tmp = g_strdup_printf("me is using " PIDGIN_NAME " v%s.", VERSION); |
380 markup = g_markup_escape_text(tmp, -1); | 380 markup = g_markup_escape_text(tmp, -1); |
381 | 381 |
382 status = gaim_cmd_do_command(conv, tmp, markup, error); | 382 status = purple_cmd_do_command(conv, tmp, markup, error); |
383 | 383 |
384 g_free(tmp); | 384 g_free(tmp); |
385 g_free(markup); | 385 g_free(markup); |
386 return status; | 386 return status; |
387 } else { | 387 } else { |
388 gaim_conversation_write(conv, NULL, _("Supported debug options are: version"), | 388 purple_conversation_write(conv, NULL, _("Supported debug options are: version"), |
389 GAIM_MESSAGE_NO_LOG|GAIM_MESSAGE_ERROR, time(NULL)); | 389 PURPLE_MESSAGE_NO_LOG|PURPLE_MESSAGE_ERROR, time(NULL)); |
390 return GAIM_CMD_STATUS_OK; | 390 return PURPLE_CMD_STATUS_OK; |
391 } | 391 } |
392 } | 392 } |
393 | 393 |
394 static GaimCmdRet | 394 static PurpleCmdRet |
395 clear_command_cb(GaimConversation *conv, | 395 clear_command_cb(PurpleConversation *conv, |
396 const char *cmd, char **args, char **error, void *data) | 396 const char *cmd, char **args, char **error, void *data) |
397 { | 397 { |
398 PidginConversation *gtkconv = NULL; | 398 PidginConversation *gtkconv = NULL; |
399 | 399 |
400 gtkconv = PIDGIN_CONVERSATION(conv); | 400 gtkconv = PIDGIN_CONVERSATION(conv); |
401 | 401 |
402 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); | 402 gtk_imhtml_clear(GTK_IMHTML(gtkconv->imhtml)); |
403 return GAIM_CMD_STATUS_OK; | 403 return PURPLE_CMD_STATUS_OK; |
404 } | 404 } |
405 | 405 |
406 static GaimCmdRet | 406 static PurpleCmdRet |
407 help_command_cb(GaimConversation *conv, | 407 help_command_cb(PurpleConversation *conv, |
408 const char *cmd, char **args, char **error, void *data) | 408 const char *cmd, char **args, char **error, void *data) |
409 { | 409 { |
410 GList *l, *text; | 410 GList *l, *text; |
411 GString *s; | 411 GString *s; |
412 | 412 |
413 if (args[0] != NULL) { | 413 if (args[0] != NULL) { |
414 s = g_string_new(""); | 414 s = g_string_new(""); |
415 text = gaim_cmd_help(conv, args[0]); | 415 text = purple_cmd_help(conv, args[0]); |
416 | 416 |
417 if (text) { | 417 if (text) { |
418 for (l = text; l; l = l->next) | 418 for (l = text; l; l = l->next) |
419 if (l->next) | 419 if (l->next) |
420 g_string_append_printf(s, "%s\n", (char *)l->data); | 420 g_string_append_printf(s, "%s\n", (char *)l->data); |
425 } | 425 } |
426 } else { | 426 } else { |
427 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" | 427 s = g_string_new(_("Use \"/help <command>\" for help on a specific command.\n" |
428 "The following commands are available in this context:\n")); | 428 "The following commands are available in this context:\n")); |
429 | 429 |
430 text = gaim_cmd_list(conv); | 430 text = purple_cmd_list(conv); |
431 for (l = text; l; l = l->next) | 431 for (l = text; l; l = l->next) |
432 if (l->next) | 432 if (l->next) |
433 g_string_append_printf(s, "%s, ", (char *)l->data); | 433 g_string_append_printf(s, "%s, ", (char *)l->data); |
434 else | 434 else |
435 g_string_append_printf(s, "%s.", (char *)l->data); | 435 g_string_append_printf(s, "%s.", (char *)l->data); |
436 g_list_free(text); | 436 g_list_free(text); |
437 } | 437 } |
438 | 438 |
439 gaim_conversation_write(conv, NULL, s->str, GAIM_MESSAGE_NO_LOG, time(NULL)); | 439 purple_conversation_write(conv, NULL, s->str, PURPLE_MESSAGE_NO_LOG, time(NULL)); |
440 g_string_free(s, TRUE); | 440 g_string_free(s, TRUE); |
441 | 441 |
442 return GAIM_CMD_STATUS_OK; | 442 return PURPLE_CMD_STATUS_OK; |
443 } | 443 } |
444 | 444 |
445 static void | 445 static void |
446 send_history_add(PidginConversation *gtkconv, const char *message) | 446 send_history_add(PidginConversation *gtkconv, const char *message) |
447 { | 447 { |
454 } | 454 } |
455 | 455 |
456 static void | 456 static void |
457 reset_default_size(PidginConversation *gtkconv) | 457 reset_default_size(PidginConversation *gtkconv) |
458 { | 458 { |
459 GaimConversation *conv = gtkconv->active_conv; | 459 PurpleConversation *conv = gtkconv->active_conv; |
460 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 460 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
461 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | 461 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
462 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); | 462 purple_prefs_get_int("/purple/gtk/conversations/chat/entry_height")); |
463 else | 463 else |
464 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | 464 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
465 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); | 465 purple_prefs_get_int("/purple/gtk/conversations/im/entry_height")); |
466 } | 466 } |
467 | 467 |
468 static gboolean | 468 static gboolean |
469 check_for_and_do_command(GaimConversation *conv) | 469 check_for_and_do_command(PurpleConversation *conv) |
470 { | 470 { |
471 PidginConversation *gtkconv; | 471 PidginConversation *gtkconv; |
472 char *cmd; | 472 char *cmd; |
473 const char *prefix; | 473 const char *prefix; |
474 GtkTextIter start; | 474 GtkTextIter start; |
479 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); | 479 cmd = gtk_imhtml_get_text(GTK_IMHTML(gtkconv->entry), NULL, NULL); |
480 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); | 480 gtk_text_buffer_get_start_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &start); |
481 | 481 |
482 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) | 482 if (cmd && (strncmp(cmd, prefix, strlen(prefix)) == 0) |
483 && !gtk_text_iter_get_child_anchor(&start)) { | 483 && !gtk_text_iter_get_child_anchor(&start)) { |
484 GaimCmdStatus status; | 484 PurpleCmdStatus status; |
485 char *error, *cmdline, *markup, *send_history; | 485 char *error, *cmdline, *markup, *send_history; |
486 GtkTextIter end; | 486 GtkTextIter end; |
487 | 487 |
488 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); | 488 send_history = gtk_imhtml_get_markup(GTK_IMHTML(gtkconv->entry)); |
489 send_history_add(gtkconv, send_history); | 489 send_history_add(gtkconv, send_history); |
492 cmdline = cmd + strlen(prefix); | 492 cmdline = cmd + strlen(prefix); |
493 | 493 |
494 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); | 494 gtk_text_iter_forward_chars(&start, g_utf8_strlen(prefix, -1)); |
495 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); | 495 gtk_text_buffer_get_end_iter(GTK_IMHTML(gtkconv->entry)->text_buffer, &end); |
496 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); | 496 markup = gtk_imhtml_get_markup_range(GTK_IMHTML(gtkconv->entry), &start, &end); |
497 status = gaim_cmd_do_command(conv, cmdline, markup, &error); | 497 status = purple_cmd_do_command(conv, cmdline, markup, &error); |
498 g_free(cmd); | 498 g_free(cmd); |
499 g_free(markup); | 499 g_free(markup); |
500 | 500 |
501 switch (status) { | 501 switch (status) { |
502 case GAIM_CMD_STATUS_OK: | 502 case PURPLE_CMD_STATUS_OK: |
503 return TRUE; | 503 return TRUE; |
504 case GAIM_CMD_STATUS_NOT_FOUND: | 504 case PURPLE_CMD_STATUS_NOT_FOUND: |
505 return FALSE; | 505 return FALSE; |
506 case GAIM_CMD_STATUS_WRONG_ARGS: | 506 case PURPLE_CMD_STATUS_WRONG_ARGS: |
507 gaim_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " | 507 purple_conversation_write(conv, "", _("Syntax Error: You typed the wrong number of arguments " |
508 "to that command."), | 508 "to that command."), |
509 GAIM_MESSAGE_NO_LOG, time(NULL)); | 509 PURPLE_MESSAGE_NO_LOG, time(NULL)); |
510 return TRUE; | 510 return TRUE; |
511 case GAIM_CMD_STATUS_FAILED: | 511 case PURPLE_CMD_STATUS_FAILED: |
512 gaim_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), | 512 purple_conversation_write(conv, "", error ? error : _("Your command failed for an unknown reason."), |
513 GAIM_MESSAGE_NO_LOG, time(NULL)); | 513 PURPLE_MESSAGE_NO_LOG, time(NULL)); |
514 g_free(error); | 514 g_free(error); |
515 return TRUE; | 515 return TRUE; |
516 case GAIM_CMD_STATUS_WRONG_TYPE: | 516 case PURPLE_CMD_STATUS_WRONG_TYPE: |
517 if(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 517 if(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
518 gaim_conversation_write(conv, "", _("That command only works in chats, not IMs."), | 518 purple_conversation_write(conv, "", _("That command only works in chats, not IMs."), |
519 GAIM_MESSAGE_NO_LOG, time(NULL)); | 519 PURPLE_MESSAGE_NO_LOG, time(NULL)); |
520 else | 520 else |
521 gaim_conversation_write(conv, "", _("That command only works in IMs, not chats."), | 521 purple_conversation_write(conv, "", _("That command only works in IMs, not chats."), |
522 GAIM_MESSAGE_NO_LOG, time(NULL)); | 522 PURPLE_MESSAGE_NO_LOG, time(NULL)); |
523 return TRUE; | 523 return TRUE; |
524 case GAIM_CMD_STATUS_WRONG_PRPL: | 524 case PURPLE_CMD_STATUS_WRONG_PRPL: |
525 gaim_conversation_write(conv, "", _("That command doesn't work on this protocol."), | 525 purple_conversation_write(conv, "", _("That command doesn't work on this protocol."), |
526 GAIM_MESSAGE_NO_LOG, time(NULL)); | 526 PURPLE_MESSAGE_NO_LOG, time(NULL)); |
527 return TRUE; | 527 return TRUE; |
528 } | 528 } |
529 } | 529 } |
530 | 530 |
531 g_free(cmd); | 531 g_free(cmd); |
533 } | 533 } |
534 | 534 |
535 static void | 535 static void |
536 send_cb(GtkWidget *widget, PidginConversation *gtkconv) | 536 send_cb(GtkWidget *widget, PidginConversation *gtkconv) |
537 { | 537 { |
538 GaimConversation *conv = gtkconv->active_conv; | 538 PurpleConversation *conv = gtkconv->active_conv; |
539 GaimAccount *account; | 539 PurpleAccount *account; |
540 GaimConnection *gc; | 540 PurpleConnection *gc; |
541 GaimMessageFlags flags = 0; | 541 PurpleMessageFlags flags = 0; |
542 char *buf, *clean; | 542 char *buf, *clean; |
543 | 543 |
544 account = gaim_conversation_get_account(conv); | 544 account = purple_conversation_get_account(conv); |
545 | 545 |
546 if (!gaim_account_is_connected(account)) | 546 if (!purple_account_is_connected(account)) |
547 return; | 547 return; |
548 | 548 |
549 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) && | 549 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && |
550 gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv))) | 550 purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv))) |
551 return; | 551 return; |
552 | 552 |
553 if (check_for_and_do_command(conv)) { | 553 if (check_for_and_do_command(conv)) { |
554 if (gtkconv->entry_growing) { | 554 if (gtkconv->entry_growing) { |
555 reset_default_size(gtkconv); | 555 reset_default_size(gtkconv); |
568 g_free(buf); | 568 g_free(buf); |
569 g_free(clean); | 569 g_free(clean); |
570 return; | 570 return; |
571 } | 571 } |
572 | 572 |
573 gaim_idle_touch(); | 573 purple_idle_touch(); |
574 | 574 |
575 /* XXX: is there a better way to tell if the message has images? */ | 575 /* XXX: is there a better way to tell if the message has images? */ |
576 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL) | 576 if (GTK_IMHTML(gtkconv->entry)->im_images != NULL) |
577 flags |= GAIM_MESSAGE_IMAGES; | 577 flags |= PURPLE_MESSAGE_IMAGES; |
578 | 578 |
579 gc = gaim_account_get_connection(account); | 579 gc = purple_account_get_connection(account); |
580 if (gc && (conv->features & GAIM_CONNECTION_NO_NEWLINES)) { | 580 if (gc && (conv->features & PURPLE_CONNECTION_NO_NEWLINES)) { |
581 char **bufs; | 581 char **bufs; |
582 int i; | 582 int i; |
583 | 583 |
584 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); | 584 bufs = gtk_imhtml_get_markup_lines(GTK_IMHTML(gtkconv->entry)); |
585 for (i = 0; bufs[i]; i++) { | 585 for (i = 0; bufs[i]; i++) { |
586 send_history_add(gtkconv, bufs[i]); | 586 send_history_add(gtkconv, bufs[i]); |
587 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 587 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
588 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), bufs[i], flags); | 588 purple_conv_im_send_with_flags(PURPLE_CONV_IM(conv), bufs[i], flags); |
589 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 589 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
590 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), bufs[i], flags); | 590 purple_conv_chat_send_with_flags(PURPLE_CONV_CHAT(conv), bufs[i], flags); |
591 } | 591 } |
592 | 592 |
593 g_strfreev(bufs); | 593 g_strfreev(bufs); |
594 | 594 |
595 } else { | 595 } else { |
596 send_history_add(gtkconv, buf); | 596 send_history_add(gtkconv, buf); |
597 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 597 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
598 gaim_conv_im_send_with_flags(GAIM_CONV_IM(conv), buf, flags); | 598 purple_conv_im_send_with_flags(PURPLE_CONV_IM(conv), buf, flags); |
599 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 599 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
600 gaim_conv_chat_send_with_flags(GAIM_CONV_CHAT(conv), buf, flags); | 600 purple_conv_chat_send_with_flags(PURPLE_CONV_CHAT(conv), buf, flags); |
601 } | 601 } |
602 | 602 |
603 g_free(clean); | 603 g_free(clean); |
604 g_free(buf); | 604 g_free(buf); |
605 | 605 |
612 } | 612 } |
613 | 613 |
614 static void | 614 static void |
615 add_remove_cb(GtkWidget *widget, PidginConversation *gtkconv) | 615 add_remove_cb(GtkWidget *widget, PidginConversation *gtkconv) |
616 { | 616 { |
617 GaimAccount *account; | 617 PurpleAccount *account; |
618 const char *name; | 618 const char *name; |
619 GaimConversation *conv = gtkconv->active_conv; | 619 PurpleConversation *conv = gtkconv->active_conv; |
620 | 620 |
621 account = gaim_conversation_get_account(conv); | 621 account = purple_conversation_get_account(conv); |
622 name = gaim_conversation_get_name(conv); | 622 name = purple_conversation_get_name(conv); |
623 | 623 |
624 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 624 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
625 GaimBuddy *b; | 625 PurpleBuddy *b; |
626 | 626 |
627 b = gaim_find_buddy(account, name); | 627 b = purple_find_buddy(account, name); |
628 if (b != NULL) | 628 if (b != NULL) |
629 pidgindialogs_remove_buddy(b); | 629 pidgindialogs_remove_buddy(b); |
630 else if (account != NULL && gaim_account_is_connected(account)) | 630 else if (account != NULL && purple_account_is_connected(account)) |
631 gaim_blist_request_add_buddy(account, (char *)name, NULL, NULL); | 631 purple_blist_request_add_buddy(account, (char *)name, NULL, NULL); |
632 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 632 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
633 GaimChat *c; | 633 PurpleChat *c; |
634 | 634 |
635 c = gaim_blist_find_chat(account, name); | 635 c = purple_blist_find_chat(account, name); |
636 if (c != NULL) | 636 if (c != NULL) |
637 pidgindialogs_remove_chat(c); | 637 pidgindialogs_remove_chat(c); |
638 else if (account != NULL && gaim_account_is_connected(account)) | 638 else if (account != NULL && purple_account_is_connected(account)) |
639 gaim_blist_request_add_chat(account, NULL, NULL, name); | 639 purple_blist_request_add_chat(account, NULL, NULL, name); |
640 } | 640 } |
641 | 641 |
642 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); | 642 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
643 } | 643 } |
644 | 644 |
645 static void chat_do_info(PidginConversation *gtkconv, const char *who) | 645 static void chat_do_info(PidginConversation *gtkconv, const char *who) |
646 { | 646 { |
647 GaimConversation *conv = gtkconv->active_conv; | 647 PurpleConversation *conv = gtkconv->active_conv; |
648 GaimPluginProtocolInfo *prpl_info = NULL; | 648 PurplePluginProtocolInfo *prpl_info = NULL; |
649 GaimConnection *gc; | 649 PurpleConnection *gc; |
650 | 650 |
651 if ((gc = gaim_conversation_get_gc(conv))) { | 651 if ((gc = purple_conversation_get_gc(conv))) { |
652 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 652 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
653 | 653 |
654 /* | 654 /* |
655 * If there are special needs for getting info on users in | 655 * If there are special needs for getting info on users in |
656 * buddy chat "rooms"... | 656 * buddy chat "rooms"... |
657 */ | 657 */ |
658 if (prpl_info->get_cb_info != NULL) | 658 if (prpl_info->get_cb_info != NULL) |
659 { | 659 { |
660 prpl_info->get_cb_info(gc, | 660 prpl_info->get_cb_info(gc, |
661 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | 661 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); |
662 } | 662 } |
663 else | 663 else |
664 prpl_info->get_info(gc, who); | 664 prpl_info->get_info(gc, who); |
665 } | 665 } |
666 } | 666 } |
667 | 667 |
668 | 668 |
669 static void | 669 static void |
670 info_cb(GtkWidget *widget, PidginConversation *gtkconv) | 670 info_cb(GtkWidget *widget, PidginConversation *gtkconv) |
671 { | 671 { |
672 GaimConversation *conv = gtkconv->active_conv; | 672 PurpleConversation *conv = gtkconv->active_conv; |
673 | 673 |
674 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 674 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
675 serv_get_info(gaim_conversation_get_gc(conv), | 675 serv_get_info(purple_conversation_get_gc(conv), |
676 gaim_conversation_get_name(conv)); | 676 purple_conversation_get_name(conv)); |
677 | 677 |
678 gtk_widget_grab_focus(gtkconv->entry); | 678 gtk_widget_grab_focus(gtkconv->entry); |
679 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 679 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
680 /* Get info of the person currently selected in the GtkTreeView */ | 680 /* Get info of the person currently selected in the GtkTreeView */ |
681 PidginChatPane *gtkchat; | 681 PidginChatPane *gtkchat; |
682 GtkTreeIter iter; | 682 GtkTreeIter iter; |
683 GtkTreeModel *model; | 683 GtkTreeModel *model; |
684 GtkTreeSelection *sel; | 684 GtkTreeSelection *sel; |
700 } | 700 } |
701 | 701 |
702 static void | 702 static void |
703 block_cb(GtkWidget *widget, PidginConversation *gtkconv) | 703 block_cb(GtkWidget *widget, PidginConversation *gtkconv) |
704 { | 704 { |
705 GaimConversation *conv = gtkconv->active_conv; | 705 PurpleConversation *conv = gtkconv->active_conv; |
706 GaimAccount *account; | 706 PurpleAccount *account; |
707 | 707 |
708 account = gaim_conversation_get_account(conv); | 708 account = purple_conversation_get_account(conv); |
709 | 709 |
710 if (account != NULL && gaim_account_is_connected(account)) | 710 if (account != NULL && purple_account_is_connected(account)) |
711 pidgin_request_add_block(account, gaim_conversation_get_name(conv)); | 711 pidgin_request_add_block(account, purple_conversation_get_name(conv)); |
712 | 712 |
713 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); | 713 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
714 } | 714 } |
715 | 715 |
716 static void | 716 static void |
717 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv) | 717 unblock_cb(GtkWidget *widget, PidginConversation *gtkconv) |
718 { | 718 { |
719 GaimConversation *conv = gtkconv->active_conv; | 719 PurpleConversation *conv = gtkconv->active_conv; |
720 GaimAccount *account; | 720 PurpleAccount *account; |
721 | 721 |
722 account = gaim_conversation_get_account(conv); | 722 account = purple_conversation_get_account(conv); |
723 | 723 |
724 if (account != NULL && gaim_account_is_connected(account)) | 724 if (account != NULL && purple_account_is_connected(account)) |
725 pidgin_request_add_permit(account, gaim_conversation_get_name(conv)); | 725 pidgin_request_add_permit(account, purple_conversation_get_name(conv)); |
726 | 726 |
727 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); | 727 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
728 } | 728 } |
729 | 729 |
730 static void | 730 static void |
740 message = gtk_entry_get_text(GTK_ENTRY(info->message)); | 740 message = gtk_entry_get_text(GTK_ENTRY(info->message)); |
741 | 741 |
742 if (!g_ascii_strcasecmp(buddy, "")) | 742 if (!g_ascii_strcasecmp(buddy, "")) |
743 return; | 743 return; |
744 | 744 |
745 serv_chat_invite(gaim_conversation_get_gc(info->conv), | 745 serv_chat_invite(purple_conversation_get_gc(info->conv), |
746 gaim_conv_chat_get_id(GAIM_CONV_CHAT(info->conv)), | 746 purple_conv_chat_get_id(PURPLE_CONV_CHAT(info->conv)), |
747 message, buddy); | 747 message, buddy); |
748 } | 748 } |
749 | 749 |
750 gtk_widget_destroy(invite_dialog); | 750 gtk_widget_destroy(invite_dialog); |
751 invite_dialog = NULL; | 751 invite_dialog = NULL; |
758 GtkSelectionData *sd, guint inf, guint t, gpointer data) | 758 GtkSelectionData *sd, guint inf, guint t, gpointer data) |
759 { | 759 { |
760 InviteBuddyInfo *info = (InviteBuddyInfo *)data; | 760 InviteBuddyInfo *info = (InviteBuddyInfo *)data; |
761 const char *convprotocol; | 761 const char *convprotocol; |
762 | 762 |
763 convprotocol = gaim_account_get_protocol_id(gaim_conversation_get_account(info->conv)); | 763 convprotocol = purple_account_get_protocol_id(purple_conversation_get_account(info->conv)); |
764 | 764 |
765 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | 765 if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) |
766 { | 766 { |
767 GaimBlistNode *node = NULL; | 767 PurpleBlistNode *node = NULL; |
768 GaimBuddy *buddy; | 768 PurpleBuddy *buddy; |
769 | 769 |
770 memcpy(&node, sd->data, sizeof(node)); | 770 memcpy(&node, sd->data, sizeof(node)); |
771 | 771 |
772 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | 772 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
773 buddy = gaim_contact_get_priority_buddy((GaimContact *)node); | 773 buddy = purple_contact_get_priority_buddy((PurpleContact *)node); |
774 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 774 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
775 buddy = (GaimBuddy *)node; | 775 buddy = (PurpleBuddy *)node; |
776 else | 776 else |
777 return; | 777 return; |
778 | 778 |
779 if (strcmp(convprotocol, gaim_account_get_protocol_id(buddy->account))) | 779 if (strcmp(convprotocol, purple_account_get_protocol_id(buddy->account))) |
780 { | 780 { |
781 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, | 781 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, |
782 _("That buddy is not on the same protocol as this " | 782 _("That buddy is not on the same protocol as this " |
783 "chat."), NULL); | 783 "chat."), NULL); |
784 } | 784 } |
785 else | 785 else |
786 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); | 786 gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(info->entry)->entry), buddy->name); |
789 } | 789 } |
790 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | 790 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
791 { | 791 { |
792 char *protocol = NULL; | 792 char *protocol = NULL; |
793 char *username = NULL; | 793 char *username = NULL; |
794 GaimAccount *account; | 794 PurpleAccount *account; |
795 | 795 |
796 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, | 796 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
797 &protocol, &username, NULL)) | 797 &protocol, &username, NULL)) |
798 { | 798 { |
799 if (account == NULL) | 799 if (account == NULL) |
800 { | 800 { |
801 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, | 801 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, |
802 _("You are not currently signed on with an account that " | 802 _("You are not currently signed on with an account that " |
803 "can invite that buddy."), NULL); | 803 "can invite that buddy."), NULL); |
804 } | 804 } |
805 else if (strcmp(convprotocol, gaim_account_get_protocol_id(account))) | 805 else if (strcmp(convprotocol, purple_account_get_protocol_id(account))) |
806 { | 806 { |
807 gaim_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, | 807 purple_notify_error(PIDGIN_CONVERSATION(info->conv), NULL, |
808 _("That buddy is not on the same protocol as this " | 808 _("That buddy is not on the same protocol as this " |
809 "chat."), NULL); | 809 "chat."), NULL); |
810 } | 810 } |
811 else | 811 else |
812 { | 812 { |
821 } | 821 } |
822 } | 822 } |
823 | 823 |
824 static const GtkTargetEntry dnd_targets[] = | 824 static const GtkTargetEntry dnd_targets[] = |
825 { | 825 { |
826 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, | 826 {"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, 0}, |
827 {"application/x-im-contact", 0, 1} | 827 {"application/x-im-contact", 0, 1} |
828 }; | 828 }; |
829 | 829 |
830 static void | 830 static void |
831 invite_cb(GtkWidget *widget, PidginConversation *gtkconv) | 831 invite_cb(GtkWidget *widget, PidginConversation *gtkconv) |
832 { | 832 { |
833 GaimConversation *conv = gtkconv->active_conv; | 833 PurpleConversation *conv = gtkconv->active_conv; |
834 InviteBuddyInfo *info = NULL; | 834 InviteBuddyInfo *info = NULL; |
835 | 835 |
836 if (invite_dialog == NULL) { | 836 if (invite_dialog == NULL) { |
837 GaimConnection *gc; | 837 PurpleConnection *gc; |
838 PidginWindow *gtkwin; | 838 PidginWindow *gtkwin; |
839 GtkWidget *label; | 839 GtkWidget *label; |
840 GtkWidget *vbox, *hbox; | 840 GtkWidget *vbox, *hbox; |
841 GtkWidget *table; | 841 GtkWidget *table; |
842 GtkWidget *img; | 842 GtkWidget *img; |
845 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); | 845 gtk_icon_size_from_name(PIDGIN_ICON_SIZE_TANGO_HUGE)); |
846 | 846 |
847 info = g_new0(InviteBuddyInfo, 1); | 847 info = g_new0(InviteBuddyInfo, 1); |
848 info->conv = conv; | 848 info->conv = conv; |
849 | 849 |
850 gc = gaim_conversation_get_gc(conv); | 850 gc = purple_conversation_get_gc(conv); |
851 gtkwin = pidgin_conv_get_window(gtkconv); | 851 gtkwin = pidgin_conv_get_window(gtkconv); |
852 | 852 |
853 /* Create the new dialog. */ | 853 /* Create the new dialog. */ |
854 invite_dialog = gtk_dialog_new_with_buttons( | 854 invite_dialog = gtk_dialog_new_with_buttons( |
855 _("Invite Buddy Into Chat Room"), | 855 _("Invite Buddy Into Chat Room"), |
972 } | 972 } |
973 | 973 |
974 static void | 974 static void |
975 savelog_writefile_cb(void *user_data, const char *filename) | 975 savelog_writefile_cb(void *user_data, const char *filename) |
976 { | 976 { |
977 GaimConversation *conv = (GaimConversation *)user_data; | 977 PurpleConversation *conv = (PurpleConversation *)user_data; |
978 FILE *fp; | 978 FILE *fp; |
979 const char *name; | 979 const char *name; |
980 gchar *text; | 980 gchar *text; |
981 | 981 |
982 if ((fp = g_fopen(filename, "w+")) == NULL) { | 982 if ((fp = g_fopen(filename, "w+")) == NULL) { |
983 gaim_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); | 983 purple_notify_error(PIDGIN_CONVERSATION(conv), NULL, _("Unable to open file."), NULL); |
984 return; | 984 return; |
985 } | 985 } |
986 | 986 |
987 name = gaim_conversation_get_name(conv); | 987 name = purple_conversation_get_name(conv); |
988 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); | 988 fprintf(fp, "<html>\n<head><title>%s</title></head>\n<body>", name); |
989 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); | 989 fprintf(fp, _("<h1>Conversation with %s</h1>\n"), name); |
990 | 990 |
991 text = gtk_imhtml_get_markup( | 991 text = gtk_imhtml_get_markup( |
992 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); | 992 GTK_IMHTML(PIDGIN_CONVERSATION(conv)->imhtml)); |
1003 */ | 1003 */ |
1004 static void | 1004 static void |
1005 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) | 1005 menu_save_as_cb(gpointer data, guint action, GtkWidget *widget) |
1006 { | 1006 { |
1007 PidginWindow *win = data; | 1007 PidginWindow *win = data; |
1008 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win); | 1008 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1009 gchar *buf; | 1009 gchar *buf; |
1010 | 1010 |
1011 buf = g_strdup_printf("%s.html", gaim_normalize(conv->account, conv->name)); | 1011 buf = g_strdup_printf("%s.html", purple_normalize(conv->account, conv->name)); |
1012 | 1012 |
1013 gaim_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"), | 1013 purple_request_file(PIDGIN_CONVERSATION(conv), _("Save Conversation"), |
1014 gaim_escape_filename(buf), | 1014 purple_escape_filename(buf), |
1015 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); | 1015 TRUE, G_CALLBACK(savelog_writefile_cb), NULL, conv); |
1016 | 1016 |
1017 g_free(buf); | 1017 g_free(buf); |
1018 } | 1018 } |
1019 | 1019 |
1020 static void | 1020 static void |
1021 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) | 1021 menu_view_log_cb(gpointer data, guint action, GtkWidget *widget) |
1022 { | 1022 { |
1023 PidginWindow *win = data; | 1023 PidginWindow *win = data; |
1024 GaimConversation *conv; | 1024 PurpleConversation *conv; |
1025 GaimLogType type; | 1025 PurpleLogType type; |
1026 PidginBuddyList *gtkblist; | 1026 PidginBuddyList *gtkblist; |
1027 GdkCursor *cursor; | 1027 GdkCursor *cursor; |
1028 const char *name; | 1028 const char *name; |
1029 GaimAccount *account; | 1029 PurpleAccount *account; |
1030 GSList *buddies; | 1030 GSList *buddies; |
1031 GSList *cur; | 1031 GSList *cur; |
1032 | 1032 |
1033 conv = pidgin_conv_window_get_active_conversation(win); | 1033 conv = pidgin_conv_window_get_active_conversation(win); |
1034 | 1034 |
1035 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 1035 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
1036 type = GAIM_LOG_IM; | 1036 type = PURPLE_LOG_IM; |
1037 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 1037 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
1038 type = GAIM_LOG_CHAT; | 1038 type = PURPLE_LOG_CHAT; |
1039 else | 1039 else |
1040 return; | 1040 return; |
1041 | 1041 |
1042 gtkblist = pidgin_blist_get_default_gtk_blist(); | 1042 gtkblist = pidgin_blist_get_default_gtk_blist(); |
1043 | 1043 |
1049 gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); | 1049 gdk_display_flush(gdk_drawable_get_display(GDK_DRAWABLE(widget->window))); |
1050 #else | 1050 #else |
1051 gdk_flush(); | 1051 gdk_flush(); |
1052 #endif | 1052 #endif |
1053 | 1053 |
1054 name = gaim_conversation_get_name(conv); | 1054 name = purple_conversation_get_name(conv); |
1055 account = gaim_conversation_get_account(conv); | 1055 account = purple_conversation_get_account(conv); |
1056 | 1056 |
1057 buddies = gaim_find_buddies(account, name); | 1057 buddies = purple_find_buddies(account, name); |
1058 for (cur = buddies; cur != NULL; cur = cur->next) | 1058 for (cur = buddies; cur != NULL; cur = cur->next) |
1059 { | 1059 { |
1060 GaimBlistNode *node = cur->data; | 1060 PurpleBlistNode *node = cur->data; |
1061 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) | 1061 if ((node != NULL) && ((node->prev != NULL) || (node->next != NULL))) |
1062 { | 1062 { |
1063 pidgin_log_show_contact((GaimContact *)node->parent); | 1063 pidgin_log_show_contact((PurpleContact *)node->parent); |
1064 g_slist_free(buddies); | 1064 g_slist_free(buddies); |
1065 gdk_window_set_cursor(gtkblist->window->window, NULL); | 1065 gdk_window_set_cursor(gtkblist->window->window, NULL); |
1066 gdk_window_set_cursor(win->window->window, NULL); | 1066 gdk_window_set_cursor(win->window->window, NULL); |
1067 return; | 1067 return; |
1068 } | 1068 } |
1077 | 1077 |
1078 static void | 1078 static void |
1079 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) | 1079 menu_clear_cb(gpointer data, guint action, GtkWidget *widget) |
1080 { | 1080 { |
1081 PidginWindow *win = data; | 1081 PidginWindow *win = data; |
1082 GaimConversation *conv; | 1082 PurpleConversation *conv; |
1083 PidginConversation *gtkconv; | 1083 PidginConversation *gtkconv; |
1084 | 1084 |
1085 conv = pidgin_conv_window_get_active_conversation(win); | 1085 conv = pidgin_conv_window_get_active_conversation(win); |
1086 gtkconv = PIDGIN_CONVERSATION(conv); | 1086 gtkconv = PIDGIN_CONVERSATION(conv); |
1087 | 1087 |
1093 GtkWidget *entry; | 1093 GtkWidget *entry; |
1094 }; | 1094 }; |
1095 | 1095 |
1096 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) | 1096 static void do_search_cb(GtkWidget *widget, gint resp, struct _search *s) |
1097 { | 1097 { |
1098 GaimConversation *conv; | 1098 PurpleConversation *conv; |
1099 PidginConversation *gtk_active_conv; | 1099 PidginConversation *gtk_active_conv; |
1100 GList *iter; | 1100 GList *iter; |
1101 | 1101 |
1102 conv = pidgin_conv_window_get_active_conversation(s->gtkwin); | 1102 conv = pidgin_conv_window_get_active_conversation(s->gtkwin); |
1103 gtk_active_conv = PIDGIN_CONVERSATION(conv); | 1103 gtk_active_conv = PIDGIN_CONVERSATION(conv); |
1200 | 1200 |
1201 static void | 1201 static void |
1202 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) | 1202 menu_send_file_cb(gpointer data, guint action, GtkWidget *widget) |
1203 { | 1203 { |
1204 PidginWindow *win = data; | 1204 PidginWindow *win = data; |
1205 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win); | 1205 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
1206 | 1206 |
1207 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 1207 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
1208 serv_send_file(gaim_conversation_get_gc(conv), gaim_conversation_get_name(conv), NULL); | 1208 serv_send_file(purple_conversation_get_gc(conv), purple_conversation_get_name(conv), NULL); |
1209 } | 1209 } |
1210 | 1210 |
1211 } | 1211 } |
1212 | 1212 |
1213 static void | 1213 static void |
1214 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) | 1214 menu_add_pounce_cb(gpointer data, guint action, GtkWidget *widget) |
1215 { | 1215 { |
1216 PidginWindow *win = data; | 1216 PidginWindow *win = data; |
1217 GaimConversation *conv; | 1217 PurpleConversation *conv; |
1218 | 1218 |
1219 conv = pidgin_conv_window_get_active_gtkconv(win)->active_conv; | 1219 conv = pidgin_conv_window_get_active_gtkconv(win)->active_conv; |
1220 | 1220 |
1221 pidgin_pounce_editor_show(gaim_conversation_get_account(conv), | 1221 pidgin_pounce_editor_show(purple_conversation_get_account(conv), |
1222 gaim_conversation_get_name(conv), NULL); | 1222 purple_conversation_get_name(conv), NULL); |
1223 } | 1223 } |
1224 | 1224 |
1225 static void | 1225 static void |
1226 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) | 1226 menu_alias_cb(gpointer data, guint action, GtkWidget *widget) |
1227 { | 1227 { |
1228 PidginWindow *win = data; | 1228 PidginWindow *win = data; |
1229 GaimConversation *conv; | 1229 PurpleConversation *conv; |
1230 GaimAccount *account; | 1230 PurpleAccount *account; |
1231 const char *name; | 1231 const char *name; |
1232 | 1232 |
1233 conv = pidgin_conv_window_get_active_conversation(win); | 1233 conv = pidgin_conv_window_get_active_conversation(win); |
1234 account = gaim_conversation_get_account(conv); | 1234 account = purple_conversation_get_account(conv); |
1235 name = gaim_conversation_get_name(conv); | 1235 name = purple_conversation_get_name(conv); |
1236 | 1236 |
1237 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 1237 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
1238 GaimBuddy *b; | 1238 PurpleBuddy *b; |
1239 | 1239 |
1240 b = gaim_find_buddy(account, name); | 1240 b = purple_find_buddy(account, name); |
1241 if (b != NULL) | 1241 if (b != NULL) |
1242 pidgindialogs_alias_buddy(b); | 1242 pidgindialogs_alias_buddy(b); |
1243 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 1243 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
1244 GaimChat *c; | 1244 PurpleChat *c; |
1245 | 1245 |
1246 c = gaim_blist_find_chat(account, name); | 1246 c = purple_blist_find_chat(account, name); |
1247 if (c != NULL) | 1247 if (c != NULL) |
1248 pidgindialogs_alias_chat(c); | 1248 pidgindialogs_alias_chat(c); |
1249 } | 1249 } |
1250 } | 1250 } |
1251 | 1251 |
1252 static void | 1252 static void |
1253 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) | 1253 menu_get_info_cb(gpointer data, guint action, GtkWidget *widget) |
1254 { | 1254 { |
1255 PidginWindow *win = data; | 1255 PidginWindow *win = data; |
1256 GaimConversation *conv; | 1256 PurpleConversation *conv; |
1257 | 1257 |
1258 conv = pidgin_conv_window_get_active_conversation(win); | 1258 conv = pidgin_conv_window_get_active_conversation(win); |
1259 | 1259 |
1260 info_cb(NULL, PIDGIN_CONVERSATION(conv)); | 1260 info_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1261 } | 1261 } |
1262 | 1262 |
1263 static void | 1263 static void |
1264 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) | 1264 menu_invite_cb(gpointer data, guint action, GtkWidget *widget) |
1265 { | 1265 { |
1266 PidginWindow *win = data; | 1266 PidginWindow *win = data; |
1267 GaimConversation *conv; | 1267 PurpleConversation *conv; |
1268 | 1268 |
1269 conv = pidgin_conv_window_get_active_conversation(win); | 1269 conv = pidgin_conv_window_get_active_conversation(win); |
1270 | 1270 |
1271 invite_cb(NULL, PIDGIN_CONVERSATION(conv)); | 1271 invite_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1272 } | 1272 } |
1273 | 1273 |
1274 static void | 1274 static void |
1275 menu_block_cb(gpointer data, guint action, GtkWidget *widget) | 1275 menu_block_cb(gpointer data, guint action, GtkWidget *widget) |
1276 { | 1276 { |
1277 PidginWindow *win = data; | 1277 PidginWindow *win = data; |
1278 GaimConversation *conv; | 1278 PurpleConversation *conv; |
1279 | 1279 |
1280 conv = pidgin_conv_window_get_active_conversation(win); | 1280 conv = pidgin_conv_window_get_active_conversation(win); |
1281 | 1281 |
1282 block_cb(NULL, PIDGIN_CONVERSATION(conv)); | 1282 block_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1283 } | 1283 } |
1284 | 1284 |
1285 static void | 1285 static void |
1286 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) | 1286 menu_unblock_cb(gpointer data, guint action, GtkWidget *widget) |
1287 { | 1287 { |
1288 PidginWindow *win = data; | 1288 PidginWindow *win = data; |
1289 GaimConversation *conv; | 1289 PurpleConversation *conv; |
1290 | 1290 |
1291 conv = pidgin_conv_window_get_active_conversation(win); | 1291 conv = pidgin_conv_window_get_active_conversation(win); |
1292 | 1292 |
1293 unblock_cb(NULL, PIDGIN_CONVERSATION(conv)); | 1293 unblock_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1294 } | 1294 } |
1295 | 1295 |
1296 static void | 1296 static void |
1297 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) | 1297 menu_add_remove_cb(gpointer data, guint action, GtkWidget *widget) |
1298 { | 1298 { |
1299 PidginWindow *win = data; | 1299 PidginWindow *win = data; |
1300 GaimConversation *conv; | 1300 PurpleConversation *conv; |
1301 | 1301 |
1302 conv = pidgin_conv_window_get_active_conversation(win); | 1302 conv = pidgin_conv_window_get_active_conversation(win); |
1303 | 1303 |
1304 add_remove_cb(NULL, PIDGIN_CONVERSATION(conv)); | 1304 add_remove_cb(NULL, PIDGIN_CONVERSATION(conv)); |
1305 } | 1305 } |
1314 | 1314 |
1315 static void | 1315 static void |
1316 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) | 1316 menu_logging_cb(gpointer data, guint action, GtkWidget *widget) |
1317 { | 1317 { |
1318 PidginWindow *win = data; | 1318 PidginWindow *win = data; |
1319 GaimConversation *conv; | 1319 PurpleConversation *conv; |
1320 gboolean logging; | 1320 gboolean logging; |
1321 | 1321 |
1322 conv = pidgin_conv_window_get_active_conversation(win); | 1322 conv = pidgin_conv_window_get_active_conversation(win); |
1323 | 1323 |
1324 if (conv == NULL) | 1324 if (conv == NULL) |
1325 return; | 1325 return; |
1326 | 1326 |
1327 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | 1327 logging = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
1328 | 1328 |
1329 if (logging == gaim_conversation_is_logging(conv)) | 1329 if (logging == purple_conversation_is_logging(conv)) |
1330 return; | 1330 return; |
1331 | 1331 |
1332 if (logging) | 1332 if (logging) |
1333 { | 1333 { |
1334 /* Enable logging first so the message below can be logged. */ | 1334 /* Enable logging first so the message below can be logged. */ |
1335 gaim_conversation_set_logging(conv, TRUE); | 1335 purple_conversation_set_logging(conv, TRUE); |
1336 | 1336 |
1337 gaim_conversation_write(conv, NULL, | 1337 purple_conversation_write(conv, NULL, |
1338 _("Logging started. Future messages in this conversation will be logged."), | 1338 _("Logging started. Future messages in this conversation will be logged."), |
1339 conv->logs ? (GAIM_MESSAGE_SYSTEM) : | 1339 conv->logs ? (PURPLE_MESSAGE_SYSTEM) : |
1340 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG), | 1340 (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), |
1341 time(NULL)); | 1341 time(NULL)); |
1342 } | 1342 } |
1343 else | 1343 else |
1344 { | 1344 { |
1345 gaim_conversation_write(conv, NULL, | 1345 purple_conversation_write(conv, NULL, |
1346 _("Logging stopped. Future messages in this conversation will not be logged."), | 1346 _("Logging stopped. Future messages in this conversation will not be logged."), |
1347 conv->logs ? (GAIM_MESSAGE_SYSTEM) : | 1347 conv->logs ? (PURPLE_MESSAGE_SYSTEM) : |
1348 (GAIM_MESSAGE_SYSTEM | GAIM_MESSAGE_NO_LOG), | 1348 (PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG), |
1349 time(NULL)); | 1349 time(NULL)); |
1350 | 1350 |
1351 /* Disable the logging second, so that the above message can be logged. */ | 1351 /* Disable the logging second, so that the above message can be logged. */ |
1352 gaim_conversation_set_logging(conv, FALSE); | 1352 purple_conversation_set_logging(conv, FALSE); |
1353 } | 1353 } |
1354 } | 1354 } |
1355 | 1355 |
1356 static void | 1356 static void |
1357 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) | 1357 menu_toolbar_cb(gpointer data, guint action, GtkWidget *widget) |
1358 { | 1358 { |
1359 gaim_prefs_set_bool("/gaim/gtk/conversations/show_formatting_toolbar", | 1359 purple_prefs_set_bool("/purple/gtk/conversations/show_formatting_toolbar", |
1360 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | 1360 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
1361 } | 1361 } |
1362 | 1362 |
1363 static void | 1363 static void |
1364 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) | 1364 menu_sounds_cb(gpointer data, guint action, GtkWidget *widget) |
1365 { | 1365 { |
1366 PidginWindow *win = data; | 1366 PidginWindow *win = data; |
1367 GaimConversation *conv; | 1367 PurpleConversation *conv; |
1368 PidginConversation *gtkconv; | 1368 PidginConversation *gtkconv; |
1369 | 1369 |
1370 conv = pidgin_conv_window_get_active_conversation(win); | 1370 conv = pidgin_conv_window_get_active_conversation(win); |
1371 | 1371 |
1372 if (!conv) | 1372 if (!conv) |
1379 } | 1379 } |
1380 | 1380 |
1381 static void | 1381 static void |
1382 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) | 1382 menu_timestamps_cb(gpointer data, guint action, GtkWidget *widget) |
1383 { | 1383 { |
1384 gaim_prefs_set_bool("/gaim/gtk/conversations/show_timestamps", | 1384 purple_prefs_set_bool("/purple/gtk/conversations/show_timestamps", |
1385 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); | 1385 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget))); |
1386 } | 1386 } |
1387 | 1387 |
1388 static void | 1388 static void |
1389 chat_do_im(PidginConversation *gtkconv, const char *who) | 1389 chat_do_im(PidginConversation *gtkconv, const char *who) |
1390 { | 1390 { |
1391 GaimConversation *conv = gtkconv->active_conv; | 1391 PurpleConversation *conv = gtkconv->active_conv; |
1392 GaimAccount *account; | 1392 PurpleAccount *account; |
1393 GaimConnection *gc; | 1393 PurpleConnection *gc; |
1394 GaimPluginProtocolInfo *prpl_info = NULL; | 1394 PurplePluginProtocolInfo *prpl_info = NULL; |
1395 char *real_who; | 1395 char *real_who; |
1396 | 1396 |
1397 account = gaim_conversation_get_account(conv); | 1397 account = purple_conversation_get_account(conv); |
1398 g_return_if_fail(account != NULL); | 1398 g_return_if_fail(account != NULL); |
1399 | 1399 |
1400 gc = gaim_account_get_connection(account); | 1400 gc = purple_account_get_connection(account); |
1401 g_return_if_fail(gc != NULL); | 1401 g_return_if_fail(gc != NULL); |
1402 | 1402 |
1403 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 1403 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
1404 | 1404 |
1405 if (prpl_info && prpl_info->get_cb_real_name) | 1405 if (prpl_info && prpl_info->get_cb_real_name) |
1406 real_who = prpl_info->get_cb_real_name(gc, | 1406 real_who = prpl_info->get_cb_real_name(gc, |
1407 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | 1407 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); |
1408 else | 1408 else |
1409 real_who = g_strdup(who); | 1409 real_who = g_strdup(who); |
1410 | 1410 |
1411 if(!real_who) | 1411 if(!real_who) |
1412 return; | 1412 return; |
1417 } | 1417 } |
1418 | 1418 |
1419 static void | 1419 static void |
1420 ignore_cb(GtkWidget *w, PidginConversation *gtkconv) | 1420 ignore_cb(GtkWidget *w, PidginConversation *gtkconv) |
1421 { | 1421 { |
1422 GaimConversation *conv = gtkconv->active_conv; | 1422 PurpleConversation *conv = gtkconv->active_conv; |
1423 PidginChatPane *gtkchat; | 1423 PidginChatPane *gtkchat; |
1424 GaimConvChatBuddy *cbuddy; | 1424 PurpleConvChatBuddy *cbuddy; |
1425 GaimConvChat *chat; | 1425 PurpleConvChat *chat; |
1426 GaimConvChatBuddyFlags flags; | 1426 PurpleConvChatBuddyFlags flags; |
1427 GtkTreeIter iter; | 1427 GtkTreeIter iter; |
1428 GtkTreeModel *model; | 1428 GtkTreeModel *model; |
1429 GtkTreeSelection *sel; | 1429 GtkTreeSelection *sel; |
1430 char *name; | 1430 char *name; |
1431 char *alias; | 1431 char *alias; |
1432 | 1432 |
1433 chat = GAIM_CONV_CHAT(conv); | 1433 chat = PURPLE_CONV_CHAT(conv); |
1434 gtkchat = gtkconv->u.chat; | 1434 gtkchat = gtkconv->u.chat; |
1435 | 1435 |
1436 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 1436 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
1437 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | 1437 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
1438 | 1438 |
1445 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 1445 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
1446 } | 1446 } |
1447 else | 1447 else |
1448 return; | 1448 return; |
1449 | 1449 |
1450 if (gaim_conv_chat_is_user_ignored(chat, name)) | 1450 if (purple_conv_chat_is_user_ignored(chat, name)) |
1451 gaim_conv_chat_unignore(chat, name); | 1451 purple_conv_chat_unignore(chat, name); |
1452 else | 1452 else |
1453 gaim_conv_chat_ignore(chat, name); | 1453 purple_conv_chat_ignore(chat, name); |
1454 | 1454 |
1455 cbuddy = gaim_conv_chat_cb_new(name, alias, flags); | 1455 cbuddy = purple_conv_chat_cb_new(name, alias, flags); |
1456 | 1456 |
1457 add_chat_buddy_common(conv, cbuddy, NULL); | 1457 add_chat_buddy_common(conv, cbuddy, NULL); |
1458 g_free(name); | 1458 g_free(name); |
1459 g_free(alias); | 1459 g_free(alias); |
1460 } | 1460 } |
1468 } | 1468 } |
1469 | 1469 |
1470 static void | 1470 static void |
1471 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) | 1471 menu_chat_send_file_cb(GtkWidget *w, PidginConversation *gtkconv) |
1472 { | 1472 { |
1473 GaimConversation *conv = gtkconv->active_conv; | 1473 PurpleConversation *conv = gtkconv->active_conv; |
1474 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); | 1474 const char *who = g_object_get_data(G_OBJECT(w), "user_data"); |
1475 GaimConnection *gc = gaim_conversation_get_gc(conv); | 1475 PurpleConnection *gc = purple_conversation_get_gc(conv); |
1476 | 1476 |
1477 serv_send_file(gc, who, NULL); | 1477 serv_send_file(gc, who, NULL); |
1478 } | 1478 } |
1479 | 1479 |
1480 static void | 1480 static void |
1488 } | 1488 } |
1489 | 1489 |
1490 static void | 1490 static void |
1491 menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv) | 1491 menu_chat_get_away_cb(GtkWidget *w, PidginConversation *gtkconv) |
1492 { | 1492 { |
1493 GaimConversation *conv = gtkconv->active_conv; | 1493 PurpleConversation *conv = gtkconv->active_conv; |
1494 GaimPluginProtocolInfo *prpl_info = NULL; | 1494 PurplePluginProtocolInfo *prpl_info = NULL; |
1495 GaimConnection *gc; | 1495 PurpleConnection *gc; |
1496 char *who; | 1496 char *who; |
1497 | 1497 |
1498 gc = gaim_conversation_get_gc(conv); | 1498 gc = purple_conversation_get_gc(conv); |
1499 who = g_object_get_data(G_OBJECT(w), "user_data"); | 1499 who = g_object_get_data(G_OBJECT(w), "user_data"); |
1500 | 1500 |
1501 if (gc != NULL) { | 1501 if (gc != NULL) { |
1502 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 1502 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
1503 | 1503 |
1504 /* | 1504 /* |
1505 * May want to expand this to work similarly to menu_info_cb? | 1505 * May want to expand this to work similarly to menu_info_cb? |
1506 */ | 1506 */ |
1507 | 1507 |
1508 if (prpl_info->get_cb_away != NULL) | 1508 if (prpl_info->get_cb_away != NULL) |
1509 { | 1509 { |
1510 prpl_info->get_cb_away(gc, | 1510 prpl_info->get_cb_away(gc, |
1511 gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), who); | 1511 purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), who); |
1512 } | 1512 } |
1513 } | 1513 } |
1514 } | 1514 } |
1515 | 1515 |
1516 static void | 1516 static void |
1517 menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) | 1517 menu_chat_add_remove_cb(GtkWidget *w, PidginConversation *gtkconv) |
1518 { | 1518 { |
1519 GaimConversation *conv = gtkconv->active_conv; | 1519 PurpleConversation *conv = gtkconv->active_conv; |
1520 GaimAccount *account; | 1520 PurpleAccount *account; |
1521 GaimBuddy *b; | 1521 PurpleBuddy *b; |
1522 char *name; | 1522 char *name; |
1523 | 1523 |
1524 account = gaim_conversation_get_account(conv); | 1524 account = purple_conversation_get_account(conv); |
1525 name = g_object_get_data(G_OBJECT(w), "user_data"); | 1525 name = g_object_get_data(G_OBJECT(w), "user_data"); |
1526 b = gaim_find_buddy(account, name); | 1526 b = purple_find_buddy(account, name); |
1527 | 1527 |
1528 if (b != NULL) | 1528 if (b != NULL) |
1529 pidgindialogs_remove_buddy(b); | 1529 pidgindialogs_remove_buddy(b); |
1530 else if (account != NULL && gaim_account_is_connected(account)) | 1530 else if (account != NULL && purple_account_is_connected(account)) |
1531 gaim_blist_request_add_buddy(account, name, NULL, NULL); | 1531 purple_blist_request_add_buddy(account, name, NULL, NULL); |
1532 | 1532 |
1533 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); | 1533 gtk_widget_grab_focus(PIDGIN_CONVERSATION(conv)->entry); |
1534 } | 1534 } |
1535 | 1535 |
1536 static GtkTextMark * | 1536 static GtkTextMark * |
1558 else | 1558 else |
1559 g_return_if_reached(); | 1559 g_return_if_reached(); |
1560 } | 1560 } |
1561 | 1561 |
1562 static GtkWidget * | 1562 static GtkWidget * |
1563 create_chat_menu(GaimConversation *conv, const char *who, GaimConnection *gc) | 1563 create_chat_menu(PurpleConversation *conv, const char *who, PurpleConnection *gc) |
1564 { | 1564 { |
1565 static GtkWidget *menu = NULL; | 1565 static GtkWidget *menu = NULL; |
1566 GaimPluginProtocolInfo *prpl_info = NULL; | 1566 PurplePluginProtocolInfo *prpl_info = NULL; |
1567 GaimConvChat *chat = GAIM_CONV_CHAT(conv); | 1567 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); |
1568 gboolean is_me = FALSE; | 1568 gboolean is_me = FALSE; |
1569 GtkWidget *button; | 1569 GtkWidget *button; |
1570 GaimBuddy *buddy = NULL; | 1570 PurpleBuddy *buddy = NULL; |
1571 | 1571 |
1572 if (gc != NULL) | 1572 if (gc != NULL) |
1573 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 1573 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
1574 | 1574 |
1575 /* | 1575 /* |
1576 * If a menu already exists, destroy it before creating a new one, | 1576 * If a menu already exists, destroy it before creating a new one, |
1577 * thus freeing-up the memory it occupied. | 1577 * thus freeing-up the memory it occupied. |
1578 */ | 1578 */ |
1579 if (menu) | 1579 if (menu) |
1580 gtk_widget_destroy(menu); | 1580 gtk_widget_destroy(menu); |
1581 | 1581 |
1582 if (!strcmp(chat->nick, gaim_normalize(conv->account, who))) | 1582 if (!strcmp(chat->nick, purple_normalize(conv->account, who))) |
1583 is_me = TRUE; | 1583 is_me = TRUE; |
1584 | 1584 |
1585 menu = gtk_menu_new(); | 1585 menu = gtk_menu_new(); |
1586 | 1586 |
1587 if (!is_me) { | 1587 if (!is_me) { |
1608 | 1608 |
1609 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); | 1609 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
1610 } | 1610 } |
1611 | 1611 |
1612 | 1612 |
1613 if (gaim_conv_chat_is_user_ignored(GAIM_CONV_CHAT(conv), who)) | 1613 if (purple_conv_chat_is_user_ignored(PURPLE_CONV_CHAT(conv), who)) |
1614 button = pidgin_new_item_from_stock(menu, _("Un-Ignore"), PIDGIN_STOCK_IGNORE, | 1614 button = pidgin_new_item_from_stock(menu, _("Un-Ignore"), PIDGIN_STOCK_IGNORE, |
1615 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); | 1615 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); |
1616 else | 1616 else |
1617 button = pidgin_new_item_from_stock(menu, _("Ignore"), PIDGIN_STOCK_IGNORE, | 1617 button = pidgin_new_item_from_stock(menu, _("Ignore"), PIDGIN_STOCK_IGNORE, |
1618 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); | 1618 G_CALLBACK(ignore_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); |
1642 | 1642 |
1643 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); | 1643 g_object_set_data_full(G_OBJECT(button), "user_data", g_strdup(who), g_free); |
1644 } | 1644 } |
1645 | 1645 |
1646 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { | 1646 if (!is_me && prpl_info && !(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME)) { |
1647 if ((buddy = gaim_find_buddy(conv->account, who)) != NULL) | 1647 if ((buddy = purple_find_buddy(conv->account, who)) != NULL) |
1648 button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, | 1648 button = pidgin_new_item_from_stock(menu, _("Remove"), GTK_STOCK_REMOVE, |
1649 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); | 1649 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); |
1650 else | 1650 else |
1651 button = pidgin_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD, | 1651 button = pidgin_new_item_from_stock(menu, _("Add"), GTK_STOCK_ADD, |
1652 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); | 1652 G_CALLBACK(menu_chat_add_remove_cb), PIDGIN_CONVERSATION(conv), 0, 0, NULL); |
1663 if (!get_mark_for_user(PIDGIN_CONVERSATION(conv), who)) | 1663 if (!get_mark_for_user(PIDGIN_CONVERSATION(conv), who)) |
1664 gtk_widget_set_sensitive(button, FALSE); | 1664 gtk_widget_set_sensitive(button, FALSE); |
1665 | 1665 |
1666 if (buddy != NULL) | 1666 if (buddy != NULL) |
1667 { | 1667 { |
1668 if (gaim_account_is_connected(conv->account)) | 1668 if (purple_account_is_connected(conv->account)) |
1669 pidgin_append_blist_node_proto_menu(menu, conv->account->gc, | 1669 pidgin_append_blist_node_proto_menu(menu, conv->account->gc, |
1670 (GaimBlistNode *)buddy); | 1670 (PurpleBlistNode *)buddy); |
1671 pidgin_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy); | 1671 pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); |
1672 gtk_widget_show_all(menu); | 1672 gtk_widget_show_all(menu); |
1673 } | 1673 } |
1674 | 1674 |
1675 return menu; | 1675 return menu; |
1676 } | 1676 } |
1677 | 1677 |
1678 | 1678 |
1679 static gint | 1679 static gint |
1680 gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv) | 1680 gtkconv_chat_popup_menu_cb(GtkWidget *widget, PidginConversation *gtkconv) |
1681 { | 1681 { |
1682 GaimConversation *conv = gtkconv->active_conv; | 1682 PurpleConversation *conv = gtkconv->active_conv; |
1683 PidginChatPane *gtkchat; | 1683 PidginChatPane *gtkchat; |
1684 GaimConnection *gc; | 1684 PurpleConnection *gc; |
1685 GaimAccount *account; | 1685 PurpleAccount *account; |
1686 GtkTreeSelection *sel; | 1686 GtkTreeSelection *sel; |
1687 GtkTreeIter iter; | 1687 GtkTreeIter iter; |
1688 GtkTreeModel *model; | 1688 GtkTreeModel *model; |
1689 GtkWidget *menu; | 1689 GtkWidget *menu; |
1690 gchar *who; | 1690 gchar *who; |
1691 | 1691 |
1692 gtkconv = PIDGIN_CONVERSATION(conv); | 1692 gtkconv = PIDGIN_CONVERSATION(conv); |
1693 gtkchat = gtkconv->u.chat; | 1693 gtkchat = gtkconv->u.chat; |
1694 account = gaim_conversation_get_account(conv); | 1694 account = purple_conversation_get_account(conv); |
1695 gc = account->gc; | 1695 gc = account->gc; |
1696 | 1696 |
1697 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 1697 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
1698 | 1698 |
1699 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); | 1699 sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(gtkchat->list)); |
1713 | 1713 |
1714 static gint | 1714 static gint |
1715 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, | 1715 right_click_chat_cb(GtkWidget *widget, GdkEventButton *event, |
1716 PidginConversation *gtkconv) | 1716 PidginConversation *gtkconv) |
1717 { | 1717 { |
1718 GaimConversation *conv = gtkconv->active_conv; | 1718 PurpleConversation *conv = gtkconv->active_conv; |
1719 PidginChatPane *gtkchat; | 1719 PidginChatPane *gtkchat; |
1720 GaimConnection *gc; | 1720 PurpleConnection *gc; |
1721 GaimAccount *account; | 1721 PurpleAccount *account; |
1722 GtkTreePath *path; | 1722 GtkTreePath *path; |
1723 GtkTreeIter iter; | 1723 GtkTreeIter iter; |
1724 GtkTreeModel *model; | 1724 GtkTreeModel *model; |
1725 GtkTreeViewColumn *column; | 1725 GtkTreeViewColumn *column; |
1726 gchar *who; | 1726 gchar *who; |
1727 int x, y; | 1727 int x, y; |
1728 | 1728 |
1729 gtkchat = gtkconv->u.chat; | 1729 gtkchat = gtkconv->u.chat; |
1730 account = gaim_conversation_get_account(conv); | 1730 account = purple_conversation_get_account(conv); |
1731 gc = account->gc; | 1731 gc = account->gc; |
1732 | 1732 |
1733 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 1733 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
1734 | 1734 |
1735 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), | 1735 gtk_tree_view_get_path_at_pos(GTK_TREE_VIEW(gtkchat->list), |
1798 | 1798 |
1799 static gboolean | 1799 static gboolean |
1800 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) | 1800 entry_key_press_cb(GtkWidget *entry, GdkEventKey *event, gpointer data) |
1801 { | 1801 { |
1802 PidginWindow *win; | 1802 PidginWindow *win; |
1803 GaimConversation *conv; | 1803 PurpleConversation *conv; |
1804 PidginConversation *gtkconv; | 1804 PidginConversation *gtkconv; |
1805 int curconv; | 1805 int curconv; |
1806 | 1806 |
1807 gtkconv = (PidginConversation *)data; | 1807 gtkconv = (PidginConversation *)data; |
1808 conv = gtkconv->active_conv; | 1808 conv = gtkconv->active_conv; |
2040 | 2040 |
2041 return TRUE; | 2041 return TRUE; |
2042 } | 2042 } |
2043 | 2043 |
2044 void | 2044 void |
2045 pidgin_conv_switch_active_conversation(GaimConversation *conv) | 2045 pidgin_conv_switch_active_conversation(PurpleConversation *conv) |
2046 { | 2046 { |
2047 PidginConversation *gtkconv; | 2047 PidginConversation *gtkconv; |
2048 GaimConversation *old_conv; | 2048 PurpleConversation *old_conv; |
2049 GtkIMHtml *entry; | 2049 GtkIMHtml *entry; |
2050 const char *protocol_name; | 2050 const char *protocol_name; |
2051 | 2051 |
2052 g_return_if_fail(conv != NULL); | 2052 g_return_if_fail(conv != NULL); |
2053 | 2053 |
2055 old_conv = gtkconv->active_conv; | 2055 old_conv = gtkconv->active_conv; |
2056 | 2056 |
2057 if (old_conv == conv) | 2057 if (old_conv == conv) |
2058 return; | 2058 return; |
2059 | 2059 |
2060 gaim_conversation_close_logs(old_conv); | 2060 purple_conversation_close_logs(old_conv); |
2061 gtkconv->active_conv = conv; | 2061 gtkconv->active_conv = conv; |
2062 | 2062 |
2063 gaim_conversation_set_logging(conv, | 2063 purple_conversation_set_logging(conv, |
2064 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); | 2064 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging))); |
2065 | 2065 |
2066 entry = GTK_IMHTML(gtkconv->entry); | 2066 entry = GTK_IMHTML(gtkconv->entry); |
2067 protocol_name = gaim_account_get_protocol_name(conv->account); | 2067 protocol_name = purple_account_get_protocol_name(conv->account); |
2068 gtk_imhtml_set_protocol_name(entry, protocol_name); | 2068 gtk_imhtml_set_protocol_name(entry, protocol_name); |
2069 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); | 2069 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), protocol_name); |
2070 | 2070 |
2071 if (!(conv->features & GAIM_CONNECTION_HTML)) | 2071 if (!(conv->features & PURPLE_CONNECTION_HTML)) |
2072 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); | 2072 gtk_imhtml_clear_formatting(GTK_IMHTML(gtkconv->entry)); |
2073 else if (conv->features & GAIM_CONNECTION_FORMATTING_WBFO && | 2073 else if (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO && |
2074 !(old_conv->features & GAIM_CONNECTION_FORMATTING_WBFO)) | 2074 !(old_conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)) |
2075 { | 2075 { |
2076 /* The old conversation allowed formatting on parts of the | 2076 /* The old conversation allowed formatting on parts of the |
2077 * buffer, but the new one only allows it on the whole | 2077 * buffer, but the new one only allows it on the whole |
2078 * buffer. This code saves the formatting from the current | 2078 * buffer. This code saves the formatting from the current |
2079 * position of the cursor, clears the formatting, then | 2079 * position of the cursor, clears the formatting, then |
2109 if (underline != underline2) | 2109 if (underline != underline2) |
2110 gtk_imhtml_toggle_underline(entry); | 2110 gtk_imhtml_toggle_underline(entry); |
2111 | 2111 |
2112 gtk_imhtml_toggle_fontface(entry, fontface); | 2112 gtk_imhtml_toggle_fontface(entry, fontface); |
2113 | 2113 |
2114 if (!(conv->features & GAIM_CONNECTION_NO_FONTSIZE)) | 2114 if (!(conv->features & PURPLE_CONNECTION_NO_FONTSIZE)) |
2115 gtk_imhtml_font_set_size(entry, fontsize); | 2115 gtk_imhtml_font_set_size(entry, fontsize); |
2116 | 2116 |
2117 gtk_imhtml_toggle_forecolor(entry, forecolor); | 2117 gtk_imhtml_toggle_forecolor(entry, forecolor); |
2118 | 2118 |
2119 if (!(conv->features & GAIM_CONNECTION_NO_BGCOLOR)) | 2119 if (!(conv->features & PURPLE_CONNECTION_NO_BGCOLOR)) |
2120 { | 2120 { |
2121 gtk_imhtml_toggle_backcolor(entry, backcolor); | 2121 gtk_imhtml_toggle_backcolor(entry, backcolor); |
2122 gtk_imhtml_toggle_background(entry, background); | 2122 gtk_imhtml_toggle_background(entry, background); |
2123 } | 2123 } |
2124 | 2124 |
2132 /* This is done in default_formatize, which is called from clear_formatting_cb, | 2132 /* This is done in default_formatize, which is called from clear_formatting_cb, |
2133 * which is (obviously) a clear_formatting signal handler. However, if we're | 2133 * which is (obviously) a clear_formatting signal handler. However, if we're |
2134 * here, we didn't call gtk_imhtml_clear_formatting() (because we want to | 2134 * here, we didn't call gtk_imhtml_clear_formatting() (because we want to |
2135 * preserve the formatting exactly as it is), so we have to do this now. */ | 2135 * preserve the formatting exactly as it is), so we have to do this now. */ |
2136 gtk_imhtml_set_whole_buffer_formatting_only(entry, | 2136 gtk_imhtml_set_whole_buffer_formatting_only(entry, |
2137 (conv->features & GAIM_CONNECTION_FORMATTING_WBFO)); | 2137 (conv->features & PURPLE_CONNECTION_FORMATTING_WBFO)); |
2138 } | 2138 } |
2139 | 2139 |
2140 gaim_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); | 2140 purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); |
2141 | 2141 |
2142 gray_stuff_out(gtkconv); | 2142 gray_stuff_out(gtkconv); |
2143 update_typing_icon(gtkconv); | 2143 update_typing_icon(gtkconv); |
2144 | 2144 |
2145 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window), | 2145 gtk_window_set_title(GTK_WINDOW(gtkconv->win->window), |
2147 } | 2147 } |
2148 | 2148 |
2149 static void | 2149 static void |
2150 menu_conv_sel_send_cb(GObject *m, gpointer data) | 2150 menu_conv_sel_send_cb(GObject *m, gpointer data) |
2151 { | 2151 { |
2152 GaimAccount *account = g_object_get_data(m, "gaim_account"); | 2152 PurpleAccount *account = g_object_get_data(m, "purple_account"); |
2153 gchar *name = g_object_get_data(m, "gaim_buddy_name"); | 2153 gchar *name = g_object_get_data(m, "purple_buddy_name"); |
2154 GaimConversation *conv; | 2154 PurpleConversation *conv; |
2155 | 2155 |
2156 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) | 2156 if (gtk_check_menu_item_get_active((GtkCheckMenuItem*) m) == FALSE) |
2157 return; | 2157 return; |
2158 | 2158 |
2159 conv = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, name); | 2159 conv = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, name); |
2160 pidgin_conv_switch_active_conversation(conv); | 2160 pidgin_conv_switch_active_conversation(conv); |
2161 } | 2161 } |
2162 | 2162 |
2163 static void | 2163 static void |
2164 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, | 2164 insert_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *position, |
2165 gchar *new_text, gint new_text_length, gpointer user_data) | 2165 gchar *new_text, gint new_text_length, gpointer user_data) |
2166 { | 2166 { |
2167 PidginConversation *gtkconv = (PidginConversation *)user_data; | 2167 PidginConversation *gtkconv = (PidginConversation *)user_data; |
2168 GaimConversation *conv; | 2168 PurpleConversation *conv; |
2169 | 2169 |
2170 g_return_if_fail(gtkconv != NULL); | 2170 g_return_if_fail(gtkconv != NULL); |
2171 | 2171 |
2172 conv = gtkconv->active_conv; | 2172 conv = gtkconv->active_conv; |
2173 | 2173 |
2174 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) | 2174 if (!purple_prefs_get_bool("/core/conversations/im/send_typing")) |
2175 return; | 2175 return; |
2176 | 2176 |
2177 got_typing_keypress(gtkconv, (gtk_text_iter_is_start(position) && | 2177 got_typing_keypress(gtkconv, (gtk_text_iter_is_start(position) && |
2178 gtk_text_iter_is_end(position))); | 2178 gtk_text_iter_is_end(position))); |
2179 } | 2179 } |
2181 static void | 2181 static void |
2182 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, | 2182 delete_text_cb(GtkTextBuffer *textbuffer, GtkTextIter *start_pos, |
2183 GtkTextIter *end_pos, gpointer user_data) | 2183 GtkTextIter *end_pos, gpointer user_data) |
2184 { | 2184 { |
2185 PidginConversation *gtkconv = (PidginConversation *)user_data; | 2185 PidginConversation *gtkconv = (PidginConversation *)user_data; |
2186 GaimConversation *conv; | 2186 PurpleConversation *conv; |
2187 GaimConvIm *im; | 2187 PurpleConvIm *im; |
2188 | 2188 |
2189 g_return_if_fail(gtkconv != NULL); | 2189 g_return_if_fail(gtkconv != NULL); |
2190 | 2190 |
2191 conv = gtkconv->active_conv; | 2191 conv = gtkconv->active_conv; |
2192 | 2192 |
2193 if (!gaim_prefs_get_bool("/core/conversations/im/send_typing")) | 2193 if (!purple_prefs_get_bool("/core/conversations/im/send_typing")) |
2194 return; | 2194 return; |
2195 | 2195 |
2196 im = GAIM_CONV_IM(conv); | 2196 im = PURPLE_CONV_IM(conv); |
2197 | 2197 |
2198 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { | 2198 if (gtk_text_iter_is_start(start_pos) && gtk_text_iter_is_end(end_pos)) { |
2199 | 2199 |
2200 /* We deleted all the text, so turn off typing. */ | 2200 /* We deleted all the text, so turn off typing. */ |
2201 gaim_conv_im_stop_send_typed_timeout(im); | 2201 purple_conv_im_stop_send_typed_timeout(im); |
2202 | 2202 |
2203 serv_send_typing(gaim_conversation_get_gc(conv), | 2203 serv_send_typing(purple_conversation_get_gc(conv), |
2204 gaim_conversation_get_name(conv), | 2204 purple_conversation_get_name(conv), |
2205 GAIM_NOT_TYPING); | 2205 PURPLE_NOT_TYPING); |
2206 } | 2206 } |
2207 else { | 2207 else { |
2208 /* We're deleting, but not all of it, so it counts as typing. */ | 2208 /* We're deleting, but not all of it, so it counts as typing. */ |
2209 got_typing_keypress(gtkconv, FALSE); | 2209 got_typing_keypress(gtkconv, FALSE); |
2210 } | 2210 } |
2212 | 2212 |
2213 /************************************************************************** | 2213 /************************************************************************** |
2214 * A bunch of buddy icon functions | 2214 * A bunch of buddy icon functions |
2215 **************************************************************************/ | 2215 **************************************************************************/ |
2216 | 2216 |
2217 static GList *get_prpl_icon_list(GaimAccount *account) | 2217 static GList *get_prpl_icon_list(PurpleAccount *account) |
2218 { | 2218 { |
2219 GList *l = NULL; | 2219 GList *l = NULL; |
2220 GdkPixbuf *pixbuf; | 2220 GdkPixbuf *pixbuf; |
2221 GaimPluginProtocolInfo *prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(account))); | 2221 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(account))); |
2222 const char *prpl = prpl_info->list_icon(account, NULL); | 2222 const char *prpl = prpl_info->list_icon(account, NULL); |
2223 char *filename, *path; | 2223 char *filename, *path; |
2224 l = g_hash_table_lookup(prpl_lists, prpl); | 2224 l = g_hash_table_lookup(prpl_lists, prpl); |
2225 if (l) | 2225 if (l) |
2226 return l; | 2226 return l; |
2247 g_hash_table_insert(prpl_lists, g_strdup(prpl), l); | 2247 g_hash_table_insert(prpl_lists, g_strdup(prpl), l); |
2248 return l; | 2248 return l; |
2249 } | 2249 } |
2250 | 2250 |
2251 static GList * | 2251 static GList * |
2252 pidgin_conv_get_tab_icons(GaimConversation *conv) | 2252 pidgin_conv_get_tab_icons(PurpleConversation *conv) |
2253 { | 2253 { |
2254 GaimAccount *account = NULL; | 2254 PurpleAccount *account = NULL; |
2255 const char *name = NULL; | 2255 const char *name = NULL; |
2256 | 2256 |
2257 g_return_val_if_fail(conv != NULL, NULL); | 2257 g_return_val_if_fail(conv != NULL, NULL); |
2258 | 2258 |
2259 account = gaim_conversation_get_account(conv); | 2259 account = purple_conversation_get_account(conv); |
2260 name = gaim_conversation_get_name(conv); | 2260 name = purple_conversation_get_name(conv); |
2261 | 2261 |
2262 g_return_val_if_fail(account != NULL, NULL); | 2262 g_return_val_if_fail(account != NULL, NULL); |
2263 g_return_val_if_fail(name != NULL, NULL); | 2263 g_return_val_if_fail(name != NULL, NULL); |
2264 | 2264 |
2265 /* Use the buddy icon, if possible */ | 2265 /* Use the buddy icon, if possible */ |
2266 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 2266 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
2267 GaimBuddy *b = gaim_find_buddy(account, name); | 2267 PurpleBuddy *b = purple_find_buddy(account, name); |
2268 if (b != NULL) { | 2268 if (b != NULL) { |
2269 GaimPresence *p; | 2269 PurplePresence *p; |
2270 p = gaim_buddy_get_presence(b); | 2270 p = purple_buddy_get_presence(b); |
2271 if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_AWAY)) | 2271 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_AWAY)) |
2272 return away_list; | 2272 return away_list; |
2273 if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_UNAVAILABLE)) | 2273 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_UNAVAILABLE)) |
2274 return busy_list; | 2274 return busy_list; |
2275 if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_EXTENDED_AWAY)) | 2275 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_EXTENDED_AWAY)) |
2276 return xa_list; | 2276 return xa_list; |
2277 if (gaim_presence_is_status_primitive_active(p, GAIM_STATUS_OFFLINE)) | 2277 if (purple_presence_is_status_primitive_active(p, PURPLE_STATUS_OFFLINE)) |
2278 return offline_list; | 2278 return offline_list; |
2279 else | 2279 else |
2280 return available_list; | 2280 return available_list; |
2281 } | 2281 } |
2282 } | 2282 } |
2283 | 2283 |
2284 return get_prpl_icon_list(account); | 2284 return get_prpl_icon_list(account); |
2285 } | 2285 } |
2286 | 2286 |
2287 GdkPixbuf * | 2287 GdkPixbuf * |
2288 pidgin_conv_get_tab_icon(GaimConversation *conv, gboolean small_icon) | 2288 pidgin_conv_get_tab_icon(PurpleConversation *conv, gboolean small_icon) |
2289 { | 2289 { |
2290 GaimAccount *account = NULL; | 2290 PurpleAccount *account = NULL; |
2291 const char *name = NULL; | 2291 const char *name = NULL; |
2292 GdkPixbuf *status = NULL; | 2292 GdkPixbuf *status = NULL; |
2293 GaimBlistUiOps *ops = gaim_blist_get_ui_ops(); | 2293 PurpleBlistUiOps *ops = purple_blist_get_ui_ops(); |
2294 | 2294 |
2295 g_return_val_if_fail(conv != NULL, NULL); | 2295 g_return_val_if_fail(conv != NULL, NULL); |
2296 | 2296 |
2297 account = gaim_conversation_get_account(conv); | 2297 account = purple_conversation_get_account(conv); |
2298 name = gaim_conversation_get_name(conv); | 2298 name = purple_conversation_get_name(conv); |
2299 | 2299 |
2300 g_return_val_if_fail(account != NULL, NULL); | 2300 g_return_val_if_fail(account != NULL, NULL); |
2301 g_return_val_if_fail(name != NULL, NULL); | 2301 g_return_val_if_fail(name != NULL, NULL); |
2302 | 2302 |
2303 /* Use the buddy icon, if possible */ | 2303 /* Use the buddy icon, if possible */ |
2304 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 2304 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
2305 GaimBuddy *b = gaim_find_buddy(account, name); | 2305 PurpleBuddy *b = purple_find_buddy(account, name); |
2306 if (b != NULL) { | 2306 if (b != NULL) { |
2307 /* I hate this hack. It fixes a bug where the pending message icon | 2307 /* I hate this hack. It fixes a bug where the pending message icon |
2308 * displays in the conv tab even though it shouldn't. | 2308 * displays in the conv tab even though it shouldn't. |
2309 * A better solution would be great. */ | 2309 * A better solution would be great. */ |
2310 if (ops && ops->update) | 2310 if (ops && ops->update) |
2311 ops->update(NULL, (GaimBlistNode*)b); | 2311 ops->update(NULL, (PurpleBlistNode*)b); |
2312 | 2312 |
2313 status = pidgin_blist_get_status_icon((GaimBlistNode*)b, | 2313 status = pidgin_blist_get_status_icon((PurpleBlistNode*)b, |
2314 (small_icon ? PIDGIN_STATUS_ICON_SMALL : PIDGIN_STATUS_ICON_LARGE)); | 2314 (small_icon ? PIDGIN_STATUS_ICON_SMALL : PIDGIN_STATUS_ICON_LARGE)); |
2315 } | 2315 } |
2316 } | 2316 } |
2317 | 2317 |
2318 /* If they don't have a buddy icon, then use the PRPL icon */ | 2318 /* If they don't have a buddy icon, then use the PRPL icon */ |
2322 return status; | 2322 return status; |
2323 } | 2323 } |
2324 | 2324 |
2325 | 2325 |
2326 static void | 2326 static void |
2327 update_tab_icon(GaimConversation *conv) | 2327 update_tab_icon(PurpleConversation *conv) |
2328 { | 2328 { |
2329 PidginConversation *gtkconv; | 2329 PidginConversation *gtkconv; |
2330 PidginWindow *win; | 2330 PidginWindow *win; |
2331 GList *l; | 2331 GList *l; |
2332 GdkPixbuf *status = NULL; | 2332 GdkPixbuf *status = NULL; |
2347 | 2347 |
2348 if (status != NULL) | 2348 if (status != NULL) |
2349 g_object_unref(status); | 2349 g_object_unref(status); |
2350 | 2350 |
2351 if (pidgin_conv_window_is_active_conversation(conv) && | 2351 if (pidgin_conv_window_is_active_conversation(conv) && |
2352 (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM || | 2352 (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM || |
2353 gtkconv->u.im->anim == NULL)) | 2353 gtkconv->u.im->anim == NULL)) |
2354 { | 2354 { |
2355 l = pidgin_conv_get_tab_icons(conv); | 2355 l = pidgin_conv_get_tab_icons(conv); |
2356 | 2356 |
2357 gtk_window_set_icon_list(GTK_WINDOW(win->window), l); | 2357 gtk_window_set_icon_list(GTK_WINDOW(win->window), l); |
2373 | 2373 |
2374 static gboolean | 2374 static gboolean |
2375 redraw_icon(gpointer data) | 2375 redraw_icon(gpointer data) |
2376 { | 2376 { |
2377 PidginConversation *gtkconv = (PidginConversation *)data; | 2377 PidginConversation *gtkconv = (PidginConversation *)data; |
2378 GaimConversation *conv = gtkconv->active_conv; | 2378 PurpleConversation *conv = gtkconv->active_conv; |
2379 GaimAccount *account; | 2379 PurpleAccount *account; |
2380 GaimPluginProtocolInfo *prpl_info = NULL; | 2380 PurplePluginProtocolInfo *prpl_info = NULL; |
2381 | 2381 |
2382 GdkPixbuf *buf; | 2382 GdkPixbuf *buf; |
2383 GdkPixbuf *scale; | 2383 GdkPixbuf *scale; |
2384 gint delay; | 2384 gint delay; |
2385 int scale_width, scale_height; | 2385 int scale_width, scale_height; |
2386 | 2386 |
2387 gtkconv = PIDGIN_CONVERSATION(conv); | 2387 gtkconv = PIDGIN_CONVERSATION(conv); |
2388 account = gaim_conversation_get_account(conv); | 2388 account = purple_conversation_get_account(conv); |
2389 if(account && account->gc) | 2389 if(account && account->gc) |
2390 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | 2390 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); |
2391 | 2391 |
2392 gtkconv->auto_resize = TRUE; | 2392 gtkconv->auto_resize = TRUE; |
2393 g_idle_add(reset_auto_resize_cb, gtkconv); | 2393 g_idle_add(reset_auto_resize_cb, gtkconv); |
2394 | 2394 |
2395 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); | 2395 gdk_pixbuf_animation_iter_advance(gtkconv->u.im->iter, NULL); |
2396 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); | 2396 buf = gdk_pixbuf_animation_iter_get_pixbuf(gtkconv->u.im->iter); |
2397 | 2397 |
2398 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, | 2398 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, |
2399 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); | 2399 PURPLE_ICON_SCALE_DISPLAY, &scale_width, &scale_height); |
2400 | 2400 |
2401 /* this code is ugly, and scares me */ | 2401 /* this code is ugly, and scares me */ |
2402 scale = gdk_pixbuf_scale_simple(buf, | 2402 scale = gdk_pixbuf_scale_simple(buf, |
2403 MAX(gdk_pixbuf_get_width(buf) * scale_width / | 2403 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
2404 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | 2404 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
2443 } | 2443 } |
2444 | 2444 |
2445 static void | 2445 static void |
2446 remove_icon(GtkWidget *widget, PidginConversation *gtkconv) | 2446 remove_icon(GtkWidget *widget, PidginConversation *gtkconv) |
2447 { | 2447 { |
2448 GaimConversation *conv = gtkconv->active_conv; | 2448 PurpleConversation *conv = gtkconv->active_conv; |
2449 PidginWindow *gtkwin; | 2449 PidginWindow *gtkwin; |
2450 | 2450 |
2451 g_return_if_fail(conv != NULL); | 2451 g_return_if_fail(conv != NULL); |
2452 | 2452 |
2453 if (gtkconv->u.im->icon_container != NULL) | 2453 if (gtkconv->u.im->icon_container != NULL) |
2475 | 2475 |
2476 static void | 2476 static void |
2477 saveicon_writefile_cb(void *user_data, const char *filename) | 2477 saveicon_writefile_cb(void *user_data, const char *filename) |
2478 { | 2478 { |
2479 PidginConversation *gtkconv = (PidginConversation *)user_data; | 2479 PidginConversation *gtkconv = (PidginConversation *)user_data; |
2480 GaimConversation *conv = gtkconv->active_conv; | 2480 PurpleConversation *conv = gtkconv->active_conv; |
2481 FILE *fp; | 2481 FILE *fp; |
2482 GaimBuddyIcon *icon; | 2482 PurpleBuddyIcon *icon; |
2483 const void *data; | 2483 const void *data; |
2484 size_t len; | 2484 size_t len; |
2485 | 2485 |
2486 if ((fp = g_fopen(filename, "wb")) == NULL) { | 2486 if ((fp = g_fopen(filename, "wb")) == NULL) { |
2487 gaim_notify_error(gtkconv, NULL, _("Unable to open file."), NULL); | 2487 purple_notify_error(gtkconv, NULL, _("Unable to open file."), NULL); |
2488 return; | 2488 return; |
2489 } | 2489 } |
2490 | 2490 |
2491 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | 2491 icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
2492 data = gaim_buddy_icon_get_data(icon, &len); | 2492 data = purple_buddy_icon_get_data(icon, &len); |
2493 | 2493 |
2494 if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != len)) { | 2494 if ((len <= 0) || (data == NULL) || (fwrite(data, 1, len, fp) != len)) { |
2495 gaim_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL); | 2495 purple_notify_error(gtkconv, NULL, _("Unable to save icon file to disk."), NULL); |
2496 fclose(fp); | 2496 fclose(fp); |
2497 g_unlink(filename); | 2497 g_unlink(filename); |
2498 return; | 2498 return; |
2499 } | 2499 } |
2500 fclose(fp); | 2500 fclose(fp); |
2501 } | 2501 } |
2502 | 2502 |
2503 static const char * | 2503 static const char * |
2504 custom_icon_pref_name(PidginConversation *gtkconv) | 2504 custom_icon_pref_name(PidginConversation *gtkconv) |
2505 { | 2505 { |
2506 GaimConversation *conv; | 2506 PurpleConversation *conv; |
2507 GaimAccount *account; | 2507 PurpleAccount *account; |
2508 GaimBuddy *buddy; | 2508 PurpleBuddy *buddy; |
2509 | 2509 |
2510 conv = gtkconv->active_conv; | 2510 conv = gtkconv->active_conv; |
2511 account = gaim_conversation_get_account(conv); | 2511 account = purple_conversation_get_account(conv); |
2512 buddy = gaim_find_buddy(account, gaim_conversation_get_name(conv)); | 2512 buddy = purple_find_buddy(account, purple_conversation_get_name(conv)); |
2513 if (buddy) { | 2513 if (buddy) { |
2514 GaimContact *contact = gaim_buddy_get_contact(buddy); | 2514 PurpleContact *contact = purple_buddy_get_contact(buddy); |
2515 return gaim_blist_node_get_string((GaimBlistNode*)contact, "custom_buddy_icon"); | 2515 return purple_blist_node_get_string((PurpleBlistNode*)contact, "custom_buddy_icon"); |
2516 } | 2516 } |
2517 return NULL; | 2517 return NULL; |
2518 } | 2518 } |
2519 | 2519 |
2520 static void | 2520 static void |
2521 custom_icon_sel_cb(const char *filename, gpointer data) | 2521 custom_icon_sel_cb(const char *filename, gpointer data) |
2522 { | 2522 { |
2523 if (filename) { | 2523 if (filename) { |
2524 PidginConversation *gtkconv = data; | 2524 PidginConversation *gtkconv = data; |
2525 GaimConversation *conv = gtkconv->active_conv; | 2525 PurpleConversation *conv = gtkconv->active_conv; |
2526 GaimAccount *account = gaim_conversation_get_account(conv); | 2526 PurpleAccount *account = purple_conversation_get_account(conv); |
2527 pidgin_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), filename); | 2527 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), filename); |
2528 } | 2528 } |
2529 } | 2529 } |
2530 | 2530 |
2531 static void | 2531 static void |
2532 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv) | 2532 set_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv) |
2537 } | 2537 } |
2538 | 2538 |
2539 static void | 2539 static void |
2540 remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv) | 2540 remove_custom_icon_cb(GtkWidget *widget, PidginConversation *gtkconv) |
2541 { | 2541 { |
2542 GaimConversation *conv; | 2542 PurpleConversation *conv; |
2543 GaimAccount *account; | 2543 PurpleAccount *account; |
2544 | 2544 |
2545 conv = gtkconv->active_conv; | 2545 conv = gtkconv->active_conv; |
2546 account = gaim_conversation_get_account(conv); | 2546 account = purple_conversation_get_account(conv); |
2547 pidgin_set_custom_buddy_icon(account, gaim_conversation_get_name(conv), NULL); | 2547 pidgin_set_custom_buddy_icon(account, purple_conversation_get_name(conv), NULL); |
2548 } | 2548 } |
2549 | 2549 |
2550 static void | 2550 static void |
2551 icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) | 2551 icon_menu_save_cb(GtkWidget *widget, PidginConversation *gtkconv) |
2552 { | 2552 { |
2553 GaimConversation *conv = gtkconv->active_conv; | 2553 PurpleConversation *conv = gtkconv->active_conv; |
2554 const gchar *ext; | 2554 const gchar *ext; |
2555 gchar *buf; | 2555 gchar *buf; |
2556 | 2556 |
2557 g_return_if_fail(conv != NULL); | 2557 g_return_if_fail(conv != NULL); |
2558 | 2558 |
2559 ext = gaim_buddy_icon_get_type(gaim_conv_im_get_icon(GAIM_CONV_IM(conv))); | 2559 ext = purple_buddy_icon_get_type(purple_conv_im_get_icon(PURPLE_CONV_IM(conv))); |
2560 if (ext == NULL) | 2560 if (ext == NULL) |
2561 ext = "icon"; | 2561 ext = "icon"; |
2562 | 2562 |
2563 buf = g_strdup_printf("%s.%s", gaim_normalize(conv->account, conv->name), ext); | 2563 buf = g_strdup_printf("%s.%s", purple_normalize(conv->account, conv->name), ext); |
2564 | 2564 |
2565 gaim_request_file(gtkconv, _("Save Icon"), buf, TRUE, | 2565 purple_request_file(gtkconv, _("Save Icon"), buf, TRUE, |
2566 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); | 2566 G_CALLBACK(saveicon_writefile_cb), NULL, gtkconv); |
2567 | 2567 |
2568 g_free(buf); | 2568 g_free(buf); |
2569 } | 2569 } |
2570 | 2570 |
2642 | 2642 |
2643 static void | 2643 static void |
2644 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget) | 2644 menu_buddyicon_cb(gpointer data, guint action, GtkWidget *widget) |
2645 { | 2645 { |
2646 PidginWindow *win = data; | 2646 PidginWindow *win = data; |
2647 GaimConversation *conv; | 2647 PurpleConversation *conv; |
2648 PidginConversation *gtkconv; | 2648 PidginConversation *gtkconv; |
2649 gboolean active; | 2649 gboolean active; |
2650 | 2650 |
2651 conv = pidgin_conv_window_get_active_conversation(win); | 2651 conv = pidgin_conv_window_get_active_conversation(win); |
2652 | 2652 |
2653 if (!conv) | 2653 if (!conv) |
2654 return; | 2654 return; |
2655 | 2655 |
2656 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); | 2656 g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM); |
2657 | 2657 |
2658 gtkconv = PIDGIN_CONVERSATION(conv); | 2658 gtkconv = PIDGIN_CONVERSATION(conv); |
2659 | 2659 |
2660 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); | 2660 active = gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(widget)); |
2661 gtkconv->u.im->show_icon = active; | 2661 gtkconv->u.im->show_icon = active; |
2667 | 2667 |
2668 /************************************************************************** | 2668 /************************************************************************** |
2669 * End of the bunch of buddy icon functions | 2669 * End of the bunch of buddy icon functions |
2670 **************************************************************************/ | 2670 **************************************************************************/ |
2671 void | 2671 void |
2672 pidgin_conv_present_conversation(GaimConversation *conv) | 2672 pidgin_conv_present_conversation(PurpleConversation *conv) |
2673 { | 2673 { |
2674 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 2674 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
2675 | 2675 |
2676 if(gtkconv->win==hidden_convwin) { | 2676 if(gtkconv->win==hidden_convwin) { |
2677 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); | 2677 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
2682 pidgin_conv_window_switch_gtkconv(gtkconv->win, gtkconv); | 2682 pidgin_conv_window_switch_gtkconv(gtkconv->win, gtkconv); |
2683 gtk_window_present(GTK_WINDOW(gtkconv->win->window)); | 2683 gtk_window_present(GTK_WINDOW(gtkconv->win->window)); |
2684 } | 2684 } |
2685 | 2685 |
2686 GList * | 2686 GList * |
2687 pidgin_conversations_find_unseen_list(GaimConversationType type, | 2687 pidgin_conversations_find_unseen_list(PurpleConversationType type, |
2688 PidginUnseenState min_state, | 2688 PidginUnseenState min_state, |
2689 gboolean hidden_only, | 2689 gboolean hidden_only, |
2690 guint max_count) | 2690 guint max_count) |
2691 { | 2691 { |
2692 GList *l; | 2692 GList *l; |
2693 GList *r = NULL; | 2693 GList *r = NULL; |
2694 guint c = 0; | 2694 guint c = 0; |
2695 | 2695 |
2696 if (type == GAIM_CONV_TYPE_IM) { | 2696 if (type == PURPLE_CONV_TYPE_IM) { |
2697 l = gaim_get_ims(); | 2697 l = purple_get_ims(); |
2698 } else if (type == GAIM_CONV_TYPE_CHAT) { | 2698 } else if (type == PURPLE_CONV_TYPE_CHAT) { |
2699 l = gaim_get_chats(); | 2699 l = purple_get_chats(); |
2700 } else { | 2700 } else { |
2701 l = gaim_get_conversations(); | 2701 l = purple_get_conversations(); |
2702 } | 2702 } |
2703 | 2703 |
2704 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) { | 2704 for (; l != NULL && (max_count == 0 || c < max_count); l = l->next) { |
2705 GaimConversation *conv = (GaimConversation*)l->data; | 2705 PurpleConversation *conv = (PurpleConversation*)l->data; |
2706 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 2706 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
2707 | 2707 |
2708 if(gtkconv->active_conv != conv) | 2708 if(gtkconv->active_conv != conv) |
2709 continue; | 2709 continue; |
2710 | 2710 |
2719 | 2719 |
2720 return r; | 2720 return r; |
2721 } | 2721 } |
2722 | 2722 |
2723 static void | 2723 static void |
2724 unseen_conv_menu_cb(GtkMenuItem *item, GaimConversation *conv) | 2724 unseen_conv_menu_cb(GtkMenuItem *item, PurpleConversation *conv) |
2725 { | 2725 { |
2726 g_return_if_fail(conv != NULL); | 2726 g_return_if_fail(conv != NULL); |
2727 pidgin_conv_present_conversation(conv); | 2727 pidgin_conv_present_conversation(conv); |
2728 } | 2728 } |
2729 | 2729 |
2735 | 2735 |
2736 g_return_val_if_fail(menu != NULL, 0); | 2736 g_return_val_if_fail(menu != NULL, 0); |
2737 g_return_val_if_fail(convs != NULL, 0); | 2737 g_return_val_if_fail(convs != NULL, 0); |
2738 | 2738 |
2739 for (l = convs; l != NULL ; l = l->next) { | 2739 for (l = convs; l != NULL ; l = l->next) { |
2740 GaimConversation *conv = (GaimConversation*)l->data; | 2740 PurpleConversation *conv = (PurpleConversation*)l->data; |
2741 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 2741 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
2742 | 2742 |
2743 GtkWidget *icon = gtk_image_new(); | 2743 GtkWidget *icon = gtk_image_new(); |
2744 GdkPixbuf *pbuf = pidgin_conv_get_tab_icon(conv, TRUE); | 2744 GdkPixbuf *pbuf = pidgin_conv_get_tab_icon(conv, TRUE); |
2745 GtkWidget *item; | 2745 GtkWidget *item; |
2832 { | 2832 { |
2833 return _(path); | 2833 return _(path); |
2834 } | 2834 } |
2835 | 2835 |
2836 static void | 2836 static void |
2837 sound_method_pref_changed_cb(const char *name, GaimPrefType type, | 2837 sound_method_pref_changed_cb(const char *name, PurplePrefType type, |
2838 gconstpointer value, gpointer data) | 2838 gconstpointer value, gpointer data) |
2839 { | 2839 { |
2840 PidginWindow *win = data; | 2840 PidginWindow *win = data; |
2841 const char *method = value; | 2841 const char *method = value; |
2842 | 2842 |
2857 | 2857 |
2858 } | 2858 } |
2859 } | 2859 } |
2860 | 2860 |
2861 static void | 2861 static void |
2862 show_buddy_icons_pref_changed_cb(const char *name, GaimPrefType type, | 2862 show_buddy_icons_pref_changed_cb(const char *name, PurplePrefType type, |
2863 gconstpointer value, gpointer data) | 2863 gconstpointer value, gpointer data) |
2864 { | 2864 { |
2865 PidginWindow *win = data; | 2865 PidginWindow *win = data; |
2866 gboolean show_icons = GPOINTER_TO_INT(value); | 2866 gboolean show_icons = GPOINTER_TO_INT(value); |
2867 | 2867 |
2887 regenerate_options_items(PidginWindow *win) | 2887 regenerate_options_items(PidginWindow *win) |
2888 { | 2888 { |
2889 GtkWidget *menu; | 2889 GtkWidget *menu; |
2890 GList *list; | 2890 GList *list; |
2891 PidginConversation *gtkconv; | 2891 PidginConversation *gtkconv; |
2892 GaimConversation *conv; | 2892 PurpleConversation *conv; |
2893 GaimBuddy *buddy; | 2893 PurpleBuddy *buddy; |
2894 | 2894 |
2895 gtkconv = pidgin_conv_window_get_active_gtkconv(win); | 2895 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
2896 conv = gtkconv->active_conv; | 2896 conv = gtkconv->active_conv; |
2897 buddy = gaim_find_buddy(conv->account, conv->name); | 2897 buddy = purple_find_buddy(conv->account, conv->name); |
2898 | 2898 |
2899 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); | 2899 menu = gtk_item_factory_get_widget(win->menu.item_factory, N_("/Conversation/More")); |
2900 | 2900 |
2901 /* Remove the previous entries */ | 2901 /* Remove the previous entries */ |
2902 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) | 2902 for (list = gtk_container_get_children(GTK_CONTAINER(menu)); list; ) |
2907 } | 2907 } |
2908 | 2908 |
2909 /* Now add the stuff */ | 2909 /* Now add the stuff */ |
2910 if (buddy) | 2910 if (buddy) |
2911 { | 2911 { |
2912 if (gaim_account_is_connected(conv->account)) | 2912 if (purple_account_is_connected(conv->account)) |
2913 pidgin_append_blist_node_proto_menu(menu, conv->account->gc, | 2913 pidgin_append_blist_node_proto_menu(menu, conv->account->gc, |
2914 (GaimBlistNode *)buddy); | 2914 (PurpleBlistNode *)buddy); |
2915 pidgin_append_blist_node_extended_menu(menu, (GaimBlistNode *)buddy); | 2915 pidgin_append_blist_node_extended_menu(menu, (PurpleBlistNode *)buddy); |
2916 } | 2916 } |
2917 | 2917 |
2918 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) | 2918 if ((list = gtk_container_get_children(GTK_CONTAINER(menu))) == NULL) |
2919 { | 2919 { |
2920 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available")); | 2920 GtkWidget *item = gtk_menu_item_new_with_label(_("No actions available")); |
3029 gtk_item_factory_get_widget(win->menu.item_factory, | 3029 gtk_item_factory_get_widget(win->menu.item_factory, |
3030 N_("/Options/Enable Logging")); | 3030 N_("/Options/Enable Logging")); |
3031 win->menu.sounds = | 3031 win->menu.sounds = |
3032 gtk_item_factory_get_widget(win->menu.item_factory, | 3032 gtk_item_factory_get_widget(win->menu.item_factory, |
3033 N_("/Options/Enable Sounds")); | 3033 N_("/Options/Enable Sounds")); |
3034 method = gaim_prefs_get_string("/gaim/gtk/sound/method"); | 3034 method = purple_prefs_get_string("/purple/gtk/sound/method"); |
3035 if (!strcmp(method, "none")) | 3035 if (!strcmp(method, "none")) |
3036 { | 3036 { |
3037 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), | 3037 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
3038 FALSE); | 3038 FALSE); |
3039 gtk_widget_set_sensitive(win->menu.sounds, FALSE); | 3039 gtk_widget_set_sensitive(win->menu.sounds, FALSE); |
3040 } | 3040 } |
3041 gaim_prefs_connect_callback(win, "/gaim/gtk/sound/method", | 3041 purple_prefs_connect_callback(win, "/purple/gtk/sound/method", |
3042 sound_method_pref_changed_cb, win); | 3042 sound_method_pref_changed_cb, win); |
3043 | 3043 |
3044 win->menu.show_formatting_toolbar = | 3044 win->menu.show_formatting_toolbar = |
3045 gtk_item_factory_get_widget(win->menu.item_factory, | 3045 gtk_item_factory_get_widget(win->menu.item_factory, |
3046 N_("/Options/Show Formatting Toolbars")); | 3046 N_("/Options/Show Formatting Toolbars")); |
3048 gtk_item_factory_get_widget(win->menu.item_factory, | 3048 gtk_item_factory_get_widget(win->menu.item_factory, |
3049 N_("/Options/Show Timestamps")); | 3049 N_("/Options/Show Timestamps")); |
3050 win->menu.show_icon = | 3050 win->menu.show_icon = |
3051 gtk_item_factory_get_widget(win->menu.item_factory, | 3051 gtk_item_factory_get_widget(win->menu.item_factory, |
3052 N_("/Options/Show Buddy Icon")); | 3052 N_("/Options/Show Buddy Icon")); |
3053 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) | 3053 if (!purple_prefs_get_bool("/purple/gtk/conversations/im/show_buddy_icons")) |
3054 { | 3054 { |
3055 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), | 3055 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), |
3056 FALSE); | 3056 FALSE); |
3057 gtk_widget_set_sensitive(win->menu.show_icon, FALSE); | 3057 gtk_widget_set_sensitive(win->menu.show_icon, FALSE); |
3058 } | 3058 } |
3059 gaim_prefs_connect_callback(win, "/gaim/gtk/conversations/im/show_buddy_icons", | 3059 purple_prefs_connect_callback(win, "/purple/gtk/conversations/im/show_buddy_icons", |
3060 show_buddy_icons_pref_changed_cb, win); | 3060 show_buddy_icons_pref_changed_cb, win); |
3061 | 3061 |
3062 win->menu.tray = pidgin_menu_tray_new(); | 3062 win->menu.tray = pidgin_menu_tray_new(); |
3063 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), | 3063 gtk_menu_shell_append(GTK_MENU_SHELL(win->menu.menubar), |
3064 win->menu.tray); | 3064 win->menu.tray); |
3075 **************************************************************************/ | 3075 **************************************************************************/ |
3076 | 3076 |
3077 static void | 3077 static void |
3078 got_typing_keypress(PidginConversation *gtkconv, gboolean first) | 3078 got_typing_keypress(PidginConversation *gtkconv, gboolean first) |
3079 { | 3079 { |
3080 GaimConversation *conv = gtkconv->active_conv; | 3080 PurpleConversation *conv = gtkconv->active_conv; |
3081 GaimConvIm *im; | 3081 PurpleConvIm *im; |
3082 | 3082 |
3083 /* | 3083 /* |
3084 * We know we got something, so we at least have to make sure we don't | 3084 * We know we got something, so we at least have to make sure we don't |
3085 * send GAIM_TYPED any time soon. | 3085 * send PURPLE_TYPED any time soon. |
3086 */ | 3086 */ |
3087 | 3087 |
3088 im = GAIM_CONV_IM(conv); | 3088 im = PURPLE_CONV_IM(conv); |
3089 | 3089 |
3090 gaim_conv_im_stop_send_typed_timeout(im); | 3090 purple_conv_im_stop_send_typed_timeout(im); |
3091 gaim_conv_im_start_send_typed_timeout(im); | 3091 purple_conv_im_start_send_typed_timeout(im); |
3092 | 3092 |
3093 /* Check if we need to send another GAIM_TYPING message */ | 3093 /* Check if we need to send another PURPLE_TYPING message */ |
3094 if (first || (gaim_conv_im_get_type_again(im) != 0 && | 3094 if (first || (purple_conv_im_get_type_again(im) != 0 && |
3095 time(NULL) > gaim_conv_im_get_type_again(im))) | 3095 time(NULL) > purple_conv_im_get_type_again(im))) |
3096 { | 3096 { |
3097 unsigned int timeout; | 3097 unsigned int timeout; |
3098 timeout = serv_send_typing(gaim_conversation_get_gc(conv), | 3098 timeout = serv_send_typing(purple_conversation_get_gc(conv), |
3099 gaim_conversation_get_name(conv), | 3099 purple_conversation_get_name(conv), |
3100 GAIM_TYPING); | 3100 PURPLE_TYPING); |
3101 gaim_conv_im_set_type_again(im, timeout); | 3101 purple_conv_im_set_type_again(im, timeout); |
3102 } | 3102 } |
3103 } | 3103 } |
3104 | 3104 |
3105 static gboolean | 3105 static gboolean |
3106 typing_animation(gpointer data) { | 3106 typing_animation(gpointer data) { |
3138 | 3138 |
3139 static void | 3139 static void |
3140 update_typing_icon(PidginConversation *gtkconv) | 3140 update_typing_icon(PidginConversation *gtkconv) |
3141 { | 3141 { |
3142 PidginWindow *gtkwin; | 3142 PidginWindow *gtkwin; |
3143 GaimConvIm *im = NULL; | 3143 PurpleConvIm *im = NULL; |
3144 GaimConversation *conv = gtkconv->active_conv; | 3144 PurpleConversation *conv = gtkconv->active_conv; |
3145 char *stock_id; | 3145 char *stock_id; |
3146 const char *tooltip; | 3146 const char *tooltip; |
3147 | 3147 |
3148 gtkwin = gtkconv->win; | 3148 gtkwin = gtkconv->win; |
3149 | 3149 |
3150 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 3150 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
3151 im = GAIM_CONV_IM(conv); | 3151 im = PURPLE_CONV_IM(conv); |
3152 | 3152 |
3153 if (gtkwin->menu.typing_icon) { | 3153 if (gtkwin->menu.typing_icon) { |
3154 gtk_widget_hide(gtkwin->menu.typing_icon); | 3154 gtk_widget_hide(gtkwin->menu.typing_icon); |
3155 } | 3155 } |
3156 | 3156 |
3157 if (!im || (gaim_conv_im_get_typing_state(im) == GAIM_NOT_TYPING)) { | 3157 if (!im || (purple_conv_im_get_typing_state(im) == PURPLE_NOT_TYPING)) { |
3158 if (gtkconv->u.im->typing_timer != 0) | 3158 if (gtkconv->u.im->typing_timer != 0) |
3159 g_source_remove(gtkconv->u.im->typing_timer); | 3159 g_source_remove(gtkconv->u.im->typing_timer); |
3160 return; | 3160 return; |
3161 } | 3161 } |
3162 | 3162 |
3163 if (gaim_conv_im_get_typing_state(im) == GAIM_TYPING) { | 3163 if (purple_conv_im_get_typing_state(im) == PURPLE_TYPING) { |
3164 if (gtkconv->u.im->typing_timer == 0) { | 3164 if (gtkconv->u.im->typing_timer == 0) { |
3165 gtkconv->u.im->typing_timer = g_timeout_add(250, typing_animation, gtkconv); | 3165 gtkconv->u.im->typing_timer = g_timeout_add(250, typing_animation, gtkconv); |
3166 } | 3166 } |
3167 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1; | 3167 stock_id = PIDGIN_STOCK_ANIMATION_TYPING1; |
3168 tooltip = _("User is typing..."); | 3168 tooltip = _("User is typing..."); |
3192 } | 3192 } |
3193 | 3193 |
3194 static gboolean | 3194 static gboolean |
3195 update_send_to_selection(PidginWindow *win) | 3195 update_send_to_selection(PidginWindow *win) |
3196 { | 3196 { |
3197 GaimAccount *account; | 3197 PurpleAccount *account; |
3198 GaimConversation *conv; | 3198 PurpleConversation *conv; |
3199 GtkWidget *menu; | 3199 GtkWidget *menu; |
3200 GList *child; | 3200 GList *child; |
3201 GaimBuddy *b; | 3201 PurpleBuddy *b; |
3202 | 3202 |
3203 conv = pidgin_conv_window_get_active_conversation(win); | 3203 conv = pidgin_conv_window_get_active_conversation(win); |
3204 | 3204 |
3205 if (conv == NULL) | 3205 if (conv == NULL) |
3206 return FALSE; | 3206 return FALSE; |
3207 | 3207 |
3208 account = gaim_conversation_get_account(conv); | 3208 account = purple_conversation_get_account(conv); |
3209 | 3209 |
3210 if (account == NULL) | 3210 if (account == NULL) |
3211 return FALSE; | 3211 return FALSE; |
3212 | 3212 |
3213 if (win->menu.send_to == NULL) | 3213 if (win->menu.send_to == NULL) |
3214 return FALSE; | 3214 return FALSE; |
3215 | 3215 |
3216 if (!(b = gaim_find_buddy(account, conv->name))) | 3216 if (!(b = purple_find_buddy(account, conv->name))) |
3217 return FALSE; | 3217 return FALSE; |
3218 | 3218 |
3219 | 3219 |
3220 gtk_widget_show(win->menu.send_to); | 3220 gtk_widget_show(win->menu.send_to); |
3221 | 3221 |
3225 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); | 3225 for (child = gtk_container_get_children(GTK_CONTAINER(menu)); |
3226 child != NULL; | 3226 child != NULL; |
3227 child = child->next) { | 3227 child = child->next) { |
3228 | 3228 |
3229 GtkWidget *item = child->data; | 3229 GtkWidget *item = child->data; |
3230 GaimBuddy *item_buddy; | 3230 PurpleBuddy *item_buddy; |
3231 GaimAccount *item_account = g_object_get_data(G_OBJECT(item), "gaim_account"); | 3231 PurpleAccount *item_account = g_object_get_data(G_OBJECT(item), "purple_account"); |
3232 gchar *buddy_name = g_object_get_data(G_OBJECT(item), | 3232 gchar *buddy_name = g_object_get_data(G_OBJECT(item), |
3233 "gaim_buddy_name"); | 3233 "purple_buddy_name"); |
3234 item_buddy = gaim_find_buddy(item_account, buddy_name); | 3234 item_buddy = purple_find_buddy(item_account, buddy_name); |
3235 | 3235 |
3236 if (b == item_buddy) { | 3236 if (b == item_buddy) { |
3237 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); | 3237 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(item), TRUE); |
3238 break; | 3238 break; |
3239 } | 3239 } |
3255 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); | 3255 gtk_widget_set_sensitive(GTK_WIDGET(label), FALSE); |
3256 return FALSE; | 3256 return FALSE; |
3257 } | 3257 } |
3258 | 3258 |
3259 static void | 3259 static void |
3260 create_sendto_item(GtkWidget *menu, GtkSizeGroup *sg, GSList **group, GaimBuddy *buddy, GaimAccount *account, const char *name) | 3260 create_sendto_item(GtkWidget *menu, GtkSizeGroup *sg, GSList **group, PurpleBuddy *buddy, PurpleAccount *account, const char *name) |
3261 { | 3261 { |
3262 GtkWidget *box; | 3262 GtkWidget *box; |
3263 GtkWidget *label; | 3263 GtkWidget *label; |
3264 GtkWidget *image; | 3264 GtkWidget *image; |
3265 GtkWidget *menuitem; | 3265 GtkWidget *menuitem; |
3279 } | 3279 } |
3280 | 3280 |
3281 gtk_size_group_add_widget(sg, image); | 3281 gtk_size_group_add_widget(sg, image); |
3282 | 3282 |
3283 /* Make our menu item */ | 3283 /* Make our menu item */ |
3284 text = g_strdup_printf("%s (%s)", name, gaim_account_get_username(account)); | 3284 text = g_strdup_printf("%s (%s)", name, purple_account_get_username(account)); |
3285 menuitem = gtk_radio_menu_item_new_with_label(*group, text); | 3285 menuitem = gtk_radio_menu_item_new_with_label(*group, text); |
3286 g_free(text); | 3286 g_free(text); |
3287 *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); | 3287 *group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM(menuitem)); |
3288 | 3288 |
3289 /* Do some evil, see some evil, speak some evil. */ | 3289 /* Do some evil, see some evil, speak some evil. */ |
3295 | 3295 |
3296 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); | 3296 gtk_box_pack_start(GTK_BOX(box), image, FALSE, FALSE, 0); |
3297 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); | 3297 gtk_box_pack_start(GTK_BOX(box), label, TRUE, TRUE, 4); |
3298 | 3298 |
3299 if (buddy != NULL && | 3299 if (buddy != NULL && |
3300 !gaim_presence_is_online(gaim_buddy_get_presence(buddy)) && | 3300 !purple_presence_is_online(purple_buddy_get_presence(buddy)) && |
3301 !gaim_account_supports_offline_message(account, buddy)) | 3301 !purple_account_supports_offline_message(account, buddy)) |
3302 { | 3302 { |
3303 gtk_widget_set_sensitive(label, FALSE); | 3303 gtk_widget_set_sensitive(label, FALSE); |
3304 | 3304 |
3305 /* Set the label sensitive when the menuitem is highlighted and | 3305 /* Set the label sensitive when the menuitem is highlighted and |
3306 * insensitive again when the mouse leaves it. This way, it | 3306 * insensitive again when the mouse leaves it. This way, it |
3319 gtk_widget_show(label); | 3319 gtk_widget_show(label); |
3320 gtk_widget_show(image); | 3320 gtk_widget_show(image); |
3321 gtk_widget_show(box); | 3321 gtk_widget_show(box); |
3322 | 3322 |
3323 /* Set our data and callbacks. */ | 3323 /* Set our data and callbacks. */ |
3324 g_object_set_data(G_OBJECT(menuitem), "gaim_account", account); | 3324 g_object_set_data(G_OBJECT(menuitem), "purple_account", account); |
3325 g_object_set_data_full(G_OBJECT(menuitem), "gaim_buddy_name", g_strdup(name), g_free); | 3325 g_object_set_data_full(G_OBJECT(menuitem), "purple_buddy_name", g_strdup(name), g_free); |
3326 | 3326 |
3327 g_signal_connect(G_OBJECT(menuitem), "activate", | 3327 g_signal_connect(G_OBJECT(menuitem), "activate", |
3328 G_CALLBACK(menu_conv_sel_send_cb), NULL); | 3328 G_CALLBACK(menu_conv_sel_send_cb), NULL); |
3329 | 3329 |
3330 gtk_widget_show(menuitem); | 3330 gtk_widget_show(menuitem); |
3358 win->menu.send_to, 2); | 3358 win->menu.send_to, 2); |
3359 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu); | 3359 gtk_menu_item_set_submenu(GTK_MENU_ITEM(win->menu.send_to), menu); |
3360 | 3360 |
3361 gtk_widget_show(menu); | 3361 gtk_widget_show(menu); |
3362 | 3362 |
3363 if (gtkconv->active_conv->type == GAIM_CONV_TYPE_IM) { | 3363 if (gtkconv->active_conv->type == PURPLE_CONV_TYPE_IM) { |
3364 buds = gaim_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); | 3364 buds = purple_find_buddies(gtkconv->active_conv->account, gtkconv->active_conv->name); |
3365 | 3365 |
3366 if (buds == NULL) | 3366 if (buds == NULL) |
3367 { | 3367 { |
3368 /* The user isn't on the buddy list. */ | 3368 /* The user isn't on the buddy list. */ |
3369 create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name); | 3369 create_sendto_item(menu, sg, &group, NULL, gtkconv->active_conv->account, gtkconv->active_conv->name); |
3371 else | 3371 else |
3372 { | 3372 { |
3373 GList *list = NULL, *iter; | 3373 GList *list = NULL, *iter; |
3374 for (l = buds; l != NULL; l = l->next) | 3374 for (l = buds; l != NULL; l = l->next) |
3375 { | 3375 { |
3376 GaimBlistNode *node; | 3376 PurpleBlistNode *node; |
3377 | 3377 |
3378 node = (GaimBlistNode *) gaim_buddy_get_contact((GaimBuddy *)l->data); | 3378 node = (PurpleBlistNode *) purple_buddy_get_contact((PurpleBuddy *)l->data); |
3379 | 3379 |
3380 for (node = node->child; node != NULL; node = node->next) | 3380 for (node = node->child; node != NULL; node = node->next) |
3381 { | 3381 { |
3382 GaimBuddy *buddy = (GaimBuddy *)node; | 3382 PurpleBuddy *buddy = (PurpleBuddy *)node; |
3383 GaimAccount *account; | 3383 PurpleAccount *account; |
3384 | 3384 |
3385 if (!GAIM_BLIST_NODE_IS_BUDDY(node)) | 3385 if (!PURPLE_BLIST_NODE_IS_BUDDY(node)) |
3386 continue; | 3386 continue; |
3387 | 3387 |
3388 account = gaim_buddy_get_account(buddy); | 3388 account = purple_buddy_get_account(buddy); |
3389 if (gaim_account_is_connected(account)) | 3389 if (purple_account_is_connected(account)) |
3390 { | 3390 { |
3391 /* Use the GaimPresence to get unique buddies. */ | 3391 /* Use the PurplePresence to get unique buddies. */ |
3392 GaimPresence *presence = gaim_buddy_get_presence(buddy); | 3392 PurplePresence *presence = purple_buddy_get_presence(buddy); |
3393 if (!g_list_find(list, presence)) | 3393 if (!g_list_find(list, presence)) |
3394 list = g_list_prepend(list, presence); | 3394 list = g_list_prepend(list, presence); |
3395 } | 3395 } |
3396 } | 3396 } |
3397 } | 3397 } |
3398 | 3398 |
3399 /* Loop over the list backwards so we get the items in the right order, | 3399 /* Loop over the list backwards so we get the items in the right order, |
3400 * since we did a g_list_prepend() earlier. */ | 3400 * since we did a g_list_prepend() earlier. */ |
3401 for (iter = g_list_last(list); iter != NULL; iter = iter->prev) | 3401 for (iter = g_list_last(list); iter != NULL; iter = iter->prev) |
3402 { | 3402 { |
3403 GaimPresence *pre = iter->data; | 3403 PurplePresence *pre = iter->data; |
3404 GaimBuddy *buddy = gaim_presence_get_buddies(pre)->data; | 3404 PurpleBuddy *buddy = purple_presence_get_buddies(pre)->data; |
3405 create_sendto_item(menu, sg, &group, buddy, | 3405 create_sendto_item(menu, sg, &group, buddy, |
3406 gaim_buddy_get_account(buddy), gaim_buddy_get_name(buddy)); | 3406 purple_buddy_get_account(buddy), purple_buddy_get_name(buddy)); |
3407 } | 3407 } |
3408 g_list_free(list); | 3408 g_list_free(list); |
3409 g_slist_free(buds); | 3409 g_slist_free(buds); |
3410 } | 3410 } |
3411 } | 3411 } |
3418 gtk_widget_set_sensitive(win->menu.send_to, FALSE); | 3418 gtk_widget_set_sensitive(win->menu.send_to, FALSE); |
3419 update_send_to_selection(win); | 3419 update_send_to_selection(win); |
3420 } | 3420 } |
3421 | 3421 |
3422 static GList * | 3422 static GList * |
3423 generate_invite_user_names(GaimConnection *gc) | 3423 generate_invite_user_names(PurpleConnection *gc) |
3424 { | 3424 { |
3425 GaimBlistNode *gnode,*cnode,*bnode; | 3425 PurpleBlistNode *gnode,*cnode,*bnode; |
3426 static GList *tmp = NULL; | 3426 static GList *tmp = NULL; |
3427 | 3427 |
3428 g_list_free(tmp); | 3428 g_list_free(tmp); |
3429 | 3429 |
3430 tmp = g_list_append(NULL, ""); | 3430 tmp = g_list_append(NULL, ""); |
3431 | 3431 |
3432 if (gc != NULL) { | 3432 if (gc != NULL) { |
3433 for(gnode = gaim_get_blist()->root; gnode; gnode = gnode->next) { | 3433 for(gnode = purple_get_blist()->root; gnode; gnode = gnode->next) { |
3434 if(!GAIM_BLIST_NODE_IS_GROUP(gnode)) | 3434 if(!PURPLE_BLIST_NODE_IS_GROUP(gnode)) |
3435 continue; | 3435 continue; |
3436 for(cnode = gnode->child; cnode; cnode = cnode->next) { | 3436 for(cnode = gnode->child; cnode; cnode = cnode->next) { |
3437 if(!GAIM_BLIST_NODE_IS_CONTACT(cnode)) | 3437 if(!PURPLE_BLIST_NODE_IS_CONTACT(cnode)) |
3438 continue; | 3438 continue; |
3439 for(bnode = cnode->child; bnode; bnode = bnode->next) { | 3439 for(bnode = cnode->child; bnode; bnode = bnode->next) { |
3440 GaimBuddy *buddy; | 3440 PurpleBuddy *buddy; |
3441 | 3441 |
3442 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | 3442 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
3443 continue; | 3443 continue; |
3444 | 3444 |
3445 buddy = (GaimBuddy *)bnode; | 3445 buddy = (PurpleBuddy *)bnode; |
3446 | 3446 |
3447 if (buddy->account == gc->account && | 3447 if (buddy->account == gc->account && |
3448 GAIM_BUDDY_IS_ONLINE(buddy)) | 3448 PURPLE_BUDDY_IS_ONLINE(buddy)) |
3449 tmp = g_list_insert_sorted(tmp, buddy->name, | 3449 tmp = g_list_insert_sorted(tmp, buddy->name, |
3450 (GCompareFunc)g_utf8_collate); | 3450 (GCompareFunc)g_utf8_collate); |
3451 } | 3451 } |
3452 } | 3452 } |
3453 } | 3453 } |
3455 | 3455 |
3456 return tmp; | 3456 return tmp; |
3457 } | 3457 } |
3458 | 3458 |
3459 static GdkPixbuf * | 3459 static GdkPixbuf * |
3460 get_chat_buddy_status_icon(GaimConvChat *chat, const char *name, GaimConvChatBuddyFlags flags) | 3460 get_chat_buddy_status_icon(PurpleConvChat *chat, const char *name, PurpleConvChatBuddyFlags flags) |
3461 { | 3461 { |
3462 PidginConversation *gtkconv = PIDGIN_CONVERSATION(chat->conv); | 3462 PidginConversation *gtkconv = PIDGIN_CONVERSATION(chat->conv); |
3463 GdkPixbuf *pixbuf, *scale, *scale2; | 3463 GdkPixbuf *pixbuf, *scale, *scale2; |
3464 char *filename; | 3464 char *filename; |
3465 const char *image = NULL; | 3465 const char *image = NULL; |
3466 | 3466 |
3467 if (flags & GAIM_CBFLAGS_FOUNDER) { | 3467 if (flags & PURPLE_CBFLAGS_FOUNDER) { |
3468 image = PIDGIN_STOCK_STATUS_FOUNDER; | 3468 image = PIDGIN_STOCK_STATUS_FOUNDER; |
3469 } else if (flags & GAIM_CBFLAGS_OP) { | 3469 } else if (flags & PURPLE_CBFLAGS_OP) { |
3470 image = PIDGIN_STOCK_STATUS_OPERATOR; | 3470 image = PIDGIN_STOCK_STATUS_OPERATOR; |
3471 } else if (flags & GAIM_CBFLAGS_HALFOP) { | 3471 } else if (flags & PURPLE_CBFLAGS_HALFOP) { |
3472 image = PIDGIN_STOCK_STATUS_HALFOP; | 3472 image = PIDGIN_STOCK_STATUS_HALFOP; |
3473 } else if (flags & GAIM_CBFLAGS_VOICE) { | 3473 } else if (flags & PURPLE_CBFLAGS_VOICE) { |
3474 image = PIDGIN_STOCK_STATUS_VOICE; | 3474 image = PIDGIN_STOCK_STATUS_VOICE; |
3475 } else if ((!flags) && gaim_conv_chat_is_user_ignored(chat, name)) { | 3475 } else if ((!flags) && purple_conv_chat_is_user_ignored(chat, name)) { |
3476 image = PIDGIN_STOCK_STATUS_IGNORED; | 3476 image = PIDGIN_STOCK_STATUS_IGNORED; |
3477 } else { | 3477 } else { |
3478 return NULL; | 3478 return NULL; |
3479 } | 3479 } |
3480 | 3480 |
3485 return NULL; | 3485 return NULL; |
3486 | 3486 |
3487 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | 3487 scale = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); |
3488 g_object_unref(pixbuf); | 3488 g_object_unref(pixbuf); |
3489 | 3489 |
3490 if (flags && gaim_conv_chat_is_user_ignored(chat, name)) { | 3490 if (flags && purple_conv_chat_is_user_ignored(chat, name)) { |
3491 filename = g_build_filename(DATADIR, "pixmaps", "gaim", "status", "default", "ignored.png", NULL); | 3491 filename = g_build_filename(DATADIR, "pixmaps", "purple", "status", "default", "ignored.png", NULL); |
3492 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); | 3492 pixbuf = gdk_pixbuf_new_from_file(filename, NULL); |
3493 g_free(filename); | 3493 g_free(filename); |
3494 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); | 3494 scale2 = gdk_pixbuf_scale_simple(pixbuf, 15, 15, GDK_INTERP_BILINEAR); |
3495 g_object_unref(pixbuf); | 3495 g_object_unref(pixbuf); |
3496 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); | 3496 gdk_pixbuf_composite(scale2, scale, 0, 0, 15, 15, 0, 0, 1, 1, GDK_INTERP_BILINEAR, 192); |
3499 | 3499 |
3500 return scale; | 3500 return scale; |
3501 } | 3501 } |
3502 | 3502 |
3503 static void | 3503 static void |
3504 add_chat_buddy_common(GaimConversation *conv, GaimConvChatBuddy *cb, const char *old_name) | 3504 add_chat_buddy_common(PurpleConversation *conv, PurpleConvChatBuddy *cb, const char *old_name) |
3505 { | 3505 { |
3506 PidginConversation *gtkconv; | 3506 PidginConversation *gtkconv; |
3507 PidginChatPane *gtkchat; | 3507 PidginChatPane *gtkchat; |
3508 GaimConvChat *chat; | 3508 PurpleConvChat *chat; |
3509 GaimConnection *gc; | 3509 PurpleConnection *gc; |
3510 GaimPluginProtocolInfo *prpl_info; | 3510 PurplePluginProtocolInfo *prpl_info; |
3511 GtkListStore *ls; | 3511 GtkListStore *ls; |
3512 GdkPixbuf *pixbuf; | 3512 GdkPixbuf *pixbuf; |
3513 GtkTreeIter iter; | 3513 GtkTreeIter iter; |
3514 gboolean is_me = FALSE; | 3514 gboolean is_me = FALSE; |
3515 gboolean is_buddy; | 3515 gboolean is_buddy; |
3518 | 3518 |
3519 alias = cb->alias; | 3519 alias = cb->alias; |
3520 name = cb->name; | 3520 name = cb->name; |
3521 flags = GPOINTER_TO_INT(cb->flags); | 3521 flags = GPOINTER_TO_INT(cb->flags); |
3522 | 3522 |
3523 chat = GAIM_CONV_CHAT(conv); | 3523 chat = PURPLE_CONV_CHAT(conv); |
3524 gtkconv = PIDGIN_CONVERSATION(conv); | 3524 gtkconv = PIDGIN_CONVERSATION(conv); |
3525 gtkchat = gtkconv->u.chat; | 3525 gtkchat = gtkconv->u.chat; |
3526 gc = gaim_conversation_get_gc(conv); | 3526 gc = purple_conversation_get_gc(conv); |
3527 | 3527 |
3528 if (!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | 3528 if (!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) |
3529 return; | 3529 return; |
3530 | 3530 |
3531 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); | 3531 ls = GTK_LIST_STORE(gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list))); |
3532 | 3532 |
3533 pixbuf = get_chat_buddy_status_icon(chat, name, flags); | 3533 pixbuf = get_chat_buddy_status_icon(chat, name, flags); |
3534 | 3534 |
3535 if (!strcmp(chat->nick, gaim_normalize(conv->account, old_name != NULL ? old_name : name))) | 3535 if (!strcmp(chat->nick, purple_normalize(conv->account, old_name != NULL ? old_name : name))) |
3536 is_me = TRUE; | 3536 is_me = TRUE; |
3537 | 3537 |
3538 is_buddy = (gaim_find_buddy(conv->account, name) != NULL); | 3538 is_buddy = (purple_find_buddy(conv->account, name) != NULL); |
3539 | 3539 |
3540 tmp = g_utf8_casefold(alias, -1); | 3540 tmp = g_utf8_casefold(alias, -1); |
3541 alias_key = g_utf8_collate_key(tmp, -1); | 3541 alias_key = g_utf8_collate_key(tmp, -1); |
3542 g_free(tmp); | 3542 g_free(tmp); |
3543 | 3543 |
3613 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial, | 3613 tab_complete_process_item(int *most_matched, char *entered, char **partial, char *nick_partial, |
3614 GList **matches, gboolean command, char *name) | 3614 GList **matches, gboolean command, char *name) |
3615 { | 3615 { |
3616 strncpy(nick_partial, name, strlen(entered)); | 3616 strncpy(nick_partial, name, strlen(entered)); |
3617 nick_partial[strlen(entered)] = '\0'; | 3617 nick_partial[strlen(entered)] = '\0'; |
3618 if (gaim_utf8_strcasecmp(nick_partial, entered)) | 3618 if (purple_utf8_strcasecmp(nick_partial, entered)) |
3619 return; | 3619 return; |
3620 | 3620 |
3621 /* if we're here, it's a possible completion */ | 3621 /* if we're here, it's a possible completion */ |
3622 | 3622 |
3623 if (*most_matched == -1) { | 3623 if (*most_matched == -1) { |
3629 *partial = g_strdup(name); | 3629 *partial = g_strdup(name); |
3630 } | 3630 } |
3631 else if (*most_matched) { | 3631 else if (*most_matched) { |
3632 char *tmp = g_strdup(name); | 3632 char *tmp = g_strdup(name); |
3633 | 3633 |
3634 while (gaim_utf8_strcasecmp(tmp, *partial)) { | 3634 while (purple_utf8_strcasecmp(tmp, *partial)) { |
3635 (*partial)[*most_matched] = '\0'; | 3635 (*partial)[*most_matched] = '\0'; |
3636 if (*most_matched < strlen(tmp)) | 3636 if (*most_matched < strlen(tmp)) |
3637 tmp[*most_matched] = '\0'; | 3637 tmp[*most_matched] = '\0'; |
3638 (*most_matched)--; | 3638 (*most_matched)--; |
3639 } | 3639 } |
3641 | 3641 |
3642 g_free(tmp); | 3642 g_free(tmp); |
3643 } | 3643 } |
3644 | 3644 |
3645 *matches = g_list_insert_sorted(*matches, g_strdup(name), | 3645 *matches = g_list_insert_sorted(*matches, g_strdup(name), |
3646 (GCompareFunc)gaim_utf8_strcasecmp); | 3646 (GCompareFunc)purple_utf8_strcasecmp); |
3647 } | 3647 } |
3648 | 3648 |
3649 static gboolean | 3649 static gboolean |
3650 tab_complete(GaimConversation *conv) | 3650 tab_complete(PurpleConversation *conv) |
3651 { | 3651 { |
3652 PidginConversation *gtkconv; | 3652 PidginConversation *gtkconv; |
3653 GtkTextIter cursor, word_start, start_buffer; | 3653 GtkTextIter cursor, word_start, start_buffer; |
3654 int start; | 3654 int start; |
3655 int most_matched = -1; | 3655 int most_matched = -1; |
3668 | 3668 |
3669 word_start = cursor; | 3669 word_start = cursor; |
3670 | 3670 |
3671 /* if there's nothing there just return */ | 3671 /* if there's nothing there just return */ |
3672 if (!gtk_text_iter_compare(&cursor, &start_buffer)) | 3672 if (!gtk_text_iter_compare(&cursor, &start_buffer)) |
3673 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; | 3673 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE; |
3674 | 3674 |
3675 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, | 3675 text = gtk_text_buffer_get_text(gtkconv->entry_buffer, &start_buffer, |
3676 &cursor, FALSE); | 3676 &cursor, FALSE); |
3677 | 3677 |
3678 /* if we're at the end of ": " we need to move back 2 spaces */ | 3678 /* if we're at the end of ": " we need to move back 2 spaces */ |
3700 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, | 3700 entered = gtk_text_buffer_get_text(gtkconv->entry_buffer, &word_start, |
3701 &cursor, FALSE); | 3701 &cursor, FALSE); |
3702 | 3702 |
3703 if (!g_utf8_strlen(entered, -1)) { | 3703 if (!g_utf8_strlen(entered, -1)) { |
3704 g_free(entered); | 3704 g_free(entered); |
3705 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; | 3705 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE; |
3706 } | 3706 } |
3707 | 3707 |
3708 nick_partial = g_malloc(strlen(entered)+1); | 3708 nick_partial = g_malloc(strlen(entered)+1); |
3709 | 3709 |
3710 if (command) { | 3710 if (command) { |
3711 GList *list = gaim_cmd_list(conv); | 3711 GList *list = purple_cmd_list(conv); |
3712 GList *l; | 3712 GList *l; |
3713 | 3713 |
3714 /* Commands */ | 3714 /* Commands */ |
3715 for (l = list; l != NULL; l = l->next) { | 3715 for (l = list; l != NULL; l = l->next) { |
3716 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, | 3716 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, |
3717 &matches, TRUE, l->data); | 3717 &matches, TRUE, l->data); |
3718 } | 3718 } |
3719 g_list_free(list); | 3719 g_list_free(list); |
3720 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 3720 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
3721 GaimConvChat *chat = GAIM_CONV_CHAT(conv); | 3721 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); |
3722 GList *l = gaim_conv_chat_get_users(chat); | 3722 GList *l = purple_conv_chat_get_users(chat); |
3723 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list)); | 3723 GtkTreeModel *model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list)); |
3724 GtkTreeIter iter; | 3724 GtkTreeIter iter; |
3725 int f; | 3725 int f; |
3726 | 3726 |
3727 /* Users */ | 3727 /* Users */ |
3728 for (; l != NULL; l = l->next) { | 3728 for (; l != NULL; l = l->next) { |
3729 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, | 3729 tab_complete_process_item(&most_matched, entered, &partial, nick_partial, |
3730 &matches, TRUE, ((GaimConvChatBuddy *)l->data)->name); | 3730 &matches, TRUE, ((PurpleConvChatBuddy *)l->data)->name); |
3731 } | 3731 } |
3732 | 3732 |
3733 | 3733 |
3734 /* Aliases */ | 3734 /* Aliases */ |
3735 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | 3735 if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
3764 | 3764 |
3765 /* if there weren't any matches, return */ | 3765 /* if there weren't any matches, return */ |
3766 if (!matches) { | 3766 if (!matches) { |
3767 /* if matches isn't set partials won't be either */ | 3767 /* if matches isn't set partials won't be either */ |
3768 g_free(entered); | 3768 g_free(entered); |
3769 return (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) ? TRUE : FALSE; | 3769 return (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) ? TRUE : FALSE; |
3770 } | 3770 } |
3771 | 3771 |
3772 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); | 3772 gtk_text_buffer_delete(gtkconv->entry_buffer, &word_start, &cursor); |
3773 | 3773 |
3774 if (!matches->next) { | 3774 if (!matches->next) { |
3802 g_free(tmp); | 3802 g_free(tmp); |
3803 g_free(matches->data); | 3803 g_free(matches->data); |
3804 matches = g_list_remove(matches, matches->data); | 3804 matches = g_list_remove(matches, matches->data); |
3805 } | 3805 } |
3806 | 3806 |
3807 gaim_conversation_write(conv, NULL, addthis, GAIM_MESSAGE_NO_LOG, | 3807 purple_conversation_write(conv, NULL, addthis, PURPLE_MESSAGE_NO_LOG, |
3808 time(NULL)); | 3808 time(NULL)); |
3809 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); | 3809 gtk_text_buffer_insert_at_cursor(gtkconv->entry_buffer, partial, -1); |
3810 g_free(addthis); | 3810 g_free(addthis); |
3811 } | 3811 } |
3812 | 3812 |
3816 return TRUE; | 3816 return TRUE; |
3817 } | 3817 } |
3818 | 3818 |
3819 static void topic_callback(GtkWidget *w, PidginConversation *gtkconv) | 3819 static void topic_callback(GtkWidget *w, PidginConversation *gtkconv) |
3820 { | 3820 { |
3821 GaimPluginProtocolInfo *prpl_info = NULL; | 3821 PurplePluginProtocolInfo *prpl_info = NULL; |
3822 GaimConnection *gc; | 3822 PurpleConnection *gc; |
3823 GaimConversation *conv = gtkconv->active_conv; | 3823 PurpleConversation *conv = gtkconv->active_conv; |
3824 PidginChatPane *gtkchat; | 3824 PidginChatPane *gtkchat; |
3825 char *new_topic; | 3825 char *new_topic; |
3826 const char *current_topic; | 3826 const char *current_topic; |
3827 | 3827 |
3828 gc = gaim_conversation_get_gc(conv); | 3828 gc = purple_conversation_get_gc(conv); |
3829 | 3829 |
3830 if(!gc || !(prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl))) | 3830 if(!gc || !(prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl))) |
3831 return; | 3831 return; |
3832 | 3832 |
3833 if(prpl_info->set_chat_topic == NULL) | 3833 if(prpl_info->set_chat_topic == NULL) |
3834 return; | 3834 return; |
3835 | 3835 |
3836 gtkconv = PIDGIN_CONVERSATION(conv); | 3836 gtkconv = PIDGIN_CONVERSATION(conv); |
3837 gtkchat = gtkconv->u.chat; | 3837 gtkchat = gtkconv->u.chat; |
3838 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); | 3838 new_topic = g_strdup(gtk_entry_get_text(GTK_ENTRY(gtkchat->topic_text))); |
3839 current_topic = gaim_conv_chat_get_topic(GAIM_CONV_CHAT(conv)); | 3839 current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(conv)); |
3840 | 3840 |
3841 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ | 3841 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
3842 g_free(new_topic); | 3842 g_free(new_topic); |
3843 return; | 3843 return; |
3844 } | 3844 } |
3845 | 3845 |
3846 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); | 3846 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); |
3847 | 3847 |
3848 prpl_info->set_chat_topic(gc, gaim_conv_chat_get_id(GAIM_CONV_CHAT(conv)), | 3848 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
3849 new_topic); | 3849 new_topic); |
3850 | 3850 |
3851 g_free(new_topic); | 3851 g_free(new_topic); |
3852 } | 3852 } |
3853 | 3853 |
3854 static gint | 3854 static gint |
3855 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) | 3855 sort_chat_users(GtkTreeModel *model, GtkTreeIter *a, GtkTreeIter *b, gpointer userdata) |
3856 { | 3856 { |
3857 GaimConvChatBuddyFlags f1 = 0, f2 = 0; | 3857 PurpleConvChatBuddyFlags f1 = 0, f2 = 0; |
3858 char *user1 = NULL, *user2 = NULL; | 3858 char *user1 = NULL, *user2 = NULL; |
3859 gboolean buddy1 = FALSE, buddy2 = FALSE; | 3859 gboolean buddy1 = FALSE, buddy2 = FALSE; |
3860 gint ret = 0; | 3860 gint ret = 0; |
3861 | 3861 |
3862 gtk_tree_model_get(model, a, | 3862 gtk_tree_model_get(model, a, |
3887 | 3887 |
3888 return ret; | 3888 return ret; |
3889 } | 3889 } |
3890 | 3890 |
3891 static void | 3891 static void |
3892 update_chat_alias(GaimBuddy *buddy, GaimConversation *conv, GaimConnection *gc, GaimPluginProtocolInfo *prpl_info) | 3892 update_chat_alias(PurpleBuddy *buddy, PurpleConversation *conv, PurpleConnection *gc, PurplePluginProtocolInfo *prpl_info) |
3893 { | 3893 { |
3894 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 3894 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
3895 GaimConvChat *chat = GAIM_CONV_CHAT(conv); | 3895 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); |
3896 GtkTreeModel *model; | 3896 GtkTreeModel *model; |
3897 char *normalized_name; | 3897 char *normalized_name; |
3898 GtkTreeIter iter; | 3898 GtkTreeIter iter; |
3899 int f; | 3899 int f; |
3900 | 3900 |
3905 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list)); | 3905 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkconv->u.chat->list)); |
3906 | 3906 |
3907 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | 3907 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
3908 return; | 3908 return; |
3909 | 3909 |
3910 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name)); | 3910 normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); |
3911 | 3911 |
3912 do { | 3912 do { |
3913 char *name; | 3913 char *name; |
3914 | 3914 |
3915 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); | 3915 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
3916 | 3916 |
3917 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { | 3917 if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { |
3918 const char *alias = name; | 3918 const char *alias = name; |
3919 char *tmp; | 3919 char *tmp; |
3920 char *alias_key = NULL; | 3920 char *alias_key = NULL; |
3921 GaimBuddy *buddy2; | 3921 PurpleBuddy *buddy2; |
3922 | 3922 |
3923 if (strcmp(chat->nick, gaim_normalize(conv->account, name))) { | 3923 if (strcmp(chat->nick, purple_normalize(conv->account, name))) { |
3924 /* This user is not me, so look into updating the alias. */ | 3924 /* This user is not me, so look into updating the alias. */ |
3925 | 3925 |
3926 if ((buddy2 = gaim_find_buddy(conv->account, name)) != NULL) { | 3926 if ((buddy2 = purple_find_buddy(conv->account, name)) != NULL) { |
3927 alias = gaim_buddy_get_contact_alias(buddy2); | 3927 alias = purple_buddy_get_contact_alias(buddy2); |
3928 } | 3928 } |
3929 | 3929 |
3930 tmp = g_utf8_casefold(alias, -1); | 3930 tmp = g_utf8_casefold(alias, -1); |
3931 alias_key = g_utf8_collate_key(tmp, -1); | 3931 alias_key = g_utf8_collate_key(tmp, -1); |
3932 g_free(tmp); | 3932 g_free(tmp); |
3948 | 3948 |
3949 g_free(normalized_name); | 3949 g_free(normalized_name); |
3950 } | 3950 } |
3951 | 3951 |
3952 static void | 3952 static void |
3953 blist_node_aliased_cb(GaimBlistNode *node, const char *old_alias, GaimConversation *conv) | 3953 blist_node_aliased_cb(PurpleBlistNode *node, const char *old_alias, PurpleConversation *conv) |
3954 { | 3954 { |
3955 GaimConnection *gc; | 3955 PurpleConnection *gc; |
3956 GaimPluginProtocolInfo *prpl_info; | 3956 PurplePluginProtocolInfo *prpl_info; |
3957 | 3957 |
3958 g_return_if_fail(node != NULL); | 3958 g_return_if_fail(node != NULL); |
3959 g_return_if_fail(conv != NULL); | 3959 g_return_if_fail(conv != NULL); |
3960 | 3960 |
3961 gc = gaim_conversation_get_gc(conv); | 3961 gc = purple_conversation_get_gc(conv); |
3962 g_return_if_fail(gc != NULL); | 3962 g_return_if_fail(gc != NULL); |
3963 g_return_if_fail(gc->prpl != NULL); | 3963 g_return_if_fail(gc->prpl != NULL); |
3964 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 3964 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
3965 | 3965 |
3966 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) | 3966 if (prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) |
3967 return; | 3967 return; |
3968 | 3968 |
3969 if (GAIM_BLIST_NODE_IS_CONTACT(node)) | 3969 if (PURPLE_BLIST_NODE_IS_CONTACT(node)) |
3970 { | 3970 { |
3971 GaimBlistNode *bnode; | 3971 PurpleBlistNode *bnode; |
3972 | 3972 |
3973 for(bnode = node->child; bnode; bnode = bnode->next) { | 3973 for(bnode = node->child; bnode; bnode = bnode->next) { |
3974 | 3974 |
3975 if(!GAIM_BLIST_NODE_IS_BUDDY(bnode)) | 3975 if(!PURPLE_BLIST_NODE_IS_BUDDY(bnode)) |
3976 continue; | 3976 continue; |
3977 | 3977 |
3978 update_chat_alias((GaimBuddy *)bnode, conv, gc, prpl_info); | 3978 update_chat_alias((PurpleBuddy *)bnode, conv, gc, prpl_info); |
3979 } | 3979 } |
3980 } | 3980 } |
3981 else if (GAIM_BLIST_NODE_IS_BUDDY(node)) | 3981 else if (PURPLE_BLIST_NODE_IS_BUDDY(node)) |
3982 update_chat_alias((GaimBuddy *)node, conv, gc, prpl_info); | 3982 update_chat_alias((PurpleBuddy *)node, conv, gc, prpl_info); |
3983 } | 3983 } |
3984 | 3984 |
3985 static void | 3985 static void |
3986 buddy_cb_common(GaimBuddy *buddy, GaimConversation *conv, gboolean is_buddy) | 3986 buddy_cb_common(PurpleBuddy *buddy, PurpleConversation *conv, gboolean is_buddy) |
3987 { | 3987 { |
3988 GtkTreeModel *model; | 3988 GtkTreeModel *model; |
3989 char *normalized_name; | 3989 char *normalized_name; |
3990 GtkTreeIter iter; | 3990 GtkTreeIter iter; |
3991 int f; | 3991 int f; |
3992 | 3992 |
3993 g_return_if_fail(buddy != NULL); | 3993 g_return_if_fail(buddy != NULL); |
3994 g_return_if_fail(conv != NULL); | 3994 g_return_if_fail(conv != NULL); |
3995 | 3995 |
3996 /* Do nothing if the buddy does not belong to the conv's account */ | 3996 /* Do nothing if the buddy does not belong to the conv's account */ |
3997 if (gaim_buddy_get_account(buddy) != gaim_conversation_get_account(conv)) | 3997 if (purple_buddy_get_account(buddy) != purple_conversation_get_account(conv)) |
3998 return; | 3998 return; |
3999 | 3999 |
4000 /* This is safe because this callback is only used in chats, not IMs. */ | 4000 /* This is safe because this callback is only used in chats, not IMs. */ |
4001 model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list)); | 4001 model = gtk_tree_view_get_model(GTK_TREE_VIEW(PIDGIN_CONVERSATION(conv)->u.chat->list)); |
4002 | 4002 |
4003 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | 4003 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
4004 return; | 4004 return; |
4005 | 4005 |
4006 normalized_name = g_strdup(gaim_normalize(conv->account, buddy->name)); | 4006 normalized_name = g_strdup(purple_normalize(conv->account, buddy->name)); |
4007 | 4007 |
4008 do { | 4008 do { |
4009 char *name; | 4009 char *name; |
4010 | 4010 |
4011 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); | 4011 gtk_tree_model_get(model, &iter, CHAT_USERS_NAME_COLUMN, &name, -1); |
4012 | 4012 |
4013 if (!strcmp(normalized_name, gaim_normalize(conv->account, name))) { | 4013 if (!strcmp(normalized_name, purple_normalize(conv->account, name))) { |
4014 gtk_list_store_set(GTK_LIST_STORE(model), &iter, | 4014 gtk_list_store_set(GTK_LIST_STORE(model), &iter, |
4015 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); | 4015 CHAT_USERS_WEIGHT_COLUMN, is_buddy ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL, -1); |
4016 g_free(name); | 4016 g_free(name); |
4017 break; | 4017 break; |
4018 } | 4018 } |
4022 g_free(name); | 4022 g_free(name); |
4023 } while (f != 0); | 4023 } while (f != 0); |
4024 | 4024 |
4025 g_free(normalized_name); | 4025 g_free(normalized_name); |
4026 | 4026 |
4027 blist_node_aliased_cb((GaimBlistNode *)buddy, NULL, conv); | 4027 blist_node_aliased_cb((PurpleBlistNode *)buddy, NULL, conv); |
4028 } | 4028 } |
4029 | 4029 |
4030 static void | 4030 static void |
4031 buddy_added_cb(GaimBuddy *buddy, GaimConversation *conv) | 4031 buddy_added_cb(PurpleBuddy *buddy, PurpleConversation *conv) |
4032 { | 4032 { |
4033 buddy_cb_common(buddy, conv, TRUE); | 4033 buddy_cb_common(buddy, conv, TRUE); |
4034 } | 4034 } |
4035 | 4035 |
4036 static void | 4036 static void |
4037 buddy_removed_cb(GaimBuddy *buddy, GaimConversation *conv) | 4037 buddy_removed_cb(PurpleBuddy *buddy, PurpleConversation *conv) |
4038 { | 4038 { |
4039 /* If there's another buddy for the same "dude" on the list, do nothing. */ | 4039 /* If there's another buddy for the same "dude" on the list, do nothing. */ |
4040 if (gaim_find_buddy(buddy->account, buddy->name) != NULL) | 4040 if (purple_find_buddy(buddy->account, buddy->name) != NULL) |
4041 return; | 4041 return; |
4042 | 4042 |
4043 buddy_cb_common(buddy, conv, FALSE); | 4043 buddy_cb_common(buddy, conv, FALSE); |
4044 } | 4044 } |
4045 | 4045 |
4112 } | 4112 } |
4113 | 4113 |
4114 static GtkWidget * | 4114 static GtkWidget * |
4115 setup_chat_pane(PidginConversation *gtkconv) | 4115 setup_chat_pane(PidginConversation *gtkconv) |
4116 { | 4116 { |
4117 GaimPluginProtocolInfo *prpl_info; | 4117 PurplePluginProtocolInfo *prpl_info; |
4118 GaimConversation *conv = gtkconv->active_conv; | 4118 PurpleConversation *conv = gtkconv->active_conv; |
4119 PidginChatPane *gtkchat; | 4119 PidginChatPane *gtkchat; |
4120 GaimConnection *gc; | 4120 PurpleConnection *gc; |
4121 GtkWidget *vpaned, *hpaned; | 4121 GtkWidget *vpaned, *hpaned; |
4122 GtkWidget *vbox, *hbox, *frame; | 4122 GtkWidget *vbox, *hbox, *frame; |
4123 GtkWidget *imhtml_sw; | 4123 GtkWidget *imhtml_sw; |
4124 GtkPolicyType imhtml_sw_hscroll; | 4124 GtkPolicyType imhtml_sw_hscroll; |
4125 GtkWidget *lbox; | 4125 GtkWidget *lbox; |
4127 GtkWidget *list; | 4127 GtkWidget *list; |
4128 GtkWidget *sw; | 4128 GtkWidget *sw; |
4129 GtkListStore *ls; | 4129 GtkListStore *ls; |
4130 GtkCellRenderer *rend; | 4130 GtkCellRenderer *rend; |
4131 GtkTreeViewColumn *col; | 4131 GtkTreeViewColumn *col; |
4132 void *blist_handle = gaim_blist_get_handle(); | 4132 void *blist_handle = purple_blist_get_handle(); |
4133 GList *focus_chain = NULL; | 4133 GList *focus_chain = NULL; |
4134 | 4134 |
4135 gtkchat = gtkconv->u.chat; | 4135 gtkchat = gtkconv->u.chat; |
4136 gc = gaim_conversation_get_gc(conv); | 4136 gc = purple_conversation_get_gc(conv); |
4137 g_return_val_if_fail(gc != NULL, NULL); | 4137 g_return_val_if_fail(gc != NULL, NULL); |
4138 g_return_val_if_fail(gc->prpl != NULL, NULL); | 4138 g_return_val_if_fail(gc->prpl != NULL, NULL); |
4139 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 4139 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4140 | 4140 |
4141 /* Setup the outer pane. */ | 4141 /* Setup the outer pane. */ |
4142 vpaned = gtk_vpaned_new(); | 4142 vpaned = gtk_vpaned_new(); |
4143 gtk_widget_show(vpaned); | 4143 gtk_widget_show(vpaned); |
4144 | 4144 |
4185 &imhtml_sw_hscroll, NULL); | 4185 &imhtml_sw_hscroll, NULL); |
4186 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw), | 4186 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw), |
4187 imhtml_sw_hscroll, GTK_POLICY_ALWAYS); | 4187 imhtml_sw_hscroll, GTK_POLICY_ALWAYS); |
4188 | 4188 |
4189 gtk_widget_set_size_request(gtkconv->imhtml, | 4189 gtk_widget_set_size_request(gtkconv->imhtml, |
4190 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_width"), | 4190 purple_prefs_get_int("/purple/gtk/conversations/chat/default_width"), |
4191 gaim_prefs_get_int("/gaim/gtk/conversations/chat/default_height")); | 4191 purple_prefs_get_int("/purple/gtk/conversations/chat/default_height")); |
4192 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", | 4192 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", |
4193 G_CALLBACK(size_allocate_cb), gtkconv); | 4193 G_CALLBACK(size_allocate_cb), gtkconv); |
4194 | 4194 |
4195 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | 4195 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", |
4196 G_CALLBACK(entry_stop_rclick_cb), NULL); | 4196 G_CALLBACK(entry_stop_rclick_cb), NULL); |
4230 col = gtk_tree_view_column_new_with_attributes(NULL, rend, | 4230 col = gtk_tree_view_column_new_with_attributes(NULL, rend, |
4231 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); | 4231 "pixbuf", CHAT_USERS_ICON_COLUMN, NULL); |
4232 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); | 4232 gtk_tree_view_column_set_sizing(col, GTK_TREE_VIEW_COLUMN_AUTOSIZE); |
4233 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); | 4233 gtk_tree_view_append_column(GTK_TREE_VIEW(list), col); |
4234 gtk_widget_set_size_request(lbox, | 4234 gtk_widget_set_size_request(lbox, |
4235 gaim_prefs_get_int("/gaim/gtk/conversations/chat/userlist_width"), -1); | 4235 purple_prefs_get_int("/purple/gtk/conversations/chat/userlist_width"), -1); |
4236 | 4236 |
4237 g_signal_connect(G_OBJECT(list), "button_press_event", | 4237 g_signal_connect(G_OBJECT(list), "button_press_event", |
4238 G_CALLBACK(right_click_chat_cb), gtkconv); | 4238 G_CALLBACK(right_click_chat_cb), gtkconv); |
4239 g_signal_connect(G_OBJECT(list), "popup-menu", | 4239 g_signal_connect(G_OBJECT(list), "popup-menu", |
4240 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv); | 4240 G_CALLBACK(gtkconv_chat_popup_menu_cb), gtkconv); |
4251 "text", CHAT_USERS_ALIAS_COLUMN, | 4251 "text", CHAT_USERS_ALIAS_COLUMN, |
4252 "foreground-gdk", CHAT_USERS_COLOR_COLUMN, | 4252 "foreground-gdk", CHAT_USERS_COLOR_COLUMN, |
4253 "weight", CHAT_USERS_WEIGHT_COLUMN, | 4253 "weight", CHAT_USERS_WEIGHT_COLUMN, |
4254 NULL); | 4254 NULL); |
4255 | 4255 |
4256 gaim_signal_connect(blist_handle, "buddy-added", | 4256 purple_signal_connect(blist_handle, "buddy-added", |
4257 gtkchat, GAIM_CALLBACK(buddy_added_cb), conv); | 4257 gtkchat, PURPLE_CALLBACK(buddy_added_cb), conv); |
4258 gaim_signal_connect(blist_handle, "buddy-removed", | 4258 purple_signal_connect(blist_handle, "buddy-removed", |
4259 gtkchat, GAIM_CALLBACK(buddy_removed_cb), conv); | 4259 gtkchat, PURPLE_CALLBACK(buddy_removed_cb), conv); |
4260 gaim_signal_connect(blist_handle, "blist-node-aliased", | 4260 purple_signal_connect(blist_handle, "blist-node-aliased", |
4261 gtkchat, GAIM_CALLBACK(blist_node_aliased_cb), conv); | 4261 gtkchat, PURPLE_CALLBACK(blist_node_aliased_cb), conv); |
4262 | 4262 |
4263 #if GTK_CHECK_VERSION(2,6,0) | 4263 #if GTK_CHECK_VERSION(2,6,0) |
4264 gtk_tree_view_column_set_expand(col, TRUE); | 4264 gtk_tree_view_column_set_expand(col, TRUE); |
4265 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | 4265 g_object_set(rend, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
4266 #endif | 4266 #endif |
4295 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", | 4295 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", |
4296 G_CALLBACK(entry_popup_menu_cb), gtkconv); | 4296 G_CALLBACK(entry_popup_menu_cb), gtkconv); |
4297 | 4297 |
4298 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); | 4298 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); |
4299 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | 4299 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
4300 gaim_account_get_protocol_name(conv->account)); | 4300 purple_account_get_protocol_name(conv->account)); |
4301 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | 4301 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
4302 gaim_prefs_get_int("/gaim/gtk/conversations/chat/entry_height")); | 4302 purple_prefs_get_int("/purple/gtk/conversations/chat/entry_height")); |
4303 gtkconv->entry_buffer = | 4303 gtkconv->entry_buffer = |
4304 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 4304 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
4305 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); | 4305 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
4306 g_signal_connect_swapped(G_OBJECT(gtkconv->entry_buffer), "changed", | 4306 g_signal_connect_swapped(G_OBJECT(gtkconv->entry_buffer), "changed", |
4307 G_CALLBACK(resize_imhtml_cb), gtkconv); | 4307 G_CALLBACK(resize_imhtml_cb), gtkconv); |
4329 } | 4329 } |
4330 | 4330 |
4331 static GtkWidget * | 4331 static GtkWidget * |
4332 setup_im_pane(PidginConversation *gtkconv) | 4332 setup_im_pane(PidginConversation *gtkconv) |
4333 { | 4333 { |
4334 GaimConversation *conv = gtkconv->active_conv; | 4334 PurpleConversation *conv = gtkconv->active_conv; |
4335 GtkWidget *frame; | 4335 GtkWidget *frame; |
4336 GtkWidget *imhtml_sw; | 4336 GtkWidget *imhtml_sw; |
4337 GtkPolicyType imhtml_sw_hscroll; | 4337 GtkPolicyType imhtml_sw_hscroll; |
4338 GtkWidget *paned; | 4338 GtkWidget *paned; |
4339 GtkWidget *vbox; | 4339 GtkWidget *vbox; |
4359 &imhtml_sw_hscroll, NULL); | 4359 &imhtml_sw_hscroll, NULL); |
4360 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw), | 4360 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(imhtml_sw), |
4361 imhtml_sw_hscroll, GTK_POLICY_ALWAYS); | 4361 imhtml_sw_hscroll, GTK_POLICY_ALWAYS); |
4362 | 4362 |
4363 gtk_widget_set_size_request(gtkconv->imhtml, | 4363 gtk_widget_set_size_request(gtkconv->imhtml, |
4364 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_width"), | 4364 purple_prefs_get_int("/purple/gtk/conversations/im/default_width"), |
4365 gaim_prefs_get_int("/gaim/gtk/conversations/im/default_height")); | 4365 purple_prefs_get_int("/purple/gtk/conversations/im/default_height")); |
4366 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", | 4366 g_signal_connect(G_OBJECT(gtkconv->imhtml), "size-allocate", |
4367 G_CALLBACK(size_allocate_cb), gtkconv); | 4367 G_CALLBACK(size_allocate_cb), gtkconv); |
4368 | 4368 |
4369 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", | 4369 g_signal_connect_after(G_OBJECT(gtkconv->imhtml), "button_press_event", |
4370 G_CALLBACK(entry_stop_rclick_cb), NULL); | 4370 G_CALLBACK(entry_stop_rclick_cb), NULL); |
4394 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", | 4394 g_signal_connect(G_OBJECT(gtkconv->entry), "populate-popup", |
4395 G_CALLBACK(entry_popup_menu_cb), gtkconv); | 4395 G_CALLBACK(entry_popup_menu_cb), gtkconv); |
4396 | 4396 |
4397 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); | 4397 gtk_widget_set_name(gtkconv->entry, "pidgin_conv_entry"); |
4398 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), | 4398 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->entry), |
4399 gaim_account_get_protocol_name(conv->account)); | 4399 purple_account_get_protocol_name(conv->account)); |
4400 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, | 4400 gtk_widget_set_size_request(gtkconv->lower_hbox, -1, |
4401 gaim_prefs_get_int("/gaim/gtk/conversations/im/entry_height")); | 4401 purple_prefs_get_int("/purple/gtk/conversations/im/entry_height")); |
4402 gtkconv->entry_buffer = | 4402 gtkconv->entry_buffer = |
4403 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); | 4403 gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->entry)); |
4404 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); | 4404 g_object_set_data(G_OBJECT(gtkconv->entry_buffer), "user_data", gtkconv); |
4405 | 4405 |
4406 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", | 4406 g_signal_connect(G_OBJECT(gtkconv->entry), "key_press_event", |
4425 default_formatize(gtkconv); | 4425 default_formatize(gtkconv); |
4426 | 4426 |
4427 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", | 4427 g_signal_connect_after(G_OBJECT(gtkconv->entry), "format_function_clear", |
4428 G_CALLBACK(clear_formatting_cb), gtkconv); | 4428 G_CALLBACK(clear_formatting_cb), gtkconv); |
4429 | 4429 |
4430 gtkconv->u.im->animate = gaim_prefs_get_bool("/gaim/gtk/conversations/im/animate_buddy_icons"); | 4430 gtkconv->u.im->animate = purple_prefs_get_bool("/purple/gtk/conversations/im/animate_buddy_icons"); |
4431 gtkconv->u.im->show_icon = TRUE; | 4431 gtkconv->u.im->show_icon = TRUE; |
4432 | 4432 |
4433 /* | 4433 /* |
4434 * Focus for IM windows should be as follows: | 4434 * Focus for IM windows should be as follows: |
4435 * Tab title -> conversation scrollback -> entry | 4435 * Tab title -> conversation scrollback -> entry |
4444 static void | 4444 static void |
4445 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, | 4445 conv_dnd_recv(GtkWidget *widget, GdkDragContext *dc, guint x, guint y, |
4446 GtkSelectionData *sd, guint info, guint t, | 4446 GtkSelectionData *sd, guint info, guint t, |
4447 PidginConversation *gtkconv) | 4447 PidginConversation *gtkconv) |
4448 { | 4448 { |
4449 GaimConversation *conv = gtkconv->active_conv; | 4449 PurpleConversation *conv = gtkconv->active_conv; |
4450 PidginWindow *win = gtkconv->win; | 4450 PidginWindow *win = gtkconv->win; |
4451 GaimConversation *c; | 4451 PurpleConversation *c; |
4452 if (sd->target == gdk_atom_intern("GAIM_BLIST_NODE", FALSE)) | 4452 if (sd->target == gdk_atom_intern("PURPLE_BLIST_NODE", FALSE)) |
4453 { | 4453 { |
4454 GaimBlistNode *n = NULL; | 4454 PurpleBlistNode *n = NULL; |
4455 GaimBuddy *b; | 4455 PurpleBuddy *b; |
4456 PidginConversation *gtkconv = NULL; | 4456 PidginConversation *gtkconv = NULL; |
4457 | 4457 |
4458 n = *(GaimBlistNode **)sd->data; | 4458 n = *(PurpleBlistNode **)sd->data; |
4459 | 4459 |
4460 if (GAIM_BLIST_NODE_IS_CONTACT(n)) | 4460 if (PURPLE_BLIST_NODE_IS_CONTACT(n)) |
4461 b = gaim_contact_get_priority_buddy((GaimContact*)n); | 4461 b = purple_contact_get_priority_buddy((PurpleContact*)n); |
4462 else if (GAIM_BLIST_NODE_IS_BUDDY(n)) | 4462 else if (PURPLE_BLIST_NODE_IS_BUDDY(n)) |
4463 b = (GaimBuddy*)n; | 4463 b = (PurpleBuddy*)n; |
4464 else | 4464 else |
4465 return; | 4465 return; |
4466 | 4466 |
4467 /* | 4467 /* |
4468 * If we already have an open conversation with this buddy, then | 4468 * If we already have an open conversation with this buddy, then |
4469 * just move the conv to this window. Otherwise, create a new | 4469 * just move the conv to this window. Otherwise, create a new |
4470 * conv and add it to this window. | 4470 * conv and add it to this window. |
4471 */ | 4471 */ |
4472 c = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account); | 4472 c = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account); |
4473 if (c != NULL) { | 4473 if (c != NULL) { |
4474 PidginWindow *oldwin; | 4474 PidginWindow *oldwin; |
4475 gtkconv = PIDGIN_CONVERSATION(c); | 4475 gtkconv = PIDGIN_CONVERSATION(c); |
4476 oldwin = gtkconv->win; | 4476 oldwin = gtkconv->win; |
4477 if (oldwin != win) { | 4477 if (oldwin != win) { |
4478 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv); | 4478 pidgin_conv_window_remove_gtkconv(oldwin, gtkconv); |
4479 pidgin_conv_window_add_gtkconv(win, gtkconv); | 4479 pidgin_conv_window_add_gtkconv(win, gtkconv); |
4480 } | 4480 } |
4481 } else { | 4481 } else { |
4482 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, b->account, b->name); | 4482 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, b->account, b->name); |
4483 gtkconv = PIDGIN_CONVERSATION(c); | 4483 gtkconv = PIDGIN_CONVERSATION(c); |
4484 if (gtkconv->win != win) | 4484 if (gtkconv->win != win) |
4485 { | 4485 { |
4486 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | 4486 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
4487 pidgin_conv_window_add_gtkconv(win, gtkconv); | 4487 pidgin_conv_window_add_gtkconv(win, gtkconv); |
4495 } | 4495 } |
4496 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) | 4496 else if (sd->target == gdk_atom_intern("application/x-im-contact", FALSE)) |
4497 { | 4497 { |
4498 char *protocol = NULL; | 4498 char *protocol = NULL; |
4499 char *username = NULL; | 4499 char *username = NULL; |
4500 GaimAccount *account; | 4500 PurpleAccount *account; |
4501 PidginConversation *gtkconv; | 4501 PidginConversation *gtkconv; |
4502 | 4502 |
4503 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, | 4503 if (pidgin_parse_x_im_contact((const char *)sd->data, FALSE, &account, |
4504 &protocol, &username, NULL)) | 4504 &protocol, &username, NULL)) |
4505 { | 4505 { |
4506 if (account == NULL) | 4506 if (account == NULL) |
4507 { | 4507 { |
4508 gaim_notify_error(win, NULL, | 4508 purple_notify_error(win, NULL, |
4509 _("You are not currently signed on with an account that " | 4509 _("You are not currently signed on with an account that " |
4510 "can add that buddy."), NULL); | 4510 "can add that buddy."), NULL); |
4511 } | 4511 } |
4512 else | 4512 else |
4513 { | 4513 { |
4514 c = gaim_conversation_new(GAIM_CONV_TYPE_IM, account, username); | 4514 c = purple_conversation_new(PURPLE_CONV_TYPE_IM, account, username); |
4515 gtkconv = PIDGIN_CONVERSATION(c); | 4515 gtkconv = PIDGIN_CONVERSATION(c); |
4516 if (gtkconv->win != win) | 4516 if (gtkconv->win != win) |
4517 { | 4517 { |
4518 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | 4518 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
4519 pidgin_conv_window_add_gtkconv(win, gtkconv); | 4519 pidgin_conv_window_add_gtkconv(win, gtkconv); |
4525 g_free(protocol); | 4525 g_free(protocol); |
4526 | 4526 |
4527 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 4527 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4528 } | 4528 } |
4529 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { | 4529 else if (sd->target == gdk_atom_intern("text/uri-list", FALSE)) { |
4530 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 4530 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
4531 pidgin_dnd_file_manage(sd, gaim_conversation_get_account(conv), gaim_conversation_get_name(conv)); | 4531 pidgin_dnd_file_manage(sd, purple_conversation_get_account(conv), purple_conversation_get_name(conv)); |
4532 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); | 4532 gtk_drag_finish(dc, TRUE, (dc->action == GDK_ACTION_MOVE), t); |
4533 } | 4533 } |
4534 else | 4534 else |
4535 gtk_drag_finish(dc, FALSE, FALSE, t); | 4535 gtk_drag_finish(dc, FALSE, FALSE, t); |
4536 } | 4536 } |
4537 | 4537 |
4538 | 4538 |
4539 static const GtkTargetEntry te[] = | 4539 static const GtkTargetEntry te[] = |
4540 { | 4540 { |
4541 GTK_IMHTML_DND_TARGETS, | 4541 GTK_IMHTML_DND_TARGETS, |
4542 {"GAIM_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM}, | 4542 {"PURPLE_BLIST_NODE", GTK_TARGET_SAME_APP, GTK_IMHTML_DRAG_NUM}, |
4543 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1} | 4543 {"application/x-im-contact", 0, GTK_IMHTML_DRAG_NUM + 1} |
4544 }; | 4544 }; |
4545 | 4545 |
4546 static PidginConversation * | 4546 static PidginConversation * |
4547 pidgin_conv_find_gtkconv(GaimConversation * conv) | 4547 pidgin_conv_find_gtkconv(PurpleConversation * conv) |
4548 { | 4548 { |
4549 GaimBuddy *bud = gaim_find_buddy(conv->account, conv->name), *b; | 4549 PurpleBuddy *bud = purple_find_buddy(conv->account, conv->name), *b; |
4550 GaimContact *c; | 4550 PurpleContact *c; |
4551 GaimBlistNode *cn; | 4551 PurpleBlistNode *cn; |
4552 | 4552 |
4553 if (!bud) | 4553 if (!bud) |
4554 return NULL; | 4554 return NULL; |
4555 | 4555 |
4556 if (!(c = gaim_buddy_get_contact(bud))) | 4556 if (!(c = purple_buddy_get_contact(bud))) |
4557 return NULL; | 4557 return NULL; |
4558 | 4558 |
4559 cn = (GaimBlistNode *)c; | 4559 cn = (PurpleBlistNode *)c; |
4560 for (b = (GaimBuddy *)cn->child; b; b = (GaimBuddy *) ((GaimBlistNode *)b)->next) { | 4560 for (b = (PurpleBuddy *)cn->child; b; b = (PurpleBuddy *) ((PurpleBlistNode *)b)->next) { |
4561 GaimConversation *conv; | 4561 PurpleConversation *conv; |
4562 if ((conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, b->name, b->account))) { | 4562 if ((conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, b->name, b->account))) { |
4563 if (conv->ui_data) | 4563 if (conv->ui_data) |
4564 return conv->ui_data; | 4564 return conv->ui_data; |
4565 } | 4565 } |
4566 } | 4566 } |
4567 | 4567 |
4568 return NULL; | 4568 return NULL; |
4569 } | 4569 } |
4570 | 4570 |
4571 static void | 4571 static void |
4572 buddy_update_cb(GaimBlistNode *bnode, gpointer null) | 4572 buddy_update_cb(PurpleBlistNode *bnode, gpointer null) |
4573 { | 4573 { |
4574 GList *list; | 4574 GList *list; |
4575 | 4575 |
4576 g_return_if_fail(bnode); | 4576 g_return_if_fail(bnode); |
4577 g_return_if_fail(GAIM_BLIST_NODE_IS_BUDDY(bnode)); | 4577 g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(bnode)); |
4578 | 4578 |
4579 for (list = pidgin_conv_windows_get_list(); list; list = list->next) | 4579 for (list = pidgin_conv_windows_get_list(); list; list = list->next) |
4580 { | 4580 { |
4581 PidginWindow *win = list->data; | 4581 PidginWindow *win = list->data; |
4582 GaimConversation *conv = pidgin_conv_window_get_active_conversation(win); | 4582 PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); |
4583 | 4583 |
4584 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | 4584 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) |
4585 continue; | 4585 continue; |
4586 | 4586 |
4587 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); | 4587 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); |
4588 } | 4588 } |
4589 } | 4589 } |
4590 | 4590 |
4591 /************************************************************************** | 4591 /************************************************************************** |
4592 * Conversation UI operations | 4592 * Conversation UI operations |
4593 **************************************************************************/ | 4593 **************************************************************************/ |
4594 static void | 4594 static void |
4595 private_gtkconv_new(GaimConversation *conv, gboolean hidden) | 4595 private_gtkconv_new(PurpleConversation *conv, gboolean hidden) |
4596 { | 4596 { |
4597 PidginConversation *gtkconv; | 4597 PidginConversation *gtkconv; |
4598 GaimConversationType conv_type = gaim_conversation_get_type(conv); | 4598 PurpleConversationType conv_type = purple_conversation_get_type(conv); |
4599 GtkWidget *pane = NULL; | 4599 GtkWidget *pane = NULL; |
4600 GtkWidget *tab_cont; | 4600 GtkWidget *tab_cont; |
4601 | 4601 |
4602 if (conv_type == GAIM_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) { | 4602 if (conv_type == PURPLE_CONV_TYPE_IM && (gtkconv = pidgin_conv_find_gtkconv(conv))) { |
4603 conv->ui_data = gtkconv; | 4603 conv->ui_data = gtkconv; |
4604 if (!g_list_find(gtkconv->convs, conv)) | 4604 if (!g_list_find(gtkconv->convs, conv)) |
4605 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); | 4605 gtkconv->convs = g_list_prepend(gtkconv->convs, conv); |
4606 pidgin_conv_switch_active_conversation(conv); | 4606 pidgin_conv_switch_active_conversation(conv); |
4607 return; | 4607 return; |
4617 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); | 4617 gtkconv->sg = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); |
4618 gtkconv->tooltips = gtk_tooltips_new(); | 4618 gtkconv->tooltips = gtk_tooltips_new(); |
4619 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; | 4619 gtkconv->unseen_state = PIDGIN_UNSEEN_NONE; |
4620 gtkconv->unseen_count = 0; | 4620 gtkconv->unseen_count = 0; |
4621 | 4621 |
4622 if (conv_type == GAIM_CONV_TYPE_IM) { | 4622 if (conv_type == PURPLE_CONV_TYPE_IM) { |
4623 gtkconv->u.im = g_malloc0(sizeof(PidginImPane)); | 4623 gtkconv->u.im = g_malloc0(sizeof(PidginImPane)); |
4624 | 4624 |
4625 pane = setup_im_pane(gtkconv); | 4625 pane = setup_im_pane(gtkconv); |
4626 } else if (conv_type == GAIM_CONV_TYPE_CHAT) { | 4626 } else if (conv_type == PURPLE_CONV_TYPE_CHAT) { |
4627 gtkconv->u.chat = g_malloc0(sizeof(PidginChatPane)); | 4627 gtkconv->u.chat = g_malloc0(sizeof(PidginChatPane)); |
4628 pane = setup_chat_pane(gtkconv); | 4628 pane = setup_chat_pane(gtkconv); |
4629 } | 4629 } |
4630 | 4630 |
4631 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), | 4631 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->imhtml), |
4632 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); | 4632 gtk_imhtml_get_format_functions(GTK_IMHTML(gtkconv->imhtml)) | GTK_IMHTML_IMAGE); |
4633 | 4633 |
4634 if (pane == NULL) { | 4634 if (pane == NULL) { |
4635 if (conv_type == GAIM_CONV_TYPE_CHAT) | 4635 if (conv_type == PURPLE_CONV_TYPE_CHAT) |
4636 g_free(gtkconv->u.chat); | 4636 g_free(gtkconv->u.chat); |
4637 else if (conv_type == GAIM_CONV_TYPE_IM) | 4637 else if (conv_type == PURPLE_CONV_TYPE_IM) |
4638 g_free(gtkconv->u.im); | 4638 g_free(gtkconv->u.im); |
4639 | 4639 |
4640 g_free(gtkconv); | 4640 g_free(gtkconv); |
4641 conv->ui_data = NULL; | 4641 conv->ui_data = NULL; |
4642 return; | 4642 return; |
4675 gtk_container_add(GTK_CONTAINER(tab_cont), pane); | 4675 gtk_container_add(GTK_CONTAINER(tab_cont), pane); |
4676 gtk_widget_show(pane); | 4676 gtk_widget_show(pane); |
4677 | 4677 |
4678 gtkconv->make_sound = TRUE; | 4678 gtkconv->make_sound = TRUE; |
4679 | 4679 |
4680 if (gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")) | 4680 if (purple_prefs_get_bool("/purple/gtk/conversations/show_formatting_toolbar")) |
4681 gtk_widget_show(gtkconv->toolbar); | 4681 gtk_widget_show(gtkconv->toolbar); |
4682 else | 4682 else |
4683 gtk_widget_hide(gtkconv->toolbar); | 4683 gtk_widget_hide(gtkconv->toolbar); |
4684 | 4684 |
4685 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), | 4685 gtk_imhtml_show_comments(GTK_IMHTML(gtkconv->imhtml), |
4686 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | 4686 purple_prefs_get_bool("/purple/gtk/conversations/show_timestamps")); |
4687 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), | 4687 gtk_imhtml_set_protocol_name(GTK_IMHTML(gtkconv->imhtml), |
4688 gaim_account_get_protocol_name(conv->account)); | 4688 purple_account_get_protocol_name(conv->account)); |
4689 | 4689 |
4690 g_signal_connect_swapped(G_OBJECT(pane), "focus", | 4690 g_signal_connect_swapped(G_OBJECT(pane), "focus", |
4691 G_CALLBACK(gtk_widget_grab_focus), | 4691 G_CALLBACK(gtk_widget_grab_focus), |
4692 gtkconv->entry); | 4692 gtkconv->entry); |
4693 | 4693 |
4701 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); | 4701 nick_colors = generate_nick_colors(&nbr_nick_colors, gtk_widget_get_style(gtkconv->imhtml)->base[GTK_STATE_NORMAL]); |
4702 } | 4702 } |
4703 } | 4703 } |
4704 | 4704 |
4705 static void | 4705 static void |
4706 pidgin_conv_new_hidden(GaimConversation *conv) | 4706 pidgin_conv_new_hidden(PurpleConversation *conv) |
4707 { | 4707 { |
4708 private_gtkconv_new(conv, TRUE); | 4708 private_gtkconv_new(conv, TRUE); |
4709 } | 4709 } |
4710 | 4710 |
4711 void | 4711 void |
4712 pidgin_conv_new(GaimConversation *conv) | 4712 pidgin_conv_new(PurpleConversation *conv) |
4713 { | 4713 { |
4714 private_gtkconv_new(conv, FALSE); | 4714 private_gtkconv_new(conv, FALSE); |
4715 } | 4715 } |
4716 | 4716 |
4717 static void | 4717 static void |
4718 received_im_msg_cb(GaimAccount *account, char *sender, char *message, | 4718 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
4719 GaimConversation *conv, GaimMessageFlags flags) | 4719 PurpleConversation *conv, PurpleMessageFlags flags) |
4720 { | 4720 { |
4721 GaimConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); | 4721 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
4722 if (conv != NULL) | 4722 if (conv != NULL) |
4723 return; | 4723 return; |
4724 | 4724 |
4725 /* create hidden conv if hide_new pref is always */ | 4725 /* create hidden conv if hide_new pref is always */ |
4726 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always") == 0) | 4726 if (strcmp(purple_prefs_get_string("/purple/gtk/conversations/im/hide_new"), "always") == 0) |
4727 { | 4727 { |
4728 ui_ops->create_conversation = pidgin_conv_new_hidden; | 4728 ui_ops->create_conversation = pidgin_conv_new_hidden; |
4729 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); | 4729 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
4730 ui_ops->create_conversation = pidgin_conv_new; | 4730 ui_ops->create_conversation = pidgin_conv_new; |
4731 return; | 4731 return; |
4732 } | 4732 } |
4733 | 4733 |
4734 /* create hidden conv if hide_new pref is away and account is away */ | 4734 /* create hidden conv if hide_new pref is away and account is away */ |
4735 if (strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away") == 0 && | 4735 if (strcmp(purple_prefs_get_string("/purple/gtk/conversations/im/hide_new"), "away") == 0 && |
4736 !gaim_status_is_available(gaim_account_get_active_status(account))) | 4736 !purple_status_is_available(purple_account_get_active_status(account))) |
4737 { | 4737 { |
4738 ui_ops->create_conversation = pidgin_conv_new_hidden; | 4738 ui_ops->create_conversation = pidgin_conv_new_hidden; |
4739 gaim_conversation_new(GAIM_CONV_TYPE_IM, account, sender); | 4739 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
4740 ui_ops->create_conversation = pidgin_conv_new; | 4740 ui_ops->create_conversation = pidgin_conv_new; |
4741 return; | 4741 return; |
4742 } | 4742 } |
4743 } | 4743 } |
4744 | 4744 |
4745 static void | 4745 static void |
4746 pidgin_conv_destroy(GaimConversation *conv) | 4746 pidgin_conv_destroy(PurpleConversation *conv) |
4747 { | 4747 { |
4748 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 4748 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
4749 | 4749 |
4750 gtkconv->convs = g_list_remove(gtkconv->convs, conv); | 4750 gtkconv->convs = g_list_remove(gtkconv->convs, conv); |
4751 /* Don't destroy ourselves until all our convos are gone */ | 4751 /* Don't destroy ourselves until all our convos are gone */ |
4753 return; | 4753 return; |
4754 | 4754 |
4755 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); | 4755 pidgin_conv_window_remove_gtkconv(gtkconv->win, gtkconv); |
4756 | 4756 |
4757 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ | 4757 /* If the "Save Conversation" or "Save Icon" dialogs are open then close them */ |
4758 gaim_request_close_with_handle(gtkconv); | 4758 purple_request_close_with_handle(gtkconv); |
4759 gaim_notify_close_with_handle(gtkconv); | 4759 purple_notify_close_with_handle(gtkconv); |
4760 | 4760 |
4761 gtk_widget_destroy(gtkconv->tab_cont); | 4761 gtk_widget_destroy(gtkconv->tab_cont); |
4762 g_object_unref(gtkconv->tab_cont); | 4762 g_object_unref(gtkconv->tab_cont); |
4763 | 4763 |
4764 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 4764 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
4765 if (gtkconv->u.im->icon_timer != 0) | 4765 if (gtkconv->u.im->icon_timer != 0) |
4766 g_source_remove(gtkconv->u.im->icon_timer); | 4766 g_source_remove(gtkconv->u.im->icon_timer); |
4767 | 4767 |
4768 if (gtkconv->u.im->anim != NULL) | 4768 if (gtkconv->u.im->anim != NULL) |
4769 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); | 4769 g_object_unref(G_OBJECT(gtkconv->u.im->anim)); |
4770 | 4770 |
4771 g_free(gtkconv->u.im); | 4771 g_free(gtkconv->u.im); |
4772 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 4772 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
4773 gaim_signals_disconnect_by_handle(gtkconv->u.chat); | 4773 purple_signals_disconnect_by_handle(gtkconv->u.chat); |
4774 g_free(gtkconv->u.chat); | 4774 g_free(gtkconv->u.chat); |
4775 } | 4775 } |
4776 | 4776 |
4777 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); | 4777 gtk_object_sink(GTK_OBJECT(gtkconv->tooltips)); |
4778 | 4778 |
4783 g_free(gtkconv); | 4783 g_free(gtkconv); |
4784 } | 4784 } |
4785 | 4785 |
4786 | 4786 |
4787 static void | 4787 static void |
4788 pidgin_conv_write_im(GaimConversation *conv, const char *who, | 4788 pidgin_conv_write_im(PurpleConversation *conv, const char *who, |
4789 const char *message, GaimMessageFlags flags, | 4789 const char *message, PurpleMessageFlags flags, |
4790 time_t mtime) | 4790 time_t mtime) |
4791 { | 4791 { |
4792 PidginConversation *gtkconv; | 4792 PidginConversation *gtkconv; |
4793 | 4793 |
4794 gtkconv = PIDGIN_CONVERSATION(conv); | 4794 gtkconv = PIDGIN_CONVERSATION(conv); |
4795 | 4795 |
4796 if (conv != gtkconv->active_conv && | 4796 if (conv != gtkconv->active_conv && |
4797 flags & GAIM_MESSAGE_ACTIVE_ONLY) | 4797 flags & PURPLE_MESSAGE_ACTIVE_ONLY) |
4798 { | 4798 { |
4799 /* Plugins that want these messages suppressed should be | 4799 /* Plugins that want these messages suppressed should be |
4800 * calling gaim_conv_im_write(), so they get suppressed here, | 4800 * calling purple_conv_im_write(), so they get suppressed here, |
4801 * before being written to the log. */ | 4801 * before being written to the log. */ |
4802 gaim_debug_info("gtkconv", | 4802 purple_debug_info("gtkconv", |
4803 "Suppressing message for an inactive conversation in pidgin_conv_write_im()\n"); | 4803 "Suppressing message for an inactive conversation in pidgin_conv_write_im()\n"); |
4804 return; | 4804 return; |
4805 } | 4805 } |
4806 | 4806 |
4807 gaim_conversation_write(conv, who, message, flags, mtime); | 4807 purple_conversation_write(conv, who, message, flags, mtime); |
4808 } | 4808 } |
4809 | 4809 |
4810 /* The callback for an event on a link tag. */ | 4810 /* The callback for an event on a link tag. */ |
4811 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, | 4811 static gboolean buddytag_event(GtkTextTag *tag, GObject *imhtml, |
4812 GdkEvent *event, GtkTextIter *arg2, gpointer data) { | 4812 GdkEvent *event, GtkTextIter *arg2, gpointer data) { |
4813 if (event->type == GDK_BUTTON_PRESS | 4813 if (event->type == GDK_BUTTON_PRESS |
4814 || event->type == GDK_2BUTTON_PRESS) { | 4814 || event->type == GDK_2BUTTON_PRESS) { |
4815 GdkEventButton *btn_event = (GdkEventButton*) event; | 4815 GdkEventButton *btn_event = (GdkEventButton*) event; |
4816 GaimConversation *conv = data; | 4816 PurpleConversation *conv = data; |
4817 char *buddyname; | 4817 char *buddyname; |
4818 | 4818 |
4819 /* strlen("BUDDY ") == 6 */ | 4819 /* strlen("BUDDY ") == 6 */ |
4820 g_return_val_if_fail((tag->name != NULL) | 4820 g_return_val_if_fail((tag->name != NULL) |
4821 && (strlen(tag->name) > 6), FALSE); | 4821 && (strlen(tag->name) > 6), FALSE); |
4835 * if the user has selected something: */ | 4835 * if the user has selected something: */ |
4836 if (!gtk_text_buffer_get_selection_bounds( | 4836 if (!gtk_text_buffer_get_selection_bounds( |
4837 gtk_text_iter_get_buffer(arg2), | 4837 gtk_text_iter_get_buffer(arg2), |
4838 &start, &end)) { | 4838 &start, &end)) { |
4839 GtkWidget *menu = NULL; | 4839 GtkWidget *menu = NULL; |
4840 GaimConnection *gc = | 4840 PurpleConnection *gc = |
4841 gaim_conversation_get_gc(conv); | 4841 purple_conversation_get_gc(conv); |
4842 | 4842 |
4843 | 4843 |
4844 menu = create_chat_menu(conv, buddyname, gc); | 4844 menu = create_chat_menu(conv, buddyname, gc); |
4845 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, | 4845 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
4846 NULL, GTK_WIDGET(imhtml), | 4846 NULL, GTK_WIDGET(imhtml), |
4854 } | 4854 } |
4855 | 4855 |
4856 return FALSE; | 4856 return FALSE; |
4857 } | 4857 } |
4858 | 4858 |
4859 static GtkTextTag *get_buddy_tag(GaimConversation *conv, const char *who) { | 4859 static GtkTextTag *get_buddy_tag(PurpleConversation *conv, const char *who) { |
4860 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 4860 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
4861 GtkTextTag *buddytag; | 4861 GtkTextTag *buddytag; |
4862 gchar *str; | 4862 gchar *str; |
4863 | 4863 |
4864 str = g_strdup_printf("BUDDY %s", who); | 4864 str = g_strdup_printf("BUDDY %s", who); |
4889 | 4889 |
4890 gtkconv->newday = mktime(tm); | 4890 gtkconv->newday = mktime(tm); |
4891 } | 4891 } |
4892 | 4892 |
4893 static void | 4893 static void |
4894 pidgin_conv_write_conv(GaimConversation *conv, const char *name, const char *alias, | 4894 pidgin_conv_write_conv(PurpleConversation *conv, const char *name, const char *alias, |
4895 const char *message, GaimMessageFlags flags, | 4895 const char *message, PurpleMessageFlags flags, |
4896 time_t mtime) | 4896 time_t mtime) |
4897 { | 4897 { |
4898 PidginConversation *gtkconv; | 4898 PidginConversation *gtkconv; |
4899 PidginWindow *win; | 4899 PidginWindow *win; |
4900 GaimConnection *gc; | 4900 PurpleConnection *gc; |
4901 GaimAccount *account; | 4901 PurpleAccount *account; |
4902 GaimPluginProtocolInfo *prpl_info; | 4902 PurplePluginProtocolInfo *prpl_info; |
4903 int gtk_font_options = 0; | 4903 int gtk_font_options = 0; |
4904 int gtk_font_options_all = 0; | 4904 int gtk_font_options_all = 0; |
4905 int max_scrollback_lines; | 4905 int max_scrollback_lines; |
4906 int line_count; | 4906 int line_count; |
4907 char buf2[BUF_LONG]; | 4907 char buf2[BUF_LONG]; |
4910 char color[10]; | 4910 char color[10]; |
4911 char *str; | 4911 char *str; |
4912 char *with_font_tag; | 4912 char *with_font_tag; |
4913 char *sml_attrib = NULL; | 4913 char *sml_attrib = NULL; |
4914 size_t length; | 4914 size_t length; |
4915 GaimConversationType type; | 4915 PurpleConversationType type; |
4916 char *displaying; | 4916 char *displaying; |
4917 gboolean plugin_return; | 4917 gboolean plugin_return; |
4918 char *bracket; | 4918 char *bracket; |
4919 int tag_count = 0; | 4919 int tag_count = 0; |
4920 | 4920 |
4922 gtkconv = PIDGIN_CONVERSATION(conv); | 4922 gtkconv = PIDGIN_CONVERSATION(conv); |
4923 g_return_if_fail(gtkconv != NULL); | 4923 g_return_if_fail(gtkconv != NULL); |
4924 | 4924 |
4925 if (conv != gtkconv->active_conv) | 4925 if (conv != gtkconv->active_conv) |
4926 { | 4926 { |
4927 if (flags & GAIM_MESSAGE_ACTIVE_ONLY) | 4927 if (flags & PURPLE_MESSAGE_ACTIVE_ONLY) |
4928 { | 4928 { |
4929 /* Unless this had GAIM_MESSAGE_NO_LOG, this message | 4929 /* Unless this had PURPLE_MESSAGE_NO_LOG, this message |
4930 * was logged. Plugin writers: if this isn't what | 4930 * was logged. Plugin writers: if this isn't what |
4931 * you wanted, call gaim_conv_im_write() instead of | 4931 * you wanted, call purple_conv_im_write() instead of |
4932 * gaim_conversation_write(). */ | 4932 * purple_conversation_write(). */ |
4933 gaim_debug_info("gtkconv", | 4933 purple_debug_info("gtkconv", |
4934 "Suppressing message for an inactive conversation in pidgin_conv_write_conv()\n"); | 4934 "Suppressing message for an inactive conversation in pidgin_conv_write_conv()\n"); |
4935 return; | 4935 return; |
4936 } | 4936 } |
4937 | 4937 |
4938 /* Set the active conversation to the one that just messaged us. */ | 4938 /* Set the active conversation to the one that just messaged us. */ |
4939 /* TODO: consider not doing this if the account is offline or something */ | 4939 /* TODO: consider not doing this if the account is offline or something */ |
4940 if (flags & (GAIM_MESSAGE_SEND | GAIM_MESSAGE_RECV)) | 4940 if (flags & (PURPLE_MESSAGE_SEND | PURPLE_MESSAGE_RECV)) |
4941 pidgin_conv_switch_active_conversation(conv); | 4941 pidgin_conv_switch_active_conversation(conv); |
4942 } | 4942 } |
4943 | 4943 |
4944 type = gaim_conversation_get_type(conv); | 4944 type = purple_conversation_get_type(conv); |
4945 account = gaim_conversation_get_account(conv); | 4945 account = purple_conversation_get_account(conv); |
4946 g_return_if_fail(account != NULL); | 4946 g_return_if_fail(account != NULL); |
4947 gc = gaim_account_get_connection(account); | 4947 gc = purple_account_get_connection(account); |
4948 g_return_if_fail(gc != NULL); | 4948 g_return_if_fail(gc != NULL); |
4949 | 4949 |
4950 /* Make sure URLs are clickable */ | 4950 /* Make sure URLs are clickable */ |
4951 displaying = gaim_markup_linkify(message); | 4951 displaying = purple_markup_linkify(message); |
4952 plugin_return = GPOINTER_TO_INT(gaim_signal_emit_return_1( | 4952 plugin_return = GPOINTER_TO_INT(purple_signal_emit_return_1( |
4953 pidgin_conversations_get_handle(), (type == GAIM_CONV_TYPE_IM ? | 4953 pidgin_conversations_get_handle(), (type == PURPLE_CONV_TYPE_IM ? |
4954 "displaying-im-msg" : "displaying-chat-msg"), | 4954 "displaying-im-msg" : "displaying-chat-msg"), |
4955 account, name, &displaying, conv, flags)); | 4955 account, name, &displaying, conv, flags)); |
4956 if (plugin_return) | 4956 if (plugin_return) |
4957 { | 4957 { |
4958 g_free(displaying); | 4958 g_free(displaying); |
4967 for (bracket = strchr(displaying, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<')) | 4967 for (bracket = strchr(displaying, '<'); bracket && *(bracket + 1); bracket = strchr(bracket + 1, '<')) |
4968 tag_count++; | 4968 tag_count++; |
4969 | 4969 |
4970 if (tag_count > 100) { | 4970 if (tag_count > 100) { |
4971 char *tmp = displaying; | 4971 char *tmp = displaying; |
4972 displaying = gaim_markup_strip_html(tmp); | 4972 displaying = purple_markup_strip_html(tmp); |
4973 g_free(tmp); | 4973 g_free(tmp); |
4974 } | 4974 } |
4975 | 4975 |
4976 win = gtkconv->win; | 4976 win = gtkconv->win; |
4977 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 4977 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
4978 | 4978 |
4979 line_count = gtk_text_buffer_get_line_count( | 4979 line_count = gtk_text_buffer_get_line_count( |
4980 gtk_text_view_get_buffer(GTK_TEXT_VIEW( | 4980 gtk_text_view_get_buffer(GTK_TEXT_VIEW( |
4981 gtkconv->imhtml))); | 4981 gtkconv->imhtml))); |
4982 | 4982 |
4983 max_scrollback_lines = gaim_prefs_get_int( | 4983 max_scrollback_lines = purple_prefs_get_int( |
4984 "/gaim/gtk/conversations/scrollback_lines"); | 4984 "/purple/gtk/conversations/scrollback_lines"); |
4985 /* If we're sitting at more than 100 lines more than the | 4985 /* If we're sitting at more than 100 lines more than the |
4986 max scrollback, trim down to max scrollback */ | 4986 max scrollback, trim down to max scrollback */ |
4987 if (max_scrollback_lines > 0 | 4987 if (max_scrollback_lines > 0 |
4988 && line_count > (max_scrollback_lines + 100)) { | 4988 && line_count > (max_scrollback_lines + 100)) { |
4989 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( | 4989 GtkTextBuffer *text_buffer = gtk_text_view_get_buffer( |
4994 gtk_text_buffer_get_iter_at_line(text_buffer, &end, | 4994 gtk_text_buffer_get_iter_at_line(text_buffer, &end, |
4995 (line_count - max_scrollback_lines)); | 4995 (line_count - max_scrollback_lines)); |
4996 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); | 4996 gtk_imhtml_delete(GTK_IMHTML(gtkconv->imhtml), &start, &end); |
4997 } | 4997 } |
4998 | 4998 |
4999 if (type == GAIM_CONV_TYPE_CHAT) | 4999 if (type == PURPLE_CONV_TYPE_CHAT) |
5000 { | 5000 { |
5001 /* Create anchor for user */ | 5001 /* Create anchor for user */ |
5002 GtkTextIter iter; | 5002 GtkTextIter iter; |
5003 char *tmp = g_strconcat("user:", name, NULL); | 5003 char *tmp = g_strconcat("user:", name, NULL); |
5004 | 5004 |
5006 gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), | 5006 gtk_text_buffer_create_mark(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)), |
5007 tmp, &iter, TRUE); | 5007 tmp, &iter, TRUE); |
5008 g_free(tmp); | 5008 g_free(tmp); |
5009 } | 5009 } |
5010 | 5010 |
5011 if (gaim_prefs_get_bool("/gaim/gtk/conversations/use_smooth_scrolling")) | 5011 if (purple_prefs_get_bool("/purple/gtk/conversations/use_smooth_scrolling")) |
5012 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; | 5012 gtk_font_options_all |= GTK_IMHTML_USE_SMOOTHSCROLLING; |
5013 | 5013 |
5014 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) | 5014 if (gtk_text_buffer_get_char_count(gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)))) |
5015 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); | 5015 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), "<BR>", gtk_font_options_all); |
5016 | 5016 |
5020 | 5020 |
5021 /* Show the date on the first message in a new day, or if the message is | 5021 /* Show the date on the first message in a new day, or if the message is |
5022 * older than 20 minutes. */ | 5022 * older than 20 minutes. */ |
5023 show_date = (mtime >= gtkconv->newday) || (time(NULL) > mtime + 20*60); | 5023 show_date = (mtime >= gtkconv->newday) || (time(NULL) > mtime + 20*60); |
5024 | 5024 |
5025 mdate = gaim_signal_emit_return_1(pidgin_conversations_get_handle(), | 5025 mdate = purple_signal_emit_return_1(pidgin_conversations_get_handle(), |
5026 "conversation-timestamp", | 5026 "conversation-timestamp", |
5027 conv, mtime, show_date); | 5027 conv, mtime, show_date); |
5028 | 5028 |
5029 if (mdate == NULL) | 5029 if (mdate == NULL) |
5030 { | 5030 { |
5031 struct tm *tm = localtime(&mtime); | 5031 struct tm *tm = localtime(&mtime); |
5032 if (show_date) | 5032 if (show_date) |
5033 mdate = g_strdup(gaim_date_format_long(tm)); | 5033 mdate = g_strdup(purple_date_format_long(tm)); |
5034 else | 5034 else |
5035 mdate = g_strdup(gaim_time_format(tm)); | 5035 mdate = g_strdup(purple_time_format(tm)); |
5036 } | 5036 } |
5037 | 5037 |
5038 if (mtime >= gtkconv->newday) | 5038 if (mtime >= gtkconv->newday) |
5039 pidgin_conv_calculate_newday(gtkconv, mtime); | 5039 pidgin_conv_calculate_newday(gtkconv, mtime); |
5040 | 5040 |
5041 sml_attrib = g_strdup_printf("sml=\"%s\"", gaim_account_get_protocol_name(account)); | 5041 sml_attrib = g_strdup_printf("sml=\"%s\"", purple_account_get_protocol_name(account)); |
5042 | 5042 |
5043 gtk_font_options |= GTK_IMHTML_NO_COMMENTS; | 5043 gtk_font_options |= GTK_IMHTML_NO_COMMENTS; |
5044 | 5044 |
5045 if ((flags & GAIM_MESSAGE_RECV) && | 5045 if ((flags & PURPLE_MESSAGE_RECV) && |
5046 !gaim_prefs_get_bool("/gaim/gtk/conversations/show_incoming_formatting")) | 5046 !purple_prefs_get_bool("/purple/gtk/conversations/show_incoming_formatting")) |
5047 gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; | 5047 gtk_font_options |= GTK_IMHTML_NO_COLOURS | GTK_IMHTML_NO_FONTS | GTK_IMHTML_NO_SIZES | GTK_IMHTML_NO_FORMATTING; |
5048 | 5048 |
5049 /* this is gonna crash one day, I can feel it. */ | 5049 /* this is gonna crash one day, I can feel it. */ |
5050 if (GAIM_PLUGIN_PROTOCOL_INFO(gaim_find_prpl(gaim_account_get_protocol_id(conv->account)))->options & | 5050 if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_find_prpl(purple_account_get_protocol_id(conv->account)))->options & |
5051 OPT_PROTO_USE_POINTSIZE) { | 5051 OPT_PROTO_USE_POINTSIZE) { |
5052 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; | 5052 gtk_font_options |= GTK_IMHTML_USE_POINTSIZE; |
5053 } | 5053 } |
5054 | 5054 |
5055 | 5055 |
5056 /* TODO: These colors should not be hardcoded so log.c can use them */ | 5056 /* TODO: These colors should not be hardcoded so log.c can use them */ |
5057 if (flags & GAIM_MESSAGE_RAW) { | 5057 if (flags & PURPLE_MESSAGE_RAW) { |
5058 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all); | 5058 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), message, gtk_font_options_all); |
5059 } else if (flags & GAIM_MESSAGE_SYSTEM) { | 5059 } else if (flags & PURPLE_MESSAGE_SYSTEM) { |
5060 g_snprintf(buf2, sizeof(buf2), | 5060 g_snprintf(buf2, sizeof(buf2), |
5061 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", | 5061 "<FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT>", |
5062 sml_attrib ? sml_attrib : "", mdate, displaying); | 5062 sml_attrib ? sml_attrib : "", mdate, displaying); |
5063 | 5063 |
5064 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); | 5064 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
5065 | 5065 |
5066 } else if (flags & GAIM_MESSAGE_ERROR) { | 5066 } else if (flags & PURPLE_MESSAGE_ERROR) { |
5067 g_snprintf(buf2, sizeof(buf2), | 5067 g_snprintf(buf2, sizeof(buf2), |
5068 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", | 5068 "<FONT COLOR=\"#ff0000\"><FONT %s><FONT SIZE=\"2\"><!--(%s) --></FONT><B>%s</B></FONT></FONT>", |
5069 sml_attrib ? sml_attrib : "", mdate, displaying); | 5069 sml_attrib ? sml_attrib : "", mdate, displaying); |
5070 | 5070 |
5071 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); | 5071 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
5072 | 5072 |
5073 } else if (flags & GAIM_MESSAGE_NO_LOG) { | 5073 } else if (flags & PURPLE_MESSAGE_NO_LOG) { |
5074 g_snprintf(buf2, BUF_LONG, | 5074 g_snprintf(buf2, BUF_LONG, |
5075 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", | 5075 "<B><FONT %s COLOR=\"#777777\">%s</FONT></B>", |
5076 sml_attrib ? sml_attrib : "", displaying); | 5076 sml_attrib ? sml_attrib : "", displaying); |
5077 | 5077 |
5078 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); | 5078 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
5084 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0; | 5084 int tag_start_offset = alias ? (strlen(alias_escaped) - strlen(alias)) : 0; |
5085 int tag_end_offset = 0; | 5085 int tag_end_offset = 0; |
5086 GtkSmileyTree *tree = NULL; | 5086 GtkSmileyTree *tree = NULL; |
5087 GHashTable *smiley_data = NULL; | 5087 GHashTable *smiley_data = NULL; |
5088 | 5088 |
5089 if (flags & GAIM_MESSAGE_SEND) | 5089 if (flags & PURPLE_MESSAGE_SEND) |
5090 { | 5090 { |
5091 /* Temporarily revert to the original smiley-data to avoid showing up | 5091 /* Temporarily revert to the original smiley-data to avoid showing up |
5092 * custom smileys of the buddy when sending message | 5092 * custom smileys of the buddy when sending message |
5093 */ | 5093 */ |
5094 tree = GTK_IMHTML(gtkconv->imhtml)->default_smilies; | 5094 tree = GTK_IMHTML(gtkconv->imhtml)->default_smilies; |
5096 GTK_IMHTML(gtkconv->entry)->default_smilies; | 5096 GTK_IMHTML(gtkconv->entry)->default_smilies; |
5097 smiley_data = GTK_IMHTML(gtkconv->imhtml)->smiley_data; | 5097 smiley_data = GTK_IMHTML(gtkconv->imhtml)->smiley_data; |
5098 GTK_IMHTML(gtkconv->imhtml)->smiley_data = GTK_IMHTML(gtkconv->entry)->smiley_data; | 5098 GTK_IMHTML(gtkconv->imhtml)->smiley_data = GTK_IMHTML(gtkconv->entry)->smiley_data; |
5099 } | 5099 } |
5100 | 5100 |
5101 if (flags & GAIM_MESSAGE_WHISPER) { | 5101 if (flags & PURPLE_MESSAGE_WHISPER) { |
5102 str = g_malloc(1024); | 5102 str = g_malloc(1024); |
5103 | 5103 |
5104 /* If we're whispering, it's not an autoresponse. */ | 5104 /* If we're whispering, it's not an autoresponse. */ |
5105 if (gaim_message_meify(new_message, -1 )) { | 5105 if (purple_message_meify(new_message, -1 )) { |
5106 g_snprintf(str, 1024, "***%s", alias_escaped); | 5106 g_snprintf(str, 1024, "***%s", alias_escaped); |
5107 strcpy(color, "#6C2585"); | 5107 strcpy(color, "#6C2585"); |
5108 tag_start_offset += 3; | 5108 tag_start_offset += 3; |
5109 } | 5109 } |
5110 else { | 5110 else { |
5113 tag_end_offset = 2; | 5113 tag_end_offset = 2; |
5114 strcpy(color, "#00FF00"); | 5114 strcpy(color, "#00FF00"); |
5115 } | 5115 } |
5116 } | 5116 } |
5117 else { | 5117 else { |
5118 if (gaim_message_meify(new_message, -1)) { | 5118 if (purple_message_meify(new_message, -1)) { |
5119 str = g_malloc(1024); | 5119 str = g_malloc(1024); |
5120 | 5120 |
5121 if (flags & GAIM_MESSAGE_AUTO_RESP) { | 5121 if (flags & PURPLE_MESSAGE_AUTO_RESP) { |
5122 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped); | 5122 g_snprintf(str, 1024, "%s ***%s", AUTO_RESPONSE, alias_escaped); |
5123 tag_start_offset += 4 | 5123 tag_start_offset += 4 |
5124 + strlen(AUTO_RESPONSE); | 5124 + strlen(AUTO_RESPONSE); |
5125 } else { | 5125 } else { |
5126 g_snprintf(str, 1024, "***%s", alias_escaped); | 5126 g_snprintf(str, 1024, "***%s", alias_escaped); |
5127 tag_start_offset += 3; | 5127 tag_start_offset += 3; |
5128 } | 5128 } |
5129 | 5129 |
5130 if (flags & GAIM_MESSAGE_NICK) | 5130 if (flags & PURPLE_MESSAGE_NICK) |
5131 strcpy(color, HIGHLIGHT_COLOR); | 5131 strcpy(color, HIGHLIGHT_COLOR); |
5132 else | 5132 else |
5133 strcpy(color, "#062585"); | 5133 strcpy(color, "#062585"); |
5134 } | 5134 } |
5135 else { | 5135 else { |
5136 str = g_malloc(1024); | 5136 str = g_malloc(1024); |
5137 if (flags & GAIM_MESSAGE_AUTO_RESP) { | 5137 if (flags & PURPLE_MESSAGE_AUTO_RESP) { |
5138 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE); | 5138 g_snprintf(str, 1024, "%s %s", alias_escaped, AUTO_RESPONSE); |
5139 tag_start_offset += 1 | 5139 tag_start_offset += 1 |
5140 + strlen(AUTO_RESPONSE); | 5140 + strlen(AUTO_RESPONSE); |
5141 } else { | 5141 } else { |
5142 g_snprintf(str, 1024, "%s:", alias_escaped); | 5142 g_snprintf(str, 1024, "%s:", alias_escaped); |
5143 tag_end_offset = 1; | 5143 tag_end_offset = 1; |
5144 } | 5144 } |
5145 if (flags & GAIM_MESSAGE_NICK) | 5145 if (flags & PURPLE_MESSAGE_NICK) |
5146 strcpy(color, HIGHLIGHT_COLOR); | 5146 strcpy(color, HIGHLIGHT_COLOR); |
5147 else if (flags & GAIM_MESSAGE_RECV) { | 5147 else if (flags & PURPLE_MESSAGE_RECV) { |
5148 if (type == GAIM_CONV_TYPE_CHAT) { | 5148 if (type == PURPLE_CONV_TYPE_CHAT) { |
5149 GdkColor *col = get_nick_color(gtkconv, name); | 5149 GdkColor *col = get_nick_color(gtkconv, name); |
5150 | 5150 |
5151 g_snprintf(color, sizeof(color), "#%02X%02X%02X", | 5151 g_snprintf(color, sizeof(color), "#%02X%02X%02X", |
5152 col->red >> 8, col->green >> 8, col->blue >> 8); | 5152 col->red >> 8, col->green >> 8, col->blue >> 8); |
5153 } else | 5153 } else |
5154 strcpy(color, RECV_COLOR); | 5154 strcpy(color, RECV_COLOR); |
5155 } | 5155 } |
5156 else if (flags & GAIM_MESSAGE_SEND) | 5156 else if (flags & PURPLE_MESSAGE_SEND) |
5157 strcpy(color, SEND_COLOR); | 5157 strcpy(color, SEND_COLOR); |
5158 else { | 5158 else { |
5159 gaim_debug_error("gtkconv", "message missing flags\n"); | 5159 purple_debug_error("gtkconv", "message missing flags\n"); |
5160 strcpy(color, "#000000"); | 5160 strcpy(color, "#000000"); |
5161 } | 5161 } |
5162 } | 5162 } |
5163 } | 5163 } |
5164 | 5164 |
5165 g_free(alias_escaped); | 5165 g_free(alias_escaped); |
5166 | 5166 |
5167 /* Are we in a chat where we can tell which users are buddies? */ | 5167 /* Are we in a chat where we can tell which users are buddies? */ |
5168 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && | 5168 if (!(prpl_info->options & OPT_PROTO_UNIQUE_CHATNAME) && |
5169 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 5169 purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
5170 | 5170 |
5171 /* Bold buddies to make them stand out from non-buddies. */ | 5171 /* Bold buddies to make them stand out from non-buddies. */ |
5172 if (flags & GAIM_MESSAGE_SEND || | 5172 if (flags & PURPLE_MESSAGE_SEND || |
5173 flags & GAIM_MESSAGE_NICK || | 5173 flags & PURPLE_MESSAGE_NICK || |
5174 gaim_find_buddy(account, name) != NULL) { | 5174 purple_find_buddy(account, name) != NULL) { |
5175 g_snprintf(buf2, BUF_LONG, | 5175 g_snprintf(buf2, BUF_LONG, |
5176 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" | 5176 "<FONT COLOR=\"%s\" %s><FONT SIZE=\"2\"><!--(%s) --></FONT>" |
5177 "<B>%s</B></FONT> ", | 5177 "<B>%s</B></FONT> ", |
5178 color, sml_attrib ? sml_attrib : "", mdate, str); | 5178 color, sml_attrib ? sml_attrib : "", mdate, str); |
5179 } else { | 5179 } else { |
5191 color, sml_attrib ? sml_attrib : "", mdate, str); | 5191 color, sml_attrib ? sml_attrib : "", mdate, str); |
5192 } | 5192 } |
5193 | 5193 |
5194 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); | 5194 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), buf2, gtk_font_options_all); |
5195 | 5195 |
5196 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT && | 5196 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && |
5197 !(flags & GAIM_MESSAGE_SEND)) { | 5197 !(flags & PURPLE_MESSAGE_SEND)) { |
5198 | 5198 |
5199 GtkTextIter start, end; | 5199 GtkTextIter start, end; |
5200 GtkTextTag *buddytag = get_buddy_tag(conv, name); | 5200 GtkTextTag *buddytag = get_buddy_tag(conv, name); |
5201 | 5201 |
5202 gtk_text_buffer_get_end_iter( | 5202 gtk_text_buffer_get_end_iter( |
5237 with_font_tag = g_memdup(new_message, length); | 5237 with_font_tag = g_memdup(new_message, length); |
5238 | 5238 |
5239 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), | 5239 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->imhtml), |
5240 with_font_tag, gtk_font_options | gtk_font_options_all); | 5240 with_font_tag, gtk_font_options | gtk_font_options_all); |
5241 | 5241 |
5242 if (flags & GAIM_MESSAGE_SEND) | 5242 if (flags & PURPLE_MESSAGE_SEND) |
5243 { | 5243 { |
5244 /* Restore the smiley-data */ | 5244 /* Restore the smiley-data */ |
5245 GTK_IMHTML(gtkconv->imhtml)->default_smilies = tree; | 5245 GTK_IMHTML(gtkconv->imhtml)->default_smilies = tree; |
5246 GTK_IMHTML(gtkconv->imhtml)->smiley_data = smiley_data; | 5246 GTK_IMHTML(gtkconv->imhtml)->smiley_data = smiley_data; |
5247 } | 5247 } |
5252 | 5252 |
5253 g_free(mdate); | 5253 g_free(mdate); |
5254 g_free(sml_attrib); | 5254 g_free(sml_attrib); |
5255 | 5255 |
5256 /* Tab highlighting stuff */ | 5256 /* Tab highlighting stuff */ |
5257 if (!(flags & GAIM_MESSAGE_SEND) && !pidgin_conv_has_focus(conv)) | 5257 if (!(flags & PURPLE_MESSAGE_SEND) && !pidgin_conv_has_focus(conv)) |
5258 { | 5258 { |
5259 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE; | 5259 PidginUnseenState unseen = PIDGIN_UNSEEN_NONE; |
5260 | 5260 |
5261 if ((flags & GAIM_MESSAGE_NICK) == GAIM_MESSAGE_NICK) | 5261 if ((flags & PURPLE_MESSAGE_NICK) == PURPLE_MESSAGE_NICK) |
5262 unseen = PIDGIN_UNSEEN_NICK; | 5262 unseen = PIDGIN_UNSEEN_NICK; |
5263 else if (((flags & GAIM_MESSAGE_SYSTEM) == GAIM_MESSAGE_SYSTEM) || | 5263 else if (((flags & PURPLE_MESSAGE_SYSTEM) == PURPLE_MESSAGE_SYSTEM) || |
5264 ((flags & GAIM_MESSAGE_ERROR) == GAIM_MESSAGE_ERROR)) | 5264 ((flags & PURPLE_MESSAGE_ERROR) == PURPLE_MESSAGE_ERROR)) |
5265 unseen = PIDGIN_UNSEEN_EVENT; | 5265 unseen = PIDGIN_UNSEEN_EVENT; |
5266 else if ((flags & GAIM_MESSAGE_NO_LOG) == GAIM_MESSAGE_NO_LOG) | 5266 else if ((flags & PURPLE_MESSAGE_NO_LOG) == PURPLE_MESSAGE_NO_LOG) |
5267 unseen = PIDGIN_UNSEEN_NO_LOG; | 5267 unseen = PIDGIN_UNSEEN_NO_LOG; |
5268 else | 5268 else |
5269 unseen = PIDGIN_UNSEEN_TEXT; | 5269 unseen = PIDGIN_UNSEEN_TEXT; |
5270 | 5270 |
5271 gtkconv_set_unseen(gtkconv, unseen); | 5271 gtkconv_set_unseen(gtkconv, unseen); |
5272 } | 5272 } |
5273 | 5273 |
5274 gaim_signal_emit(pidgin_conversations_get_handle(), | 5274 purple_signal_emit(pidgin_conversations_get_handle(), |
5275 (type == GAIM_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), | 5275 (type == PURPLE_CONV_TYPE_IM ? "displayed-im-msg" : "displayed-chat-msg"), |
5276 account, name, displaying, conv, flags); | 5276 account, name, displaying, conv, flags); |
5277 g_free(displaying); | 5277 g_free(displaying); |
5278 } | 5278 } |
5279 static void | 5279 static void |
5280 pidgin_conv_chat_add_users(GaimConversation *conv, GList *cbuddies, gboolean new_arrivals) | 5280 pidgin_conv_chat_add_users(PurpleConversation *conv, GList *cbuddies, gboolean new_arrivals) |
5281 { | 5281 { |
5282 GaimConvChat *chat; | 5282 PurpleConvChat *chat; |
5283 PidginConversation *gtkconv; | 5283 PidginConversation *gtkconv; |
5284 PidginChatPane *gtkchat; | 5284 PidginChatPane *gtkchat; |
5285 GtkListStore *ls; | 5285 GtkListStore *ls; |
5286 GList *l; | 5286 GList *l; |
5287 | 5287 |
5288 char tmp[BUF_LONG]; | 5288 char tmp[BUF_LONG]; |
5289 int num_users; | 5289 int num_users; |
5290 | 5290 |
5291 chat = GAIM_CONV_CHAT(conv); | 5291 chat = PURPLE_CONV_CHAT(conv); |
5292 gtkconv = PIDGIN_CONVERSATION(conv); | 5292 gtkconv = PIDGIN_CONVERSATION(conv); |
5293 gtkchat = gtkconv->u.chat; | 5293 gtkchat = gtkconv->u.chat; |
5294 | 5294 |
5295 num_users = g_list_length(gaim_conv_chat_get_users(chat)); | 5295 num_users = g_list_length(purple_conv_chat_get_users(chat)); |
5296 | 5296 |
5297 g_snprintf(tmp, sizeof(tmp), | 5297 g_snprintf(tmp, sizeof(tmp), |
5298 ngettext("%d person in room", "%d people in room", | 5298 ngettext("%d person in room", "%d people in room", |
5299 num_users), | 5299 num_users), |
5300 num_users); | 5300 num_users); |
5308 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID); | 5308 GTK_TREE_SORTABLE_UNSORTED_SORT_COLUMN_ID); |
5309 #endif | 5309 #endif |
5310 | 5310 |
5311 l = cbuddies; | 5311 l = cbuddies; |
5312 while (l != NULL) { | 5312 while (l != NULL) { |
5313 add_chat_buddy_common(conv, (GaimConvChatBuddy *)l->data, NULL); | 5313 add_chat_buddy_common(conv, (PurpleConvChatBuddy *)l->data, NULL); |
5314 l = l->next; | 5314 l = l->next; |
5315 } | 5315 } |
5316 | 5316 |
5317 /* Currently GTK+ maintains our sorted list after it's in the tree. | 5317 /* Currently GTK+ maintains our sorted list after it's in the tree. |
5318 * This may change if it turns out we can manage it faster ourselves. | 5318 * This may change if it turns out we can manage it faster ourselves. |
5320 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, | 5320 gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(ls), CHAT_USERS_ALIAS_KEY_COLUMN, |
5321 GTK_SORT_ASCENDING); | 5321 GTK_SORT_ASCENDING); |
5322 } | 5322 } |
5323 | 5323 |
5324 static void | 5324 static void |
5325 pidgin_conv_chat_rename_user(GaimConversation *conv, const char *old_name, | 5325 pidgin_conv_chat_rename_user(PurpleConversation *conv, const char *old_name, |
5326 const char *new_name, const char *new_alias) | 5326 const char *new_name, const char *new_alias) |
5327 { | 5327 { |
5328 GaimConvChat *chat; | 5328 PurpleConvChat *chat; |
5329 PidginConversation *gtkconv; | 5329 PidginConversation *gtkconv; |
5330 PidginChatPane *gtkchat; | 5330 PidginChatPane *gtkchat; |
5331 GaimConvChatBuddyFlags flags; | 5331 PurpleConvChatBuddyFlags flags; |
5332 GaimConvChatBuddy *cbuddy; | 5332 PurpleConvChatBuddy *cbuddy; |
5333 GtkTreeIter iter; | 5333 GtkTreeIter iter; |
5334 GtkTreeModel *model; | 5334 GtkTreeModel *model; |
5335 int f = 1; | 5335 int f = 1; |
5336 | 5336 |
5337 chat = GAIM_CONV_CHAT(conv); | 5337 chat = PURPLE_CONV_CHAT(conv); |
5338 gtkconv = PIDGIN_CONVERSATION(conv); | 5338 gtkconv = PIDGIN_CONVERSATION(conv); |
5339 gtkchat = gtkconv->u.chat; | 5339 gtkchat = gtkconv->u.chat; |
5340 | 5340 |
5341 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 5341 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5342 | 5342 |
5346 while (f != 0) { | 5346 while (f != 0) { |
5347 char *val; | 5347 char *val; |
5348 | 5348 |
5349 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1); | 5349 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, CHAT_USERS_FLAGS_COLUMN, &flags, -1); |
5350 | 5350 |
5351 if (!gaim_utf8_strcasecmp(old_name, val)) { | 5351 if (!purple_utf8_strcasecmp(old_name, val)) { |
5352 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 5352 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5353 g_free(val); | 5353 g_free(val); |
5354 break; | 5354 break; |
5355 } | 5355 } |
5356 | 5356 |
5357 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | 5357 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
5358 | 5358 |
5359 g_free(val); | 5359 g_free(val); |
5360 } | 5360 } |
5361 | 5361 |
5362 if (!gaim_conv_chat_find_user(chat, old_name)) | 5362 if (!purple_conv_chat_find_user(chat, old_name)) |
5363 return; | 5363 return; |
5364 | 5364 |
5365 g_return_if_fail(new_alias != NULL); | 5365 g_return_if_fail(new_alias != NULL); |
5366 | 5366 |
5367 cbuddy = gaim_conv_chat_cb_new(new_name, new_alias, flags); | 5367 cbuddy = purple_conv_chat_cb_new(new_name, new_alias, flags); |
5368 | 5368 |
5369 add_chat_buddy_common(conv, cbuddy, old_name); | 5369 add_chat_buddy_common(conv, cbuddy, old_name); |
5370 } | 5370 } |
5371 | 5371 |
5372 static void | 5372 static void |
5373 pidgin_conv_chat_remove_users(GaimConversation *conv, GList *users) | 5373 pidgin_conv_chat_remove_users(PurpleConversation *conv, GList *users) |
5374 { | 5374 { |
5375 GaimConvChat *chat; | 5375 PurpleConvChat *chat; |
5376 PidginConversation *gtkconv; | 5376 PidginConversation *gtkconv; |
5377 PidginChatPane *gtkchat; | 5377 PidginChatPane *gtkchat; |
5378 GtkTreeIter iter; | 5378 GtkTreeIter iter; |
5379 GtkTreeModel *model; | 5379 GtkTreeModel *model; |
5380 GList *l; | 5380 GList *l; |
5381 char tmp[BUF_LONG]; | 5381 char tmp[BUF_LONG]; |
5382 int num_users; | 5382 int num_users; |
5383 gboolean f; | 5383 gboolean f; |
5384 | 5384 |
5385 chat = GAIM_CONV_CHAT(conv); | 5385 chat = PURPLE_CONV_CHAT(conv); |
5386 gtkconv = PIDGIN_CONVERSATION(conv); | 5386 gtkconv = PIDGIN_CONVERSATION(conv); |
5387 gtkchat = gtkconv->u.chat; | 5387 gtkchat = gtkconv->u.chat; |
5388 | 5388 |
5389 num_users = g_list_length(gaim_conv_chat_get_users(chat)); | 5389 num_users = g_list_length(purple_conv_chat_get_users(chat)); |
5390 | 5390 |
5391 for (l = users; l != NULL; l = l->next) { | 5391 for (l = users; l != NULL; l = l->next) { |
5392 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 5392 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5393 | 5393 |
5394 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) | 5394 if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(model), &iter)) |
5398 char *val; | 5398 char *val; |
5399 | 5399 |
5400 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, | 5400 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, |
5401 CHAT_USERS_NAME_COLUMN, &val, -1); | 5401 CHAT_USERS_NAME_COLUMN, &val, -1); |
5402 | 5402 |
5403 if (!gaim_utf8_strcasecmp((char *)l->data, val)) { | 5403 if (!purple_utf8_strcasecmp((char *)l->data, val)) { |
5404 #if GTK_CHECK_VERSION(2,2,0) | 5404 #if GTK_CHECK_VERSION(2,2,0) |
5405 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 5405 f = gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5406 #else | 5406 #else |
5407 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 5407 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5408 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | 5408 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
5421 | 5421 |
5422 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); | 5422 gtk_label_set_text(GTK_LABEL(gtkchat->count), tmp); |
5423 } | 5423 } |
5424 | 5424 |
5425 static void | 5425 static void |
5426 pidgin_conv_chat_update_user(GaimConversation *conv, const char *user) | 5426 pidgin_conv_chat_update_user(PurpleConversation *conv, const char *user) |
5427 { | 5427 { |
5428 GaimConvChat *chat; | 5428 PurpleConvChat *chat; |
5429 GaimConvChatBuddyFlags flags; | 5429 PurpleConvChatBuddyFlags flags; |
5430 GaimConvChatBuddy *cbuddy; | 5430 PurpleConvChatBuddy *cbuddy; |
5431 PidginConversation *gtkconv; | 5431 PidginConversation *gtkconv; |
5432 PidginChatPane *gtkchat; | 5432 PidginChatPane *gtkchat; |
5433 GtkTreeIter iter; | 5433 GtkTreeIter iter; |
5434 GtkTreeModel *model; | 5434 GtkTreeModel *model; |
5435 int f = 1; | 5435 int f = 1; |
5436 char *alias = NULL; | 5436 char *alias = NULL; |
5437 | 5437 |
5438 chat = GAIM_CONV_CHAT(conv); | 5438 chat = PURPLE_CONV_CHAT(conv); |
5439 gtkconv = PIDGIN_CONVERSATION(conv); | 5439 gtkconv = PIDGIN_CONVERSATION(conv); |
5440 gtkchat = gtkconv->u.chat; | 5440 gtkchat = gtkconv->u.chat; |
5441 | 5441 |
5442 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); | 5442 model = gtk_tree_view_get_model(GTK_TREE_VIEW(gtkchat->list)); |
5443 | 5443 |
5447 while (f != 0) { | 5447 while (f != 0) { |
5448 char *val; | 5448 char *val; |
5449 | 5449 |
5450 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); | 5450 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_NAME_COLUMN, &val, -1); |
5451 | 5451 |
5452 if (!gaim_utf8_strcasecmp(user, val)) { | 5452 if (!purple_utf8_strcasecmp(user, val)) { |
5453 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1); | 5453 gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, CHAT_USERS_ALIAS_COLUMN, &alias, -1); |
5454 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); | 5454 gtk_list_store_remove(GTK_LIST_STORE(model), &iter); |
5455 g_free(val); | 5455 g_free(val); |
5456 break; | 5456 break; |
5457 } | 5457 } |
5459 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); | 5459 f = gtk_tree_model_iter_next(GTK_TREE_MODEL(model), &iter); |
5460 | 5460 |
5461 g_free(val); | 5461 g_free(val); |
5462 } | 5462 } |
5463 | 5463 |
5464 if (!gaim_conv_chat_find_user(chat, user)) | 5464 if (!purple_conv_chat_find_user(chat, user)) |
5465 { | 5465 { |
5466 g_free(alias); | 5466 g_free(alias); |
5467 return; | 5467 return; |
5468 } | 5468 } |
5469 | 5469 |
5470 g_return_if_fail(alias != NULL); | 5470 g_return_if_fail(alias != NULL); |
5471 | 5471 |
5472 flags = gaim_conv_chat_user_get_flags(chat, user); | 5472 flags = purple_conv_chat_user_get_flags(chat, user); |
5473 | 5473 |
5474 cbuddy = gaim_conv_chat_cb_new(user, alias, flags); | 5474 cbuddy = purple_conv_chat_cb_new(user, alias, flags); |
5475 | 5475 |
5476 add_chat_buddy_common(conv, cbuddy, NULL); | 5476 add_chat_buddy_common(conv, cbuddy, NULL); |
5477 g_free(alias); | 5477 g_free(alias); |
5478 } | 5478 } |
5479 | 5479 |
5480 gboolean | 5480 gboolean |
5481 pidgin_conv_has_focus(GaimConversation *conv) | 5481 pidgin_conv_has_focus(PurpleConversation *conv) |
5482 { | 5482 { |
5483 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 5483 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
5484 PidginWindow *win; | 5484 PidginWindow *win; |
5485 gboolean has_focus; | 5485 gboolean has_focus; |
5486 | 5486 |
5502 smiley->icon = gdk_pixbuf_loader_get_animation(loader); | 5502 smiley->icon = gdk_pixbuf_loader_get_animation(loader); |
5503 | 5503 |
5504 if (smiley->icon) | 5504 if (smiley->icon) |
5505 g_object_ref(G_OBJECT(smiley->icon)); | 5505 g_object_ref(G_OBJECT(smiley->icon)); |
5506 #ifdef DEBUG_CUSTOM_SMILEY | 5506 #ifdef DEBUG_CUSTOM_SMILEY |
5507 gaim_debug_info("custom-smiley", "pidgin_conv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile); | 5507 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_allocated(): got GdkPixbufAnimation %p for smiley '%s'\n", smiley->icon, smiley->smile); |
5508 #endif | 5508 #endif |
5509 } | 5509 } |
5510 | 5510 |
5511 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data) | 5511 static void pidgin_conv_custom_smiley_closed(GdkPixbufLoader *loader, gpointer user_data) |
5512 { | 5512 { |
5516 GSList *current = NULL; | 5516 GSList *current = NULL; |
5517 | 5517 |
5518 smiley = (GtkIMHtmlSmiley *)user_data; | 5518 smiley = (GtkIMHtmlSmiley *)user_data; |
5519 if (!smiley->imhtml) { | 5519 if (!smiley->imhtml) { |
5520 #ifdef DEBUG_CUSTOM_SMILEY | 5520 #ifdef DEBUG_CUSTOM_SMILEY |
5521 gaim_debug_error("custom-smiley", "pidgin_conv_custom_smiley_closed(): orphan smiley found: %p\n", smiley); | 5521 purple_debug_error("custom-smiley", "pidgin_conv_custom_smiley_closed(): orphan smiley found: %p\n", smiley); |
5522 #endif | 5522 #endif |
5523 g_object_unref(G_OBJECT(loader)); | 5523 g_object_unref(G_OBJECT(loader)); |
5524 smiley->loader = NULL; | 5524 smiley->loader = NULL; |
5525 return; | 5525 return; |
5526 } | 5526 } |
5528 for (current = smiley->anchors; current; current = g_slist_next(current)) { | 5528 for (current = smiley->anchors; current; current = g_slist_next(current)) { |
5529 | 5529 |
5530 icon = gtk_image_new_from_animation(smiley->icon); | 5530 icon = gtk_image_new_from_animation(smiley->icon); |
5531 | 5531 |
5532 #ifdef DEBUG_CUSTOM_SMILEY | 5532 #ifdef DEBUG_CUSTOM_SMILEY |
5533 gaim_debug_info("custom-smiley", "pidgin_conv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n", | 5533 purple_debug_info("custom-smiley", "pidgin_conv_custom_smiley_closed(): got GtkImage %p from GtkPixbufAnimation %p for smiley '%s'\n", |
5534 icon, smiley->icon, smiley->smile); | 5534 icon, smiley->icon, smiley->smile); |
5535 #endif | 5535 #endif |
5536 if (icon) { | 5536 if (icon) { |
5537 gtk_widget_show(icon); | 5537 gtk_widget_show(icon); |
5538 | 5538 |
5539 anchor = GTK_TEXT_CHILD_ANCHOR(current->data); | 5539 anchor = GTK_TEXT_CHILD_ANCHOR(current->data); |
5540 | 5540 |
5541 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", gaim_unescape_html(smiley->smile), g_free); | 5541 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_plaintext", purple_unescape_html(smiley->smile), g_free); |
5542 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free); | 5542 g_object_set_data_full(G_OBJECT(anchor), "gtkimhtml_htmltext", g_strdup(smiley->smile), g_free); |
5543 | 5543 |
5544 if (smiley->imhtml) | 5544 if (smiley->imhtml) |
5545 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor); | 5545 gtk_text_view_add_child_at_anchor(GTK_TEXT_VIEW(smiley->imhtml), icon, anchor); |
5546 } | 5546 } |
5600 | 5600 |
5601 return TRUE; | 5601 return TRUE; |
5602 } | 5602 } |
5603 | 5603 |
5604 static gboolean | 5604 static gboolean |
5605 pidgin_conv_custom_smiley_add(GaimConversation *conv, const char *smile, gboolean remote) | 5605 pidgin_conv_custom_smiley_add(PurpleConversation *conv, const char *smile, gboolean remote) |
5606 { | 5606 { |
5607 PidginConversation *gtkconv; | 5607 PidginConversation *gtkconv; |
5608 struct smiley_list *list; | 5608 struct smiley_list *list; |
5609 const char *sml = NULL, *conv_sml; | 5609 const char *sml = NULL, *conv_sml; |
5610 | 5610 |
5616 if (pidginthemes_smileys_disabled()) | 5616 if (pidginthemes_smileys_disabled()) |
5617 return FALSE; | 5617 return FALSE; |
5618 | 5618 |
5619 /* If possible add this smiley to the current theme. | 5619 /* If possible add this smiley to the current theme. |
5620 * The addition is only temporary: custom smilies aren't saved to disk. */ | 5620 * The addition is only temporary: custom smilies aren't saved to disk. */ |
5621 conv_sml = gaim_account_get_protocol_name(conv->account); | 5621 conv_sml = purple_account_get_protocol_name(conv->account); |
5622 gtkconv = PIDGIN_CONVERSATION(conv); | 5622 gtkconv = PIDGIN_CONVERSATION(conv); |
5623 | 5623 |
5624 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { | 5624 for (list = (struct smiley_list *)current_smiley_theme->list; list; list = list->next) { |
5625 if (!strcmp(list->sml, conv_sml)) { | 5625 if (!strcmp(list->sml, conv_sml)) { |
5626 sml = list->sml; | 5626 sml = list->sml; |
5637 | 5637 |
5638 return TRUE; | 5638 return TRUE; |
5639 } | 5639 } |
5640 | 5640 |
5641 static void | 5641 static void |
5642 pidgin_conv_custom_smiley_write(GaimConversation *conv, const char *smile, | 5642 pidgin_conv_custom_smiley_write(PurpleConversation *conv, const char *smile, |
5643 const guchar *data, gsize size) | 5643 const guchar *data, gsize size) |
5644 { | 5644 { |
5645 PidginConversation *gtkconv; | 5645 PidginConversation *gtkconv; |
5646 GtkIMHtmlSmiley *smiley; | 5646 GtkIMHtmlSmiley *smiley; |
5647 GdkPixbufLoader *loader; | 5647 GdkPixbufLoader *loader; |
5648 const char *sml; | 5648 const char *sml; |
5649 | 5649 |
5650 sml = gaim_account_get_protocol_name(conv->account); | 5650 sml = purple_account_get_protocol_name(conv->account); |
5651 gtkconv = PIDGIN_CONVERSATION(conv); | 5651 gtkconv = PIDGIN_CONVERSATION(conv); |
5652 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); | 5652 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); |
5653 | 5653 |
5654 if (!smiley) | 5654 if (!smiley) |
5655 return; | 5655 return; |
5660 | 5660 |
5661 gdk_pixbuf_loader_write(loader, data, size, NULL); | 5661 gdk_pixbuf_loader_write(loader, data, size, NULL); |
5662 } | 5662 } |
5663 | 5663 |
5664 static void | 5664 static void |
5665 pidgin_conv_custom_smiley_close(GaimConversation *conv, const char *smile) | 5665 pidgin_conv_custom_smiley_close(PurpleConversation *conv, const char *smile) |
5666 { | 5666 { |
5667 PidginConversation *gtkconv; | 5667 PidginConversation *gtkconv; |
5668 GtkIMHtmlSmiley *smiley; | 5668 GtkIMHtmlSmiley *smiley; |
5669 GdkPixbufLoader *loader; | 5669 GdkPixbufLoader *loader; |
5670 const char *sml; | 5670 const char *sml; |
5671 | 5671 |
5672 g_return_if_fail(conv != NULL); | 5672 g_return_if_fail(conv != NULL); |
5673 g_return_if_fail(smile != NULL); | 5673 g_return_if_fail(smile != NULL); |
5674 | 5674 |
5675 sml = gaim_account_get_protocol_name(conv->account); | 5675 sml = purple_account_get_protocol_name(conv->account); |
5676 gtkconv = PIDGIN_CONVERSATION(conv); | 5676 gtkconv = PIDGIN_CONVERSATION(conv); |
5677 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); | 5677 smiley = gtk_imhtml_smiley_get(GTK_IMHTML(gtkconv->imhtml), sml, smile); |
5678 | 5678 |
5679 if (!smiley) | 5679 if (!smiley) |
5680 return; | 5680 return; |
5684 if (!loader) | 5684 if (!loader) |
5685 return; | 5685 return; |
5686 | 5686 |
5687 | 5687 |
5688 | 5688 |
5689 gaim_debug_info("gtkconv", "About to close the smiley pixbuf\n"); | 5689 purple_debug_info("gtkconv", "About to close the smiley pixbuf\n"); |
5690 | 5690 |
5691 gdk_pixbuf_loader_close(loader, NULL); | 5691 gdk_pixbuf_loader_close(loader, NULL); |
5692 | 5692 |
5693 } | 5693 } |
5694 | 5694 |
5695 static void | 5695 static void |
5696 pidgin_conv_send_confirm(GaimConversation *conv, const char *message) | 5696 pidgin_conv_send_confirm(PurpleConversation *conv, const char *message) |
5697 { | 5697 { |
5698 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); | 5698 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
5699 | 5699 |
5700 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); | 5700 gtk_imhtml_append_text(GTK_IMHTML(gtkconv->entry), message, 0); |
5701 } | 5701 } |
5707 */ | 5707 */ |
5708 static void | 5708 static void |
5709 gray_stuff_out(PidginConversation *gtkconv) | 5709 gray_stuff_out(PidginConversation *gtkconv) |
5710 { | 5710 { |
5711 PidginWindow *win; | 5711 PidginWindow *win; |
5712 GaimConversation *conv = gtkconv->active_conv; | 5712 PurpleConversation *conv = gtkconv->active_conv; |
5713 GaimConnection *gc; | 5713 PurpleConnection *gc; |
5714 GaimPluginProtocolInfo *prpl_info = NULL; | 5714 PurplePluginProtocolInfo *prpl_info = NULL; |
5715 GdkPixbuf *window_icon = NULL; | 5715 GdkPixbuf *window_icon = NULL; |
5716 GtkIMHtmlButtons buttons; | 5716 GtkIMHtmlButtons buttons; |
5717 GaimAccount *account; | 5717 PurpleAccount *account; |
5718 | 5718 |
5719 win = pidgin_conv_get_window(gtkconv); | 5719 win = pidgin_conv_get_window(gtkconv); |
5720 gc = gaim_conversation_get_gc(conv); | 5720 gc = purple_conversation_get_gc(conv); |
5721 account = gaim_conversation_get_account(conv); | 5721 account = purple_conversation_get_account(conv); |
5722 | 5722 |
5723 if (gc != NULL) | 5723 if (gc != NULL) |
5724 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(gc->prpl); | 5724 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); |
5725 | 5725 |
5726 if (win->menu.send_to != NULL) | 5726 if (win->menu.send_to != NULL) |
5727 update_send_to_selection(win); | 5727 update_send_to_selection(win); |
5728 | 5728 |
5729 /* | 5729 /* |
5730 * Handle hiding and showing stuff based on what type of conv this is. | 5730 * Handle hiding and showing stuff based on what type of conv this is. |
5731 * Stuff that Gaim IMs support in general should be shown for IM | 5731 * Stuff that Purple IMs support in general should be shown for IM |
5732 * conversations. Stuff that Gaim chats support in general should be | 5732 * conversations. Stuff that Purple chats support in general should be |
5733 * shown for chat conversations. It doesn't matter whether the PRPL | 5733 * shown for chat conversations. It doesn't matter whether the PRPL |
5734 * supports it or not--that only affects if the button or menu item | 5734 * supports it or not--that only affects if the button or menu item |
5735 * is sensitive or not. | 5735 * is sensitive or not. |
5736 */ | 5736 */ |
5737 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) { | 5737 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) { |
5738 /* Show stuff that applies to IMs, hide stuff that applies to chats */ | 5738 /* Show stuff that applies to IMs, hide stuff that applies to chats */ |
5739 | 5739 |
5740 /* Deal with menu items */ | 5740 /* Deal with menu items */ |
5741 gtk_widget_show(win->menu.view_log); | 5741 gtk_widget_show(win->menu.view_log); |
5742 gtk_widget_show(win->menu.send_file); | 5742 gtk_widget_show(win->menu.send_file); |
5743 gtk_widget_show(win->menu.add_pounce); | 5743 gtk_widget_show(win->menu.add_pounce); |
5744 gtk_widget_show(win->menu.get_info); | 5744 gtk_widget_show(win->menu.get_info); |
5745 gtk_widget_hide(win->menu.invite); | 5745 gtk_widget_hide(win->menu.invite); |
5746 gtk_widget_show(win->menu.alias); | 5746 gtk_widget_show(win->menu.alias); |
5747 if (gaim_privacy_check(account, gaim_conversation_get_name(conv))) { | 5747 if (purple_privacy_check(account, purple_conversation_get_name(conv))) { |
5748 gtk_widget_hide(win->menu.unblock); | 5748 gtk_widget_hide(win->menu.unblock); |
5749 gtk_widget_show(win->menu.block); | 5749 gtk_widget_show(win->menu.block); |
5750 } else { | 5750 } else { |
5751 gtk_widget_hide(win->menu.block); | 5751 gtk_widget_hide(win->menu.block); |
5752 gtk_widget_show(win->menu.unblock); | 5752 gtk_widget_show(win->menu.unblock); |
5753 } | 5753 } |
5754 | 5754 |
5755 if ((account == NULL) || gaim_find_buddy(account, gaim_conversation_get_name(conv)) == NULL) { | 5755 if ((account == NULL) || purple_find_buddy(account, purple_conversation_get_name(conv)) == NULL) { |
5756 gtk_widget_show(win->menu.add); | 5756 gtk_widget_show(win->menu.add); |
5757 gtk_widget_hide(win->menu.remove); | 5757 gtk_widget_hide(win->menu.remove); |
5758 } else { | 5758 } else { |
5759 gtk_widget_show(win->menu.remove); | 5759 gtk_widget_show(win->menu.remove); |
5760 gtk_widget_hide(win->menu.add); | 5760 gtk_widget_hide(win->menu.add); |
5761 } | 5761 } |
5762 | 5762 |
5763 gtk_widget_show(win->menu.show_icon); | 5763 gtk_widget_show(win->menu.show_icon); |
5764 } else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) { | 5764 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
5765 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ | 5765 /* Show stuff that applies to Chats, hide stuff that applies to IMs */ |
5766 | 5766 |
5767 /* Deal with menu items */ | 5767 /* Deal with menu items */ |
5768 gtk_widget_show(win->menu.view_log); | 5768 gtk_widget_show(win->menu.view_log); |
5769 gtk_widget_hide(win->menu.send_file); | 5769 gtk_widget_hide(win->menu.send_file); |
5773 gtk_widget_show(win->menu.alias); | 5773 gtk_widget_show(win->menu.alias); |
5774 gtk_widget_hide(win->menu.block); | 5774 gtk_widget_hide(win->menu.block); |
5775 gtk_widget_hide(win->menu.unblock); | 5775 gtk_widget_hide(win->menu.unblock); |
5776 gtk_widget_hide(win->menu.show_icon); | 5776 gtk_widget_hide(win->menu.show_icon); |
5777 | 5777 |
5778 if ((account == NULL) || gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) == NULL) { | 5778 if ((account == NULL) || purple_blist_find_chat(account, purple_conversation_get_name(conv)) == NULL) { |
5779 /* If the chat is NOT in the buddy list */ | 5779 /* If the chat is NOT in the buddy list */ |
5780 gtk_widget_show(win->menu.add); | 5780 gtk_widget_show(win->menu.add); |
5781 gtk_widget_hide(win->menu.remove); | 5781 gtk_widget_hide(win->menu.remove); |
5782 } else { | 5782 } else { |
5783 /* If the chat IS in the buddy list */ | 5783 /* If the chat IS in the buddy list */ |
5790 /* | 5790 /* |
5791 * Handle graying stuff out based on whether an account is connected | 5791 * Handle graying stuff out based on whether an account is connected |
5792 * and what features that account supports. | 5792 * and what features that account supports. |
5793 */ | 5793 */ |
5794 if ((gc != NULL) && | 5794 if ((gc != NULL) && |
5795 ((gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_CHAT) || | 5795 ((purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_CHAT) || |
5796 !gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)) )) | 5796 !purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)) )) |
5797 { | 5797 { |
5798 /* Account is online */ | 5798 /* Account is online */ |
5799 /* Deal with the toolbar */ | 5799 /* Deal with the toolbar */ |
5800 if (conv->features & GAIM_CONNECTION_HTML) | 5800 if (conv->features & PURPLE_CONNECTION_HTML) |
5801 { | 5801 { |
5802 buttons = GTK_IMHTML_ALL; /* Everything on */ | 5802 buttons = GTK_IMHTML_ALL; /* Everything on */ |
5803 if (conv->features & GAIM_CONNECTION_NO_BGCOLOR) | 5803 if (conv->features & PURPLE_CONNECTION_NO_BGCOLOR) |
5804 buttons &= ~GTK_IMHTML_BACKCOLOR; | 5804 buttons &= ~GTK_IMHTML_BACKCOLOR; |
5805 if (conv->features & GAIM_CONNECTION_NO_FONTSIZE) | 5805 if (conv->features & PURPLE_CONNECTION_NO_FONTSIZE) |
5806 { | 5806 { |
5807 buttons &= ~GTK_IMHTML_GROW; | 5807 buttons &= ~GTK_IMHTML_GROW; |
5808 buttons &= ~GTK_IMHTML_SHRINK; | 5808 buttons &= ~GTK_IMHTML_SHRINK; |
5809 } | 5809 } |
5810 if (conv->features & GAIM_CONNECTION_NO_URLDESC) | 5810 if (conv->features & PURPLE_CONNECTION_NO_URLDESC) |
5811 buttons &= ~GTK_IMHTML_LINKDESC; | 5811 buttons &= ~GTK_IMHTML_LINKDESC; |
5812 } else { | 5812 } else { |
5813 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; | 5813 buttons = GTK_IMHTML_SMILEY | GTK_IMHTML_IMAGE; |
5814 } | 5814 } |
5815 | 5815 |
5816 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || | 5816 if (!(prpl_info->options & OPT_PROTO_IM_IMAGE) || |
5817 conv->features & GAIM_CONNECTION_NO_IMAGES) | 5817 conv->features & PURPLE_CONNECTION_NO_IMAGES) |
5818 buttons &= ~GTK_IMHTML_IMAGE; | 5818 buttons &= ~GTK_IMHTML_IMAGE; |
5819 | 5819 |
5820 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); | 5820 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
5821 if (account != NULL) | 5821 if (account != NULL) |
5822 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), gaim_account_get_protocol_id(account)); | 5822 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
5823 | 5823 |
5824 /* Deal with menu items */ | 5824 /* Deal with menu items */ |
5825 gtk_widget_set_sensitive(win->menu.view_log, TRUE); | 5825 gtk_widget_set_sensitive(win->menu.view_log, TRUE); |
5826 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); | 5826 gtk_widget_set_sensitive(win->menu.add_pounce, TRUE); |
5827 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); | 5827 gtk_widget_set_sensitive(win->menu.get_info, (prpl_info->get_info != NULL)); |
5828 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); | 5828 gtk_widget_set_sensitive(win->menu.invite, (prpl_info->chat_invite != NULL)); |
5829 | 5829 |
5830 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 5830 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
5831 { | 5831 { |
5832 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); | 5832 gtk_widget_set_sensitive(win->menu.add, (prpl_info->add_buddy != NULL)); |
5833 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); | 5833 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->remove_buddy != NULL)); |
5834 gtk_widget_set_sensitive(win->menu.send_file, | 5834 gtk_widget_set_sensitive(win->menu.send_file, |
5835 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || | 5835 (prpl_info->send_file != NULL && (!prpl_info->can_receive_file || |
5836 prpl_info->can_receive_file(gc, gaim_conversation_get_name(conv))))); | 5836 prpl_info->can_receive_file(gc, purple_conversation_get_name(conv))))); |
5837 gtk_widget_set_sensitive(win->menu.alias, | 5837 gtk_widget_set_sensitive(win->menu.alias, |
5838 (account != NULL) && | 5838 (account != NULL) && |
5839 (gaim_find_buddy(account, gaim_conversation_get_name(conv)) != NULL)); | 5839 (purple_find_buddy(account, purple_conversation_get_name(conv)) != NULL)); |
5840 } | 5840 } |
5841 else if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 5841 else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
5842 { | 5842 { |
5843 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); | 5843 gtk_widget_set_sensitive(win->menu.add, (prpl_info->join_chat != NULL)); |
5844 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); | 5844 gtk_widget_set_sensitive(win->menu.remove, (prpl_info->join_chat != NULL)); |
5845 gtk_widget_set_sensitive(win->menu.alias, | 5845 gtk_widget_set_sensitive(win->menu.alias, |
5846 (account != NULL) && | 5846 (account != NULL) && |
5847 (gaim_blist_find_chat(account, gaim_conversation_get_name(conv)) != NULL)); | 5847 (purple_blist_find_chat(account, purple_conversation_get_name(conv)) != NULL)); |
5848 } | 5848 } |
5849 | 5849 |
5850 } else { | 5850 } else { |
5851 /* Account is offline */ | 5851 /* Account is offline */ |
5852 /* Or it's a chat that we've left. */ | 5852 /* Or it's a chat that we've left. */ |
5866 * Update the window's icon | 5866 * Update the window's icon |
5867 */ | 5867 */ |
5868 if (pidgin_conv_window_is_active_conversation(conv)) | 5868 if (pidgin_conv_window_is_active_conversation(conv)) |
5869 { | 5869 { |
5870 GList *l = NULL; | 5870 GList *l = NULL; |
5871 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && | 5871 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && |
5872 (gtkconv->u.im->anim)) | 5872 (gtkconv->u.im->anim)) |
5873 { | 5873 { |
5874 window_icon = | 5874 window_icon = |
5875 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); | 5875 gdk_pixbuf_animation_get_static_image(gtkconv->u.im->anim); |
5876 g_object_ref(window_icon); | 5876 g_object_ref(window_icon); |
5885 } | 5885 } |
5886 } | 5886 } |
5887 } | 5887 } |
5888 | 5888 |
5889 static void | 5889 static void |
5890 pidgin_conv_update_fields(GaimConversation *conv, PidginConvFields fields) | 5890 pidgin_conv_update_fields(PurpleConversation *conv, PidginConvFields fields) |
5891 { | 5891 { |
5892 PidginConversation *gtkconv; | 5892 PidginConversation *gtkconv; |
5893 PidginWindow *win; | 5893 PidginWindow *win; |
5894 | 5894 |
5895 gtkconv = PIDGIN_CONVERSATION(conv); | 5895 gtkconv = PIDGIN_CONVERSATION(conv); |
5899 if (!win) | 5899 if (!win) |
5900 return; | 5900 return; |
5901 | 5901 |
5902 if (fields & PIDGIN_CONV_SET_TITLE) | 5902 if (fields & PIDGIN_CONV_SET_TITLE) |
5903 { | 5903 { |
5904 gaim_conversation_autoset_title(conv); | 5904 purple_conversation_autoset_title(conv); |
5905 } | 5905 } |
5906 | 5906 |
5907 if (fields & PIDGIN_CONV_BUDDY_ICON) | 5907 if (fields & PIDGIN_CONV_BUDDY_ICON) |
5908 { | 5908 { |
5909 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 5909 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
5910 pidgin_conv_update_buddy_icon(conv); | 5910 pidgin_conv_update_buddy_icon(conv); |
5911 } | 5911 } |
5912 | 5912 |
5913 if (fields & PIDGIN_CONV_MENU) | 5913 if (fields & PIDGIN_CONV_MENU) |
5914 { | 5914 { |
5921 update_tab_icon(conv); | 5921 update_tab_icon(conv); |
5922 generate_send_to_items(win); /* To update the icons in SendTo menu */ | 5922 generate_send_to_items(win); /* To update the icons in SendTo menu */ |
5923 } | 5923 } |
5924 | 5924 |
5925 if ((fields & PIDGIN_CONV_TOPIC) && | 5925 if ((fields & PIDGIN_CONV_TOPIC) && |
5926 gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 5926 purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
5927 { | 5927 { |
5928 const char *topic; | 5928 const char *topic; |
5929 GaimConvChat *chat = GAIM_CONV_CHAT(conv); | 5929 PurpleConvChat *chat = PURPLE_CONV_CHAT(conv); |
5930 PidginChatPane *gtkchat = gtkconv->u.chat; | 5930 PidginChatPane *gtkchat = gtkconv->u.chat; |
5931 | 5931 |
5932 if (gtkchat->topic_text != NULL) | 5932 if (gtkchat->topic_text != NULL) |
5933 { | 5933 { |
5934 topic = gaim_conv_chat_get_topic(chat); | 5934 topic = purple_conv_chat_get_topic(chat); |
5935 | 5935 |
5936 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); | 5936 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), topic ? topic : ""); |
5937 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, | 5937 gtk_tooltips_set_tip(gtkconv->tooltips, gtkchat->topic_text, |
5938 topic ? topic : "", NULL); | 5938 topic ? topic : "", NULL); |
5939 } | 5939 } |
5944 | 5944 |
5945 if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || | 5945 if ((fields & PIDGIN_CONV_COLORIZE_TITLE) || |
5946 (fields & PIDGIN_CONV_SET_TITLE)) | 5946 (fields & PIDGIN_CONV_SET_TITLE)) |
5947 { | 5947 { |
5948 char *title; | 5948 char *title; |
5949 GaimConvIm *im = NULL; | 5949 PurpleConvIm *im = NULL; |
5950 GaimAccount *account = gaim_conversation_get_account(conv); | 5950 PurpleAccount *account = purple_conversation_get_account(conv); |
5951 AtkObject *accessibility_obj; | 5951 AtkObject *accessibility_obj; |
5952 /* I think this is a little longer than it needs to be but I'm lazy. */ | 5952 /* I think this is a little longer than it needs to be but I'm lazy. */ |
5953 char style[51]; | 5953 char style[51]; |
5954 | 5954 |
5955 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 5955 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
5956 im = GAIM_CONV_IM(conv); | 5956 im = PURPLE_CONV_IM(conv); |
5957 | 5957 |
5958 if ((account == NULL) || | 5958 if ((account == NULL) || |
5959 !gaim_account_is_connected(account) || | 5959 !purple_account_is_connected(account) || |
5960 ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_CHAT) | 5960 ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) |
5961 && gaim_conv_chat_has_left(GAIM_CONV_CHAT(conv)))) | 5961 && purple_conv_chat_has_left(PURPLE_CONV_CHAT(conv)))) |
5962 title = g_strdup_printf("(%s)", gaim_conversation_get_title(conv)); | 5962 title = g_strdup_printf("(%s)", purple_conversation_get_title(conv)); |
5963 else | 5963 else |
5964 title = g_strdup(gaim_conversation_get_title(conv)); | 5964 title = g_strdup(purple_conversation_get_title(conv)); |
5965 | 5965 |
5966 *style = '\0'; | 5966 *style = '\0'; |
5967 | 5967 |
5968 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) | 5968 if (!GTK_WIDGET_REALIZED(gtkconv->tab_label)) |
5969 gtk_widget_realize(gtkconv->tab_label); | 5969 gtk_widget_realize(gtkconv->tab_label); |
5970 | 5970 |
5971 accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont); | 5971 accessibility_obj = gtk_widget_get_accessible(gtkconv->tab_cont); |
5972 if (im != NULL && | 5972 if (im != NULL && |
5973 gaim_conv_im_get_typing_state(im) == GAIM_TYPING) | 5973 purple_conv_im_get_typing_state(im) == PURPLE_TYPING) |
5974 { | 5974 { |
5975 atk_object_set_description(accessibility_obj, _("Typing")); | 5975 atk_object_set_description(accessibility_obj, _("Typing")); |
5976 strncpy(style, "color=\"#47A046\"", sizeof(style)); | 5976 strncpy(style, "color=\"#47A046\"", sizeof(style)); |
5977 } | 5977 } |
5978 else if (im != NULL && | 5978 else if (im != NULL && |
5979 gaim_conv_im_get_typing_state(im) == GAIM_TYPED) | 5979 purple_conv_im_get_typing_state(im) == PURPLE_TYPED) |
5980 { | 5980 { |
5981 atk_object_set_description(accessibility_obj, _("Stopped Typing")); | 5981 atk_object_set_description(accessibility_obj, _("Stopped Typing")); |
5982 strncpy(style, "color=\"#D1940C\"", sizeof(style)); | 5982 strncpy(style, "color=\"#D1940C\"", sizeof(style)); |
5983 } | 5983 } |
5984 else if (gtkconv->unseen_state == PIDGIN_UNSEEN_NICK) | 5984 else if (gtkconv->unseen_state == PIDGIN_UNSEEN_NICK) |
6022 g_free(title); | 6022 g_free(title); |
6023 } | 6023 } |
6024 } | 6024 } |
6025 | 6025 |
6026 static void | 6026 static void |
6027 pidgin_conv_updated(GaimConversation *conv, GaimConvUpdateType type) | 6027 pidgin_conv_updated(PurpleConversation *conv, PurpleConvUpdateType type) |
6028 { | 6028 { |
6029 PidginConvFields flags = 0; | 6029 PidginConvFields flags = 0; |
6030 | 6030 |
6031 g_return_if_fail(conv != NULL); | 6031 g_return_if_fail(conv != NULL); |
6032 | 6032 |
6033 if (type == GAIM_CONV_UPDATE_ACCOUNT) | 6033 if (type == PURPLE_CONV_UPDATE_ACCOUNT) |
6034 { | 6034 { |
6035 flags = PIDGIN_CONV_ALL; | 6035 flags = PIDGIN_CONV_ALL; |
6036 } | 6036 } |
6037 else if (type == GAIM_CONV_UPDATE_TYPING || | 6037 else if (type == PURPLE_CONV_UPDATE_TYPING || |
6038 type == GAIM_CONV_UPDATE_UNSEEN || | 6038 type == PURPLE_CONV_UPDATE_UNSEEN || |
6039 type == GAIM_CONV_UPDATE_TITLE) | 6039 type == PURPLE_CONV_UPDATE_TITLE) |
6040 { | 6040 { |
6041 flags = PIDGIN_CONV_COLORIZE_TITLE; | 6041 flags = PIDGIN_CONV_COLORIZE_TITLE; |
6042 } | 6042 } |
6043 else if (type == GAIM_CONV_UPDATE_TOPIC) | 6043 else if (type == PURPLE_CONV_UPDATE_TOPIC) |
6044 { | 6044 { |
6045 flags = PIDGIN_CONV_TOPIC; | 6045 flags = PIDGIN_CONV_TOPIC; |
6046 } | 6046 } |
6047 else if (type == GAIM_CONV_ACCOUNT_ONLINE || | 6047 else if (type == PURPLE_CONV_ACCOUNT_ONLINE || |
6048 type == GAIM_CONV_ACCOUNT_OFFLINE) | 6048 type == PURPLE_CONV_ACCOUNT_OFFLINE) |
6049 { | 6049 { |
6050 flags = PIDGIN_CONV_MENU | PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE; | 6050 flags = PIDGIN_CONV_MENU | PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE; |
6051 } | 6051 } |
6052 else if (type == GAIM_CONV_UPDATE_AWAY) | 6052 else if (type == PURPLE_CONV_UPDATE_AWAY) |
6053 { | 6053 { |
6054 flags = PIDGIN_CONV_TAB_ICON; | 6054 flags = PIDGIN_CONV_TAB_ICON; |
6055 } | 6055 } |
6056 else if (type == GAIM_CONV_UPDATE_ADD || | 6056 else if (type == PURPLE_CONV_UPDATE_ADD || |
6057 type == GAIM_CONV_UPDATE_REMOVE || | 6057 type == PURPLE_CONV_UPDATE_REMOVE || |
6058 type == GAIM_CONV_UPDATE_CHATLEFT) | 6058 type == PURPLE_CONV_UPDATE_CHATLEFT) |
6059 { | 6059 { |
6060 flags = PIDGIN_CONV_SET_TITLE | PIDGIN_CONV_MENU; | 6060 flags = PIDGIN_CONV_SET_TITLE | PIDGIN_CONV_MENU; |
6061 } | 6061 } |
6062 else if (type == GAIM_CONV_UPDATE_ICON) | 6062 else if (type == PURPLE_CONV_UPDATE_ICON) |
6063 { | 6063 { |
6064 flags = PIDGIN_CONV_BUDDY_ICON; | 6064 flags = PIDGIN_CONV_BUDDY_ICON; |
6065 } | 6065 } |
6066 else if (type == GAIM_CONV_UPDATE_FEATURES) | 6066 else if (type == PURPLE_CONV_UPDATE_FEATURES) |
6067 { | 6067 { |
6068 flags = PIDGIN_CONV_MENU; | 6068 flags = PIDGIN_CONV_MENU; |
6069 } | 6069 } |
6070 | 6070 |
6071 pidgin_conv_update_fields(conv, flags); | 6071 pidgin_conv_update_fields(conv, flags); |
6072 } | 6072 } |
6073 | 6073 |
6074 static GaimConversationUiOps conversation_ui_ops = | 6074 static PurpleConversationUiOps conversation_ui_ops = |
6075 { | 6075 { |
6076 pidgin_conv_new, | 6076 pidgin_conv_new, |
6077 pidgin_conv_destroy, /* destroy_conversation */ | 6077 pidgin_conv_destroy, /* destroy_conversation */ |
6078 NULL, /* write_chat */ | 6078 NULL, /* write_chat */ |
6079 pidgin_conv_write_im, /* write_im */ | 6079 pidgin_conv_write_im, /* write_im */ |
6088 pidgin_conv_custom_smiley_write, /* custom_smiley_write */ | 6088 pidgin_conv_custom_smiley_write, /* custom_smiley_write */ |
6089 pidgin_conv_custom_smiley_close, /* custom_smiley_close */ | 6089 pidgin_conv_custom_smiley_close, /* custom_smiley_close */ |
6090 pidgin_conv_send_confirm, /* send_confirm */ | 6090 pidgin_conv_send_confirm, /* send_confirm */ |
6091 }; | 6091 }; |
6092 | 6092 |
6093 GaimConversationUiOps * | 6093 PurpleConversationUiOps * |
6094 pidgin_conversations_get_conv_ui_ops(void) | 6094 pidgin_conversations_get_conv_ui_ops(void) |
6095 { | 6095 { |
6096 return &conversation_ui_ops; | 6096 return &conversation_ui_ops; |
6097 } | 6097 } |
6098 | 6098 |
6099 /************************************************************************** | 6099 /************************************************************************** |
6100 * Public conversation utility functions | 6100 * Public conversation utility functions |
6101 **************************************************************************/ | 6101 **************************************************************************/ |
6102 void | 6102 void |
6103 pidgin_conv_update_buddy_icon(GaimConversation *conv) | 6103 pidgin_conv_update_buddy_icon(PurpleConversation *conv) |
6104 { | 6104 { |
6105 PidginConversation *gtkconv; | 6105 PidginConversation *gtkconv; |
6106 PidginWindow *win; | 6106 PidginWindow *win; |
6107 | 6107 |
6108 GdkPixbufLoader *loader; | 6108 GdkPixbufLoader *loader; |
6118 GtkWidget *event; | 6118 GtkWidget *event; |
6119 GtkWidget *frame; | 6119 GtkWidget *frame; |
6120 GdkPixbuf *scale; | 6120 GdkPixbuf *scale; |
6121 int scale_width, scale_height; | 6121 int scale_width, scale_height; |
6122 | 6122 |
6123 GaimAccount *account; | 6123 PurpleAccount *account; |
6124 GaimPluginProtocolInfo *prpl_info = NULL; | 6124 PurplePluginProtocolInfo *prpl_info = NULL; |
6125 | 6125 |
6126 GaimBuddyIcon *icon; | 6126 PurpleBuddyIcon *icon; |
6127 | 6127 |
6128 g_return_if_fail(conv != NULL); | 6128 g_return_if_fail(conv != NULL); |
6129 g_return_if_fail(PIDGIN_IS_PIDGIN_CONVERSATION(conv)); | 6129 g_return_if_fail(PIDGIN_IS_PIDGIN_CONVERSATION(conv)); |
6130 g_return_if_fail(gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM); | 6130 g_return_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM); |
6131 | 6131 |
6132 gtkconv = PIDGIN_CONVERSATION(conv); | 6132 gtkconv = PIDGIN_CONVERSATION(conv); |
6133 win = gtkconv->win; | 6133 win = gtkconv->win; |
6134 if (conv != gtkconv->active_conv) | 6134 if (conv != gtkconv->active_conv) |
6135 return; | 6135 return; |
6136 | 6136 |
6137 if (!gtkconv->u.im->show_icon) | 6137 if (!gtkconv->u.im->show_icon) |
6138 return; | 6138 return; |
6139 | 6139 |
6140 account = gaim_conversation_get_account(conv); | 6140 account = purple_conversation_get_account(conv); |
6141 if(account && account->gc) | 6141 if(account && account->gc) |
6142 prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(account->gc->prpl); | 6142 prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(account->gc->prpl); |
6143 | 6143 |
6144 /* Remove the current icon stuff */ | 6144 /* Remove the current icon stuff */ |
6145 if (gtkconv->u.im->icon_container != NULL) | 6145 if (gtkconv->u.im->icon_container != NULL) |
6146 gtk_widget_destroy(gtkconv->u.im->icon_container); | 6146 gtk_widget_destroy(gtkconv->u.im->icon_container); |
6147 gtkconv->u.im->icon_container = NULL; | 6147 gtkconv->u.im->icon_container = NULL; |
6159 if (gtkconv->u.im->iter != NULL) | 6159 if (gtkconv->u.im->iter != NULL) |
6160 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); | 6160 g_object_unref(G_OBJECT(gtkconv->u.im->iter)); |
6161 | 6161 |
6162 gtkconv->u.im->iter = NULL; | 6162 gtkconv->u.im->iter = NULL; |
6163 | 6163 |
6164 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) | 6164 if (!purple_prefs_get_bool("/purple/gtk/conversations/im/show_buddy_icons")) |
6165 return; | 6165 return; |
6166 | 6166 |
6167 if (gaim_conversation_get_gc(conv) == NULL) | 6167 if (purple_conversation_get_gc(conv) == NULL) |
6168 return; | 6168 return; |
6169 | 6169 |
6170 custom = custom_icon_pref_name(gtkconv); | 6170 custom = custom_icon_pref_name(gtkconv); |
6171 if (custom) { | 6171 if (custom) { |
6172 /* There is a custom icon for this user */ | 6172 /* There is a custom icon for this user */ |
6173 char *contents = NULL; | 6173 char *contents = NULL; |
6174 if (!g_file_get_contents(custom, &contents, &len, &err)) { | 6174 if (!g_file_get_contents(custom, &contents, &len, &err)) { |
6175 gaim_debug_warning("custom icon", "could not load custom icon %s for %s\n", | 6175 purple_debug_warning("custom icon", "could not load custom icon %s for %s\n", |
6176 custom, gaim_conversation_get_name(conv)); | 6176 custom, purple_conversation_get_name(conv)); |
6177 g_error_free(err); | 6177 g_error_free(err); |
6178 err = NULL; | 6178 err = NULL; |
6179 } else | 6179 } else |
6180 data = contents; | 6180 data = contents; |
6181 } | 6181 } |
6182 | 6182 |
6183 if (data == NULL) { | 6183 if (data == NULL) { |
6184 icon = gaim_conv_im_get_icon(GAIM_CONV_IM(conv)); | 6184 icon = purple_conv_im_get_icon(PURPLE_CONV_IM(conv)); |
6185 | 6185 |
6186 if (icon == NULL) | 6186 if (icon == NULL) |
6187 return; | 6187 return; |
6188 | 6188 |
6189 data = gaim_buddy_icon_get_data(icon, &len); | 6189 data = purple_buddy_icon_get_data(icon, &len); |
6190 custom = NULL; | 6190 custom = NULL; |
6191 } | 6191 } |
6192 | 6192 |
6193 loader = gdk_pixbuf_loader_new(); | 6193 loader = gdk_pixbuf_loader_new(); |
6194 gdk_pixbuf_loader_write(loader, data, len, NULL); | 6194 gdk_pixbuf_loader_write(loader, data, len, NULL); |
6204 if (!anim) | 6204 if (!anim) |
6205 return; | 6205 return; |
6206 gtkconv->u.im->anim = anim; | 6206 gtkconv->u.im->anim = anim; |
6207 | 6207 |
6208 if (err) { | 6208 if (err) { |
6209 gaim_debug(GAIM_DEBUG_ERROR, "gtkconv", | 6209 purple_debug(PURPLE_DEBUG_ERROR, "gtkconv", |
6210 "Buddy icon error: %s\n", err->message); | 6210 "Buddy icon error: %s\n", err->message); |
6211 g_error_free(err); | 6211 g_error_free(err); |
6212 } | 6212 } |
6213 | 6213 |
6214 if (!gtkconv->u.im->anim) | 6214 if (!gtkconv->u.im->anim) |
6224 if (gtkconv->u.im->animate) | 6224 if (gtkconv->u.im->animate) |
6225 start_anim(NULL, gtkconv); | 6225 start_anim(NULL, gtkconv); |
6226 } | 6226 } |
6227 | 6227 |
6228 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, | 6228 pidgin_buddy_icon_get_scale_size(buf, &prpl_info->icon_spec, |
6229 GAIM_ICON_SCALE_DISPLAY, &scale_width, &scale_height); | 6229 PURPLE_ICON_SCALE_DISPLAY, &scale_width, &scale_height); |
6230 scale = gdk_pixbuf_scale_simple(buf, | 6230 scale = gdk_pixbuf_scale_simple(buf, |
6231 MAX(gdk_pixbuf_get_width(buf) * scale_width / | 6231 MAX(gdk_pixbuf_get_width(buf) * scale_width / |
6232 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), | 6232 gdk_pixbuf_animation_get_width(gtkconv->u.im->anim), 1), |
6233 MAX(gdk_pixbuf_get_height(buf) * scale_height / | 6233 MAX(gdk_pixbuf_get_height(buf) * scale_height / |
6234 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), | 6234 gdk_pixbuf_animation_get_height(gtkconv->u.im->anim), 1), |
6271 gtk_window_set_icon(GTK_WINDOW(win->window), buf); | 6271 gtk_window_set_icon(GTK_WINDOW(win->window), buf); |
6272 } | 6272 } |
6273 } | 6273 } |
6274 | 6274 |
6275 void | 6275 void |
6276 pidgin_conv_update_buttons_by_protocol(GaimConversation *conv) | 6276 pidgin_conv_update_buttons_by_protocol(PurpleConversation *conv) |
6277 { | 6277 { |
6278 PidginWindow *win; | 6278 PidginWindow *win; |
6279 | 6279 |
6280 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 6280 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6281 return; | 6281 return; |
6354 | 6354 |
6355 return page_num; | 6355 return page_num; |
6356 } | 6356 } |
6357 | 6357 |
6358 static void | 6358 static void |
6359 close_on_tabs_pref_cb(const char *name, GaimPrefType type, | 6359 close_on_tabs_pref_cb(const char *name, PurplePrefType type, |
6360 gconstpointer value, gpointer data) | 6360 gconstpointer value, gpointer data) |
6361 { | 6361 { |
6362 GList *l; | 6362 GList *l; |
6363 GaimConversation *conv; | 6363 PurpleConversation *conv; |
6364 PidginConversation *gtkconv; | 6364 PidginConversation *gtkconv; |
6365 | 6365 |
6366 for (l = gaim_get_conversations(); l != NULL; l = l->next) { | 6366 for (l = purple_get_conversations(); l != NULL; l = l->next) { |
6367 conv = (GaimConversation *)l->data; | 6367 conv = (PurpleConversation *)l->data; |
6368 | 6368 |
6369 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 6369 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6370 continue; | 6370 continue; |
6371 | 6371 |
6372 gtkconv = PIDGIN_CONVERSATION(conv); | 6372 gtkconv = PIDGIN_CONVERSATION(conv); |
6377 gtk_widget_hide(gtkconv->close); | 6377 gtk_widget_hide(gtkconv->close); |
6378 } | 6378 } |
6379 } | 6379 } |
6380 | 6380 |
6381 static void | 6381 static void |
6382 spellcheck_pref_cb(const char *name, GaimPrefType type, | 6382 spellcheck_pref_cb(const char *name, PurplePrefType type, |
6383 gconstpointer value, gpointer data) | 6383 gconstpointer value, gpointer data) |
6384 { | 6384 { |
6385 #ifdef USE_GTKSPELL | 6385 #ifdef USE_GTKSPELL |
6386 GList *cl; | 6386 GList *cl; |
6387 GaimConversation *conv; | 6387 PurpleConversation *conv; |
6388 PidginConversation *gtkconv; | 6388 PidginConversation *gtkconv; |
6389 GtkSpell *spell; | 6389 GtkSpell *spell; |
6390 | 6390 |
6391 for (cl = gaim_get_conversations(); cl != NULL; cl = cl->next) { | 6391 for (cl = purple_get_conversations(); cl != NULL; cl = cl->next) { |
6392 | 6392 |
6393 conv = (GaimConversation *)cl->data; | 6393 conv = (PurpleConversation *)cl->data; |
6394 | 6394 |
6395 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 6395 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6396 continue; | 6396 continue; |
6397 | 6397 |
6398 gtkconv = PIDGIN_CONVERSATION(conv); | 6398 gtkconv = PIDGIN_CONVERSATION(conv); |
6406 } | 6406 } |
6407 #endif | 6407 #endif |
6408 } | 6408 } |
6409 | 6409 |
6410 static void | 6410 static void |
6411 tab_side_pref_cb(const char *name, GaimPrefType type, | 6411 tab_side_pref_cb(const char *name, PurplePrefType type, |
6412 gconstpointer value, gpointer data) | 6412 gconstpointer value, gpointer data) |
6413 { | 6413 { |
6414 GList *l; | 6414 GList *l; |
6415 GtkPositionType pos; | 6415 GtkPositionType pos; |
6416 PidginWindow *win; | 6416 PidginWindow *win; |
6423 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8); | 6423 gtk_notebook_set_tab_pos(GTK_NOTEBOOK(win->notebook), pos&~8); |
6424 } | 6424 } |
6425 } | 6425 } |
6426 | 6426 |
6427 static void | 6427 static void |
6428 show_timestamps_pref_cb(const char *name, GaimPrefType type, | 6428 show_timestamps_pref_cb(const char *name, PurplePrefType type, |
6429 gconstpointer value, gpointer data) | 6429 gconstpointer value, gpointer data) |
6430 { | 6430 { |
6431 GList *l; | 6431 GList *l; |
6432 GaimConversation *conv; | 6432 PurpleConversation *conv; |
6433 PidginConversation *gtkconv; | 6433 PidginConversation *gtkconv; |
6434 PidginWindow *win; | 6434 PidginWindow *win; |
6435 | 6435 |
6436 for (l = gaim_get_conversations(); l != NULL; l = l->next) | 6436 for (l = purple_get_conversations(); l != NULL; l = l->next) |
6437 { | 6437 { |
6438 conv = (GaimConversation *)l->data; | 6438 conv = (PurpleConversation *)l->data; |
6439 | 6439 |
6440 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 6440 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6441 continue; | 6441 continue; |
6442 | 6442 |
6443 gtkconv = PIDGIN_CONVERSATION(conv); | 6443 gtkconv = PIDGIN_CONVERSATION(conv); |
6451 (gboolean)GPOINTER_TO_INT(value)); | 6451 (gboolean)GPOINTER_TO_INT(value)); |
6452 } | 6452 } |
6453 } | 6453 } |
6454 | 6454 |
6455 static void | 6455 static void |
6456 show_formatting_toolbar_pref_cb(const char *name, GaimPrefType type, | 6456 show_formatting_toolbar_pref_cb(const char *name, PurplePrefType type, |
6457 gconstpointer value, gpointer data) | 6457 gconstpointer value, gpointer data) |
6458 { | 6458 { |
6459 GList *l; | 6459 GList *l; |
6460 GaimConversation *conv; | 6460 PurpleConversation *conv; |
6461 PidginConversation *gtkconv; | 6461 PidginConversation *gtkconv; |
6462 PidginWindow *win; | 6462 PidginWindow *win; |
6463 | 6463 |
6464 for (l = gaim_get_conversations(); l != NULL; l = l->next) | 6464 for (l = purple_get_conversations(); l != NULL; l = l->next) |
6465 { | 6465 { |
6466 conv = (GaimConversation *)l->data; | 6466 conv = (PurpleConversation *)l->data; |
6467 | 6467 |
6468 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) | 6468 if (!PIDGIN_IS_PIDGIN_CONVERSATION(conv)) |
6469 continue; | 6469 continue; |
6470 | 6470 |
6471 gtkconv = PIDGIN_CONVERSATION(conv); | 6471 gtkconv = PIDGIN_CONVERSATION(conv); |
6481 gtk_widget_hide(gtkconv->toolbar); | 6481 gtk_widget_hide(gtkconv->toolbar); |
6482 } | 6482 } |
6483 } | 6483 } |
6484 | 6484 |
6485 static void | 6485 static void |
6486 animate_buddy_icons_pref_cb(const char *name, GaimPrefType type, | 6486 animate_buddy_icons_pref_cb(const char *name, PurplePrefType type, |
6487 gconstpointer value, gpointer data) | 6487 gconstpointer value, gpointer data) |
6488 { | 6488 { |
6489 GList *l; | 6489 GList *l; |
6490 GaimConversation *conv; | 6490 PurpleConversation *conv; |
6491 PidginConversation *gtkconv; | 6491 PidginConversation *gtkconv; |
6492 PidginWindow *win; | 6492 PidginWindow *win; |
6493 | 6493 |
6494 if (!gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) | 6494 if (!purple_prefs_get_bool("/purple/gtk/conversations/im/show_buddy_icons")) |
6495 return; | 6495 return; |
6496 | 6496 |
6497 /* Set the "animate" flag for each icon based on the new preference */ | 6497 /* Set the "animate" flag for each icon based on the new preference */ |
6498 for (l = gaim_get_ims(); l != NULL; l = l->next) { | 6498 for (l = purple_get_ims(); l != NULL; l = l->next) { |
6499 conv = (GaimConversation *)l->data; | 6499 conv = (PurpleConversation *)l->data; |
6500 gtkconv = PIDGIN_CONVERSATION(conv); | 6500 gtkconv = PIDGIN_CONVERSATION(conv); |
6501 gtkconv->u.im->animate = GPOINTER_TO_INT(value); | 6501 gtkconv->u.im->animate = GPOINTER_TO_INT(value); |
6502 } | 6502 } |
6503 | 6503 |
6504 /* Now either stop or start animation for the active conversation in each window */ | 6504 /* Now either stop or start animation for the active conversation in each window */ |
6508 pidgin_conv_update_buddy_icon(conv); | 6508 pidgin_conv_update_buddy_icon(conv); |
6509 } | 6509 } |
6510 } | 6510 } |
6511 | 6511 |
6512 static void | 6512 static void |
6513 show_buddy_icons_pref_cb(const char *name, GaimPrefType type, | 6513 show_buddy_icons_pref_cb(const char *name, PurplePrefType type, |
6514 gconstpointer value, gpointer data) | 6514 gconstpointer value, gpointer data) |
6515 { | 6515 { |
6516 GList *l; | 6516 GList *l; |
6517 | 6517 |
6518 for (l = gaim_get_conversations(); l != NULL; l = l->next) { | 6518 for (l = purple_get_conversations(); l != NULL; l = l->next) { |
6519 GaimConversation *conv = l->data; | 6519 PurpleConversation *conv = l->data; |
6520 | 6520 |
6521 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 6521 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
6522 pidgin_conv_update_buddy_icon(conv); | 6522 pidgin_conv_update_buddy_icon(conv); |
6523 } | 6523 } |
6524 } | 6524 } |
6525 | 6525 |
6526 static void | 6526 static void |
6527 conv_placement_usetabs_cb(const char *name, GaimPrefType type, | 6527 conv_placement_usetabs_cb(const char *name, PurplePrefType type, |
6528 gconstpointer value, gpointer data) | 6528 gconstpointer value, gpointer data) |
6529 { | 6529 { |
6530 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); | 6530 purple_prefs_trigger_callback("/purple/gtk/conversations/placement"); |
6531 } | 6531 } |
6532 | 6532 |
6533 static void | 6533 static void |
6534 account_status_changed_cb(GaimAccount *account, GaimStatus *oldstatus, | 6534 account_status_changed_cb(PurpleAccount *account, PurpleStatus *oldstatus, |
6535 GaimStatus *newstatus) | 6535 PurpleStatus *newstatus) |
6536 { | 6536 { |
6537 GList *l; | 6537 GList *l; |
6538 GaimConversation *conv = NULL; | 6538 PurpleConversation *conv = NULL; |
6539 PidginConversation *gtkconv; | 6539 PidginConversation *gtkconv; |
6540 | 6540 |
6541 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")!=0) | 6541 if(strcmp(purple_prefs_get_string("/purple/gtk/conversations/im/hide_new"), "away")!=0) |
6542 return; | 6542 return; |
6543 | 6543 |
6544 if(gaim_status_is_available(oldstatus) || !gaim_status_is_available(newstatus)) | 6544 if(purple_status_is_available(oldstatus) || !purple_status_is_available(newstatus)) |
6545 return; | 6545 return; |
6546 | 6546 |
6547 while ((l = hidden_convwin->gtkconvs) != NULL) | 6547 while ((l = hidden_convwin->gtkconvs) != NULL) |
6548 { | 6548 { |
6549 gtkconv = l->data; | 6549 gtkconv = l->data; |
6550 | 6550 |
6551 conv = gtkconv->active_conv; | 6551 conv = gtkconv->active_conv; |
6552 | 6552 |
6553 while(l && !gaim_status_is_available( | 6553 while(l && !purple_status_is_available( |
6554 gaim_account_get_active_status( | 6554 purple_account_get_active_status( |
6555 gaim_conversation_get_account(conv)))) | 6555 purple_conversation_get_account(conv)))) |
6556 l = l->next; | 6556 l = l->next; |
6557 if (!l) | 6557 if (!l) |
6558 break; | 6558 break; |
6559 | 6559 |
6560 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); | 6560 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
6561 pidgin_conv_placement_place(gtkconv); | 6561 pidgin_conv_placement_place(gtkconv); |
6562 | 6562 |
6563 /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here? | 6563 /* TODO: do we need to do anything for any other conversations that are in the same gtkconv here? |
6564 * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/ | 6564 * I'm a little concerned that not doing so will cause the "pending" indicator in the gtkblist not to be cleared. -DAA*/ |
6565 gaim_conversation_update(conv, GAIM_CONV_UPDATE_UNSEEN); | 6565 purple_conversation_update(conv, PURPLE_CONV_UPDATE_UNSEEN); |
6566 } | 6566 } |
6567 } | 6567 } |
6568 | 6568 |
6569 static void | 6569 static void |
6570 hide_new_pref_cb(const char *name, GaimPrefType type, | 6570 hide_new_pref_cb(const char *name, PurplePrefType type, |
6571 gconstpointer value, gpointer data) | 6571 gconstpointer value, gpointer data) |
6572 { | 6572 { |
6573 GList *l; | 6573 GList *l; |
6574 GaimConversation *conv = NULL; | 6574 PurpleConversation *conv = NULL; |
6575 PidginConversation *gtkconv; | 6575 PidginConversation *gtkconv; |
6576 gboolean when_away = FALSE; | 6576 gboolean when_away = FALSE; |
6577 | 6577 |
6578 if(!hidden_convwin) | 6578 if(!hidden_convwin) |
6579 return; | 6579 return; |
6580 | 6580 |
6581 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "always")==0) | 6581 if(strcmp(purple_prefs_get_string("/purple/gtk/conversations/im/hide_new"), "always")==0) |
6582 return; | 6582 return; |
6583 | 6583 |
6584 if(strcmp(gaim_prefs_get_string("/gaim/gtk/conversations/im/hide_new"), "away")==0) | 6584 if(strcmp(purple_prefs_get_string("/purple/gtk/conversations/im/hide_new"), "away")==0) |
6585 when_away = TRUE; | 6585 when_away = TRUE; |
6586 | 6586 |
6587 while ((l = hidden_convwin->gtkconvs) != NULL) | 6587 while ((l = hidden_convwin->gtkconvs) != NULL) |
6588 { | 6588 { |
6589 gtkconv = l->data; | 6589 gtkconv = l->data; |
6590 | 6590 |
6591 conv = gtkconv->active_conv; | 6591 conv = gtkconv->active_conv; |
6592 | 6592 |
6593 if(when_away && !gaim_status_is_available( | 6593 if(when_away && !purple_status_is_available( |
6594 gaim_account_get_active_status( | 6594 purple_account_get_active_status( |
6595 gaim_conversation_get_account(conv)))) | 6595 purple_conversation_get_account(conv)))) |
6596 continue; | 6596 continue; |
6597 | 6597 |
6598 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); | 6598 pidgin_conv_window_remove_gtkconv(hidden_convwin, gtkconv); |
6599 pidgin_conv_placement_place(gtkconv); | 6599 pidgin_conv_placement_place(gtkconv); |
6600 } | 6600 } |
6601 } | 6601 } |
6602 | 6602 |
6603 | 6603 |
6604 static void | 6604 static void |
6605 conv_placement_pref_cb(const char *name, GaimPrefType type, | 6605 conv_placement_pref_cb(const char *name, PurplePrefType type, |
6606 gconstpointer value, gpointer data) | 6606 gconstpointer value, gpointer data) |
6607 { | 6607 { |
6608 PidginConvPlacementFunc func; | 6608 PidginConvPlacementFunc func; |
6609 | 6609 |
6610 if (strcmp(name, "/gaim/gtk/conversations/placement")) | 6610 if (strcmp(name, "/purple/gtk/conversations/placement")) |
6611 return; | 6611 return; |
6612 | 6612 |
6613 func = pidgin_conv_placement_get_fnc(value); | 6613 func = pidgin_conv_placement_get_fnc(value); |
6614 | 6614 |
6615 if (func == NULL) | 6615 if (func == NULL) |
6617 | 6617 |
6618 pidgin_conv_placement_set_current_func(func); | 6618 pidgin_conv_placement_set_current_func(func); |
6619 } | 6619 } |
6620 | 6620 |
6621 static PidginConversation * | 6621 static PidginConversation * |
6622 get_gtkconv_with_contact(GaimContact *contact) | 6622 get_gtkconv_with_contact(PurpleContact *contact) |
6623 { | 6623 { |
6624 GaimBlistNode *node; | 6624 PurpleBlistNode *node; |
6625 | 6625 |
6626 node = ((GaimBlistNode*)contact)->child; | 6626 node = ((PurpleBlistNode*)contact)->child; |
6627 | 6627 |
6628 for (; node; node = node->next) | 6628 for (; node; node = node->next) |
6629 { | 6629 { |
6630 GaimBuddy *buddy = (GaimBuddy*)node; | 6630 PurpleBuddy *buddy = (PurpleBuddy*)node; |
6631 GaimConversation *conv; | 6631 PurpleConversation *conv; |
6632 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); | 6632 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); |
6633 if (conv) | 6633 if (conv) |
6634 return PIDGIN_CONVERSATION(conv); | 6634 return PIDGIN_CONVERSATION(conv); |
6635 } | 6635 } |
6636 return NULL; | 6636 return NULL; |
6637 } | 6637 } |
6638 | 6638 |
6639 static void | 6639 static void |
6640 account_signed_off_cb(GaimConnection *gc, gpointer event) | 6640 account_signed_off_cb(PurpleConnection *gc, gpointer event) |
6641 { | 6641 { |
6642 GList *iter; | 6642 GList *iter; |
6643 | 6643 |
6644 for (iter = gaim_get_conversations(); iter; iter = iter->next) | 6644 for (iter = purple_get_conversations(); iter; iter = iter->next) |
6645 { | 6645 { |
6646 GaimConversation *conv = iter->data; | 6646 PurpleConversation *conv = iter->data; |
6647 | 6647 |
6648 /* This seems fine in theory, but we also need to cover the | 6648 /* This seems fine in theory, but we also need to cover the |
6649 * case of this account matching one of the other buddies in | 6649 * case of this account matching one of the other buddies in |
6650 * one of the contacts containing the buddy corresponding to | 6650 * one of the contacts containing the buddy corresponding to |
6651 * a conversation. It's easier to just update them all. */ | 6651 * a conversation. It's easier to just update them all. */ |
6652 /* if (gaim_conversation_get_account(conv) == account) */ | 6652 /* if (purple_conversation_get_account(conv) == account) */ |
6653 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | | 6653 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | |
6654 PIDGIN_CONV_MENU | PIDGIN_CONV_COLORIZE_TITLE); | 6654 PIDGIN_CONV_MENU | PIDGIN_CONV_COLORIZE_TITLE); |
6655 } | 6655 } |
6656 } | 6656 } |
6657 | 6657 |
6658 static gboolean | 6658 static gboolean |
6659 update_buddy_status_timeout(GaimBuddy *buddy) | 6659 update_buddy_status_timeout(PurpleBuddy *buddy) |
6660 { | 6660 { |
6661 /* To remove the signing-on/off door icon */ | 6661 /* To remove the signing-on/off door icon */ |
6662 GaimConversation *conv; | 6662 PurpleConversation *conv; |
6663 | 6663 |
6664 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); | 6664 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); |
6665 if (conv) | 6665 if (conv) |
6666 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); | 6666 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); |
6667 | 6667 |
6668 return FALSE; | 6668 return FALSE; |
6669 } | 6669 } |
6670 | 6670 |
6671 static void | 6671 static void |
6672 update_buddy_status_changed(GaimBuddy *buddy, GaimStatus *old, GaimStatus *newstatus) | 6672 update_buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old, PurpleStatus *newstatus) |
6673 { | 6673 { |
6674 PidginConversation *gtkconv; | 6674 PidginConversation *gtkconv; |
6675 GaimConversation *conv; | 6675 PurpleConversation *conv; |
6676 | 6676 |
6677 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy)); | 6677 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy)); |
6678 if (gtkconv) | 6678 if (gtkconv) |
6679 { | 6679 { |
6680 conv = gtkconv->active_conv; | 6680 conv = gtkconv->active_conv; |
6681 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_COLORIZE_TITLE); | 6681 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_COLORIZE_TITLE); |
6682 if ((gaim_status_is_online(old) ^ gaim_status_is_online(newstatus)) != 0) | 6682 if ((purple_status_is_online(old) ^ purple_status_is_online(newstatus)) != 0) |
6683 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); | 6683 pidgin_conv_update_fields(conv, PIDGIN_CONV_MENU); |
6684 } | 6684 } |
6685 | 6685 |
6686 /* In case a conversation is started after the buddy has signed-on/off */ | 6686 /* In case a conversation is started after the buddy has signed-on/off */ |
6687 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy); | 6687 g_timeout_add(11000, (GSourceFunc)update_buddy_status_timeout, buddy); |
6688 } | 6688 } |
6689 | 6689 |
6690 static void | 6690 static void |
6691 update_buddy_privacy_changed(GaimBuddy *buddy) | 6691 update_buddy_privacy_changed(PurpleBuddy *buddy) |
6692 { | 6692 { |
6693 PidginConversation *gtkconv; | 6693 PidginConversation *gtkconv; |
6694 GaimConversation *conv; | 6694 PurpleConversation *conv; |
6695 | 6695 |
6696 gtkconv = get_gtkconv_with_contact(gaim_buddy_get_contact(buddy)); | 6696 gtkconv = get_gtkconv_with_contact(purple_buddy_get_contact(buddy)); |
6697 if (gtkconv) { | 6697 if (gtkconv) { |
6698 conv = gtkconv->active_conv; | 6698 conv = gtkconv->active_conv; |
6699 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_MENU); | 6699 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_MENU); |
6700 } | 6700 } |
6701 } | 6701 } |
6702 | 6702 |
6703 static void | 6703 static void |
6704 update_buddy_idle_changed(GaimBuddy *buddy, gboolean old, gboolean newidle) | 6704 update_buddy_idle_changed(PurpleBuddy *buddy, gboolean old, gboolean newidle) |
6705 { | 6705 { |
6706 GaimConversation *conv; | 6706 PurpleConversation *conv; |
6707 | 6707 |
6708 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); | 6708 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); |
6709 if (conv) | 6709 if (conv) |
6710 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); | 6710 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON); |
6711 } | 6711 } |
6712 | 6712 |
6713 static void | 6713 static void |
6714 update_buddy_icon(GaimBuddy *buddy) | 6714 update_buddy_icon(PurpleBuddy *buddy) |
6715 { | 6715 { |
6716 GaimConversation *conv; | 6716 PurpleConversation *conv; |
6717 | 6717 |
6718 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, buddy->name, buddy->account); | 6718 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, buddy->name, buddy->account); |
6719 if (conv) | 6719 if (conv) |
6720 pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON); | 6720 pidgin_conv_update_fields(conv, PIDGIN_CONV_BUDDY_ICON); |
6721 } | 6721 } |
6722 | 6722 |
6723 static void | 6723 static void |
6724 update_buddy_sign(GaimBuddy *buddy, const char *which) | 6724 update_buddy_sign(PurpleBuddy *buddy, const char *which) |
6725 { | 6725 { |
6726 GaimPresence *presence; | 6726 PurplePresence *presence; |
6727 GaimStatus *on, *off; | 6727 PurpleStatus *on, *off; |
6728 | 6728 |
6729 presence = gaim_buddy_get_presence(buddy); | 6729 presence = purple_buddy_get_presence(buddy); |
6730 if (!presence) | 6730 if (!presence) |
6731 return; | 6731 return; |
6732 off = gaim_presence_get_status(presence, "offline"); | 6732 off = purple_presence_get_status(presence, "offline"); |
6733 on = gaim_presence_get_status(presence, "available"); | 6733 on = purple_presence_get_status(presence, "available"); |
6734 | 6734 |
6735 if (*(which+1) == 'f') | 6735 if (*(which+1) == 'f') |
6736 update_buddy_status_changed(buddy, on, off); | 6736 update_buddy_status_changed(buddy, on, off); |
6737 else | 6737 else |
6738 update_buddy_status_changed(buddy, off, on); | 6738 update_buddy_status_changed(buddy, off, on); |
6739 } | 6739 } |
6740 | 6740 |
6741 static void | 6741 static void |
6742 update_conversation_switched(GaimConversation *conv) | 6742 update_conversation_switched(PurpleConversation *conv) |
6743 { | 6743 { |
6744 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE | | 6744 pidgin_conv_update_fields(conv, PIDGIN_CONV_TAB_ICON | PIDGIN_CONV_SET_TITLE | |
6745 PIDGIN_CONV_MENU | PIDGIN_CONV_BUDDY_ICON); | 6745 PIDGIN_CONV_MENU | PIDGIN_CONV_BUDDY_ICON); |
6746 } | 6746 } |
6747 | 6747 |
6748 static void | 6748 static void |
6749 update_buddy_typing(GaimAccount *account, const char *who) | 6749 update_buddy_typing(PurpleAccount *account, const char *who) |
6750 { | 6750 { |
6751 GaimConversation *conv; | 6751 PurpleConversation *conv; |
6752 PidginConversation *gtkconv; | 6752 PidginConversation *gtkconv; |
6753 | 6753 |
6754 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_IM, who, account); | 6754 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, account); |
6755 if (!conv) | 6755 if (!conv) |
6756 return; | 6756 return; |
6757 | 6757 |
6758 gtkconv = PIDGIN_CONVERSATION(conv); | 6758 gtkconv = PIDGIN_CONVERSATION(conv); |
6759 if (gtkconv && gtkconv->active_conv == conv) | 6759 if (gtkconv && gtkconv->active_conv == conv) |
6760 pidgin_conv_update_fields(conv, PIDGIN_CONV_COLORIZE_TITLE); | 6760 pidgin_conv_update_fields(conv, PIDGIN_CONV_COLORIZE_TITLE); |
6761 } | 6761 } |
6762 | 6762 |
6763 static void | 6763 static void |
6764 update_chat(GaimConversation *conv) | 6764 update_chat(PurpleConversation *conv) |
6765 { | 6765 { |
6766 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC | | 6766 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC | |
6767 PIDGIN_CONV_MENU | PIDGIN_CONV_SET_TITLE); | 6767 PIDGIN_CONV_MENU | PIDGIN_CONV_SET_TITLE); |
6768 } | 6768 } |
6769 | 6769 |
6770 static void | 6770 static void |
6771 update_chat_topic(GaimConversation *conv, const char *old, const char *new) | 6771 update_chat_topic(PurpleConversation *conv, const char *old, const char *new) |
6772 { | 6772 { |
6773 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC); | 6773 pidgin_conv_update_fields(conv, PIDGIN_CONV_TOPIC); |
6774 } | 6774 } |
6775 | 6775 |
6776 void * | 6776 void * |
6783 | 6783 |
6784 void | 6784 void |
6785 pidgin_conversations_init(void) | 6785 pidgin_conversations_init(void) |
6786 { | 6786 { |
6787 void *handle = pidgin_conversations_get_handle(); | 6787 void *handle = pidgin_conversations_get_handle(); |
6788 void *blist_handle = gaim_blist_get_handle(); | 6788 void *blist_handle = purple_blist_get_handle(); |
6789 | 6789 |
6790 /* Conversations */ | 6790 /* Conversations */ |
6791 gaim_prefs_add_none("/gaim/gtk/conversations"); | 6791 purple_prefs_add_none("/purple/gtk/conversations"); |
6792 gaim_prefs_add_bool("/gaim/gtk/conversations/use_smooth_scrolling", TRUE); | 6792 purple_prefs_add_bool("/purple/gtk/conversations/use_smooth_scrolling", TRUE); |
6793 gaim_prefs_add_bool("/gaim/gtk/conversations/close_on_tabs", TRUE); | 6793 purple_prefs_add_bool("/purple/gtk/conversations/close_on_tabs", TRUE); |
6794 gaim_prefs_add_bool("/gaim/gtk/conversations/send_bold", FALSE); | 6794 purple_prefs_add_bool("/purple/gtk/conversations/send_bold", FALSE); |
6795 gaim_prefs_add_bool("/gaim/gtk/conversations/send_italic", FALSE); | 6795 purple_prefs_add_bool("/purple/gtk/conversations/send_italic", FALSE); |
6796 gaim_prefs_add_bool("/gaim/gtk/conversations/send_underline", FALSE); | 6796 purple_prefs_add_bool("/purple/gtk/conversations/send_underline", FALSE); |
6797 gaim_prefs_add_bool("/gaim/gtk/conversations/spellcheck", TRUE); | 6797 purple_prefs_add_bool("/purple/gtk/conversations/spellcheck", TRUE); |
6798 gaim_prefs_add_bool("/gaim/gtk/conversations/show_incoming_formatting", TRUE); | 6798 purple_prefs_add_bool("/purple/gtk/conversations/show_incoming_formatting", TRUE); |
6799 | 6799 |
6800 gaim_prefs_add_bool("/gaim/gtk/conversations/show_timestamps", TRUE); | 6800 purple_prefs_add_bool("/purple/gtk/conversations/show_timestamps", TRUE); |
6801 gaim_prefs_add_bool("/gaim/gtk/conversations/show_formatting_toolbar", TRUE); | 6801 purple_prefs_add_bool("/purple/gtk/conversations/show_formatting_toolbar", TRUE); |
6802 | 6802 |
6803 gaim_prefs_add_string("/gaim/gtk/conversations/placement", "last"); | 6803 purple_prefs_add_string("/purple/gtk/conversations/placement", "last"); |
6804 gaim_prefs_add_int("/gaim/gtk/conversations/placement_number", 1); | 6804 purple_prefs_add_int("/purple/gtk/conversations/placement_number", 1); |
6805 gaim_prefs_add_string("/gaim/gtk/conversations/bgcolor", ""); | 6805 purple_prefs_add_string("/purple/gtk/conversations/bgcolor", ""); |
6806 gaim_prefs_add_string("/gaim/gtk/conversations/fgcolor", ""); | 6806 purple_prefs_add_string("/purple/gtk/conversations/fgcolor", ""); |
6807 gaim_prefs_add_string("/gaim/gtk/conversations/font_face", ""); | 6807 purple_prefs_add_string("/purple/gtk/conversations/font_face", ""); |
6808 gaim_prefs_add_int("/gaim/gtk/conversations/font_size", 3); | 6808 purple_prefs_add_int("/purple/gtk/conversations/font_size", 3); |
6809 gaim_prefs_add_bool("/gaim/gtk/conversations/tabs", TRUE); | 6809 purple_prefs_add_bool("/purple/gtk/conversations/tabs", TRUE); |
6810 gaim_prefs_add_int("/gaim/gtk/conversations/tab_side", GTK_POS_TOP); | 6810 purple_prefs_add_int("/purple/gtk/conversations/tab_side", GTK_POS_TOP); |
6811 gaim_prefs_add_int("/gaim/gtk/conversations/scrollback_lines", 4000); | 6811 purple_prefs_add_int("/purple/gtk/conversations/scrollback_lines", 4000); |
6812 | 6812 |
6813 /* Conversations -> Chat */ | 6813 /* Conversations -> Chat */ |
6814 gaim_prefs_add_none("/gaim/gtk/conversations/chat"); | 6814 purple_prefs_add_none("/purple/gtk/conversations/chat"); |
6815 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_width", 410); | 6815 purple_prefs_add_int("/purple/gtk/conversations/chat/default_width", 410); |
6816 gaim_prefs_add_int("/gaim/gtk/conversations/chat/default_height", 160); | 6816 purple_prefs_add_int("/purple/gtk/conversations/chat/default_height", 160); |
6817 gaim_prefs_add_int("/gaim/gtk/conversations/chat/entry_height", 50); | 6817 purple_prefs_add_int("/purple/gtk/conversations/chat/entry_height", 50); |
6818 gaim_prefs_add_int("/gaim/gtk/conversations/chat/userlist_width", 80); | 6818 purple_prefs_add_int("/purple/gtk/conversations/chat/userlist_width", 80); |
6819 /* Conversations -> IM */ | 6819 /* Conversations -> IM */ |
6820 gaim_prefs_add_none("/gaim/gtk/conversations/im"); | 6820 purple_prefs_add_none("/purple/gtk/conversations/im"); |
6821 | 6821 |
6822 gaim_prefs_add_bool("/gaim/gtk/conversations/im/animate_buddy_icons", TRUE); | 6822 purple_prefs_add_bool("/purple/gtk/conversations/im/animate_buddy_icons", TRUE); |
6823 | 6823 |
6824 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_width", 410); | 6824 purple_prefs_add_int("/purple/gtk/conversations/im/default_width", 410); |
6825 gaim_prefs_add_int("/gaim/gtk/conversations/im/default_height", 160); | 6825 purple_prefs_add_int("/purple/gtk/conversations/im/default_height", 160); |
6826 gaim_prefs_add_int("/gaim/gtk/conversations/im/entry_height", 50); | 6826 purple_prefs_add_int("/purple/gtk/conversations/im/entry_height", 50); |
6827 gaim_prefs_add_bool("/gaim/gtk/conversations/im/show_buddy_icons", TRUE); | 6827 purple_prefs_add_bool("/purple/gtk/conversations/im/show_buddy_icons", TRUE); |
6828 | 6828 |
6829 gaim_prefs_add_string("/gaim/gtk/conversations/im/hide_new", "never"); | 6829 purple_prefs_add_string("/purple/gtk/conversations/im/hide_new", "never"); |
6830 | 6830 |
6831 /* Connect callbacks. */ | 6831 /* Connect callbacks. */ |
6832 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/close_on_tabs", | 6832 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/close_on_tabs", |
6833 close_on_tabs_pref_cb, NULL); | 6833 close_on_tabs_pref_cb, NULL); |
6834 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_timestamps", | 6834 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/show_timestamps", |
6835 show_timestamps_pref_cb, NULL); | 6835 show_timestamps_pref_cb, NULL); |
6836 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/show_formatting_toolbar", | 6836 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/show_formatting_toolbar", |
6837 show_formatting_toolbar_pref_cb, NULL); | 6837 show_formatting_toolbar_pref_cb, NULL); |
6838 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/spellcheck", | 6838 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/spellcheck", |
6839 spellcheck_pref_cb, NULL); | 6839 spellcheck_pref_cb, NULL); |
6840 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tab_side", | 6840 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/tab_side", |
6841 tab_side_pref_cb, NULL); | 6841 tab_side_pref_cb, NULL); |
6842 | 6842 |
6843 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/tabs", | 6843 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/tabs", |
6844 conv_placement_usetabs_cb, NULL); | 6844 conv_placement_usetabs_cb, NULL); |
6845 | 6845 |
6846 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/placement", | 6846 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/placement", |
6847 conv_placement_pref_cb, NULL); | 6847 conv_placement_pref_cb, NULL); |
6848 gaim_prefs_trigger_callback("/gaim/gtk/conversations/placement"); | 6848 purple_prefs_trigger_callback("/purple/gtk/conversations/placement"); |
6849 | 6849 |
6850 /* IM callbacks */ | 6850 /* IM callbacks */ |
6851 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/animate_buddy_icons", | 6851 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/im/animate_buddy_icons", |
6852 animate_buddy_icons_pref_cb, NULL); | 6852 animate_buddy_icons_pref_cb, NULL); |
6853 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/show_buddy_icons", | 6853 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/im/show_buddy_icons", |
6854 show_buddy_icons_pref_cb, NULL); | 6854 show_buddy_icons_pref_cb, NULL); |
6855 gaim_prefs_connect_callback(handle, "/gaim/gtk/conversations/im/hide_new", | 6855 purple_prefs_connect_callback(handle, "/purple/gtk/conversations/im/hide_new", |
6856 hide_new_pref_cb, NULL); | 6856 hide_new_pref_cb, NULL); |
6857 | 6857 |
6858 | 6858 |
6859 | 6859 |
6860 /********************************************************************** | 6860 /********************************************************************** |
6861 * Register signals | 6861 * Register signals |
6862 **********************************************************************/ | 6862 **********************************************************************/ |
6863 gaim_signal_register(handle, "conversation-dragging", | 6863 purple_signal_register(handle, "conversation-dragging", |
6864 gaim_marshal_VOID__POINTER_POINTER, NULL, 2, | 6864 purple_marshal_VOID__POINTER_POINTER, NULL, 2, |
6865 gaim_value_new(GAIM_TYPE_BOXED, | 6865 purple_value_new(PURPLE_TYPE_BOXED, |
6866 "PidginWindow *"), | 6866 "PidginWindow *"), |
6867 gaim_value_new(GAIM_TYPE_BOXED, | 6867 purple_value_new(PURPLE_TYPE_BOXED, |
6868 "PidginWindow *")); | 6868 "PidginWindow *")); |
6869 | 6869 |
6870 gaim_signal_register(handle, "conversation-timestamp", | 6870 purple_signal_register(handle, "conversation-timestamp", |
6871 #if SIZEOF_TIME_T == 4 | 6871 #if SIZEOF_TIME_T == 4 |
6872 gaim_marshal_POINTER__POINTER_INT_BOOLEAN, | 6872 purple_marshal_POINTER__POINTER_INT_BOOLEAN, |
6873 #elif SIZEOF_TIME_T == 8 | 6873 #elif SIZEOF_TIME_T == 8 |
6874 gaim_marshal_POINTER__POINTER_INT64_BOOLEAN, | 6874 purple_marshal_POINTER__POINTER_INT64_BOOLEAN, |
6875 #else | 6875 #else |
6876 #error Unkown size of time_t | 6876 #error Unkown size of time_t |
6877 #endif | 6877 #endif |
6878 gaim_value_new(GAIM_TYPE_STRING), 3, | 6878 purple_value_new(PURPLE_TYPE_STRING), 3, |
6879 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6879 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6880 GAIM_SUBTYPE_CONVERSATION), | 6880 PURPLE_SUBTYPE_CONVERSATION), |
6881 #if SIZEOF_TIME_T == 4 | 6881 #if SIZEOF_TIME_T == 4 |
6882 gaim_value_new(GAIM_TYPE_INT), | 6882 purple_value_new(PURPLE_TYPE_INT), |
6883 #elif SIZEOF_TIME_T == 8 | 6883 #elif SIZEOF_TIME_T == 8 |
6884 gaim_value_new(GAIM_TYPE_INT64), | 6884 purple_value_new(PURPLE_TYPE_INT64), |
6885 #else | 6885 #else |
6886 # error Unknown size of time_t | 6886 # error Unknown size of time_t |
6887 #endif | 6887 #endif |
6888 gaim_value_new(GAIM_TYPE_BOOLEAN)); | 6888 purple_value_new(PURPLE_TYPE_BOOLEAN)); |
6889 | 6889 |
6890 gaim_signal_register(handle, "displaying-im-msg", | 6890 purple_signal_register(handle, "displaying-im-msg", |
6891 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | 6891 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, |
6892 gaim_value_new(GAIM_TYPE_BOOLEAN), 5, | 6892 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
6893 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6893 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6894 GAIM_SUBTYPE_ACCOUNT), | 6894 PURPLE_SUBTYPE_ACCOUNT), |
6895 gaim_value_new(GAIM_TYPE_STRING), | 6895 purple_value_new(PURPLE_TYPE_STRING), |
6896 gaim_value_new_outgoing(GAIM_TYPE_STRING), | 6896 purple_value_new_outgoing(PURPLE_TYPE_STRING), |
6897 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6897 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6898 GAIM_SUBTYPE_CONVERSATION), | 6898 PURPLE_SUBTYPE_CONVERSATION), |
6899 gaim_value_new(GAIM_TYPE_INT)); | 6899 purple_value_new(PURPLE_TYPE_INT)); |
6900 | 6900 |
6901 gaim_signal_register(handle, "displayed-im-msg", | 6901 purple_signal_register(handle, "displayed-im-msg", |
6902 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | 6902 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, |
6903 NULL, 5, | 6903 NULL, 5, |
6904 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6904 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6905 GAIM_SUBTYPE_ACCOUNT), | 6905 PURPLE_SUBTYPE_ACCOUNT), |
6906 gaim_value_new(GAIM_TYPE_STRING), | 6906 purple_value_new(PURPLE_TYPE_STRING), |
6907 gaim_value_new(GAIM_TYPE_STRING), | 6907 purple_value_new(PURPLE_TYPE_STRING), |
6908 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6908 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6909 GAIM_SUBTYPE_CONVERSATION), | 6909 PURPLE_SUBTYPE_CONVERSATION), |
6910 gaim_value_new(GAIM_TYPE_INT)); | 6910 purple_value_new(PURPLE_TYPE_INT)); |
6911 | 6911 |
6912 gaim_signal_register(handle, "displaying-chat-msg", | 6912 purple_signal_register(handle, "displaying-chat-msg", |
6913 gaim_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, | 6913 purple_marshal_BOOLEAN__POINTER_POINTER_POINTER_POINTER_POINTER, |
6914 gaim_value_new(GAIM_TYPE_BOOLEAN), 5, | 6914 purple_value_new(PURPLE_TYPE_BOOLEAN), 5, |
6915 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6915 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6916 GAIM_SUBTYPE_ACCOUNT), | 6916 PURPLE_SUBTYPE_ACCOUNT), |
6917 gaim_value_new(GAIM_TYPE_STRING), | 6917 purple_value_new(PURPLE_TYPE_STRING), |
6918 gaim_value_new_outgoing(GAIM_TYPE_STRING), | 6918 purple_value_new_outgoing(PURPLE_TYPE_STRING), |
6919 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6919 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6920 GAIM_SUBTYPE_CONVERSATION), | 6920 PURPLE_SUBTYPE_CONVERSATION), |
6921 gaim_value_new(GAIM_TYPE_INT)); | 6921 purple_value_new(PURPLE_TYPE_INT)); |
6922 | 6922 |
6923 gaim_signal_register(handle, "displayed-chat-msg", | 6923 purple_signal_register(handle, "displayed-chat-msg", |
6924 gaim_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, | 6924 purple_marshal_VOID__POINTER_POINTER_POINTER_POINTER_UINT, |
6925 NULL, 5, | 6925 NULL, 5, |
6926 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6926 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6927 GAIM_SUBTYPE_ACCOUNT), | 6927 PURPLE_SUBTYPE_ACCOUNT), |
6928 gaim_value_new(GAIM_TYPE_STRING), | 6928 purple_value_new(PURPLE_TYPE_STRING), |
6929 gaim_value_new(GAIM_TYPE_STRING), | 6929 purple_value_new(PURPLE_TYPE_STRING), |
6930 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6930 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6931 GAIM_SUBTYPE_CONVERSATION), | 6931 PURPLE_SUBTYPE_CONVERSATION), |
6932 gaim_value_new(GAIM_TYPE_INT)); | 6932 purple_value_new(PURPLE_TYPE_INT)); |
6933 | 6933 |
6934 gaim_signal_register(handle, "conversation-switched", | 6934 purple_signal_register(handle, "conversation-switched", |
6935 gaim_marshal_VOID__POINTER_POINTER, NULL, 1, | 6935 purple_marshal_VOID__POINTER_POINTER, NULL, 1, |
6936 gaim_value_new(GAIM_TYPE_SUBTYPE, | 6936 purple_value_new(PURPLE_TYPE_SUBTYPE, |
6937 GAIM_SUBTYPE_CONVERSATION)); | 6937 PURPLE_SUBTYPE_CONVERSATION)); |
6938 | 6938 |
6939 /********************************************************************** | 6939 /********************************************************************** |
6940 * Register commands | 6940 * Register commands |
6941 **********************************************************************/ | 6941 **********************************************************************/ |
6942 gaim_cmd_register("say", "S", GAIM_CMD_P_DEFAULT, | 6942 purple_cmd_register("say", "S", PURPLE_CMD_P_DEFAULT, |
6943 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | 6943 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
6944 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); | 6944 say_command_cb, _("say <message>: Send a message normally as if you weren't using a command."), NULL); |
6945 gaim_cmd_register("me", "S", GAIM_CMD_P_DEFAULT, | 6945 purple_cmd_register("me", "S", PURPLE_CMD_P_DEFAULT, |
6946 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | 6946 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
6947 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); | 6947 me_command_cb, _("me <action>: Send an IRC style action to a buddy or chat."), NULL); |
6948 gaim_cmd_register("debug", "w", GAIM_CMD_P_DEFAULT, | 6948 purple_cmd_register("debug", "w", PURPLE_CMD_P_DEFAULT, |
6949 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | 6949 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
6950 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); | 6950 debug_command_cb, _("debug <option>: Send various debug information to the current conversation."), NULL); |
6951 gaim_cmd_register("clear", "", GAIM_CMD_P_DEFAULT, | 6951 purple_cmd_register("clear", "", PURPLE_CMD_P_DEFAULT, |
6952 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM, NULL, | 6952 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM, NULL, |
6953 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); | 6953 clear_command_cb, _("clear: Clears the conversation scrollback."), NULL); |
6954 gaim_cmd_register("help", "w", GAIM_CMD_P_DEFAULT, | 6954 purple_cmd_register("help", "w", PURPLE_CMD_P_DEFAULT, |
6955 GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, | 6955 PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_ALLOW_WRONG_ARGS, NULL, |
6956 help_command_cb, _("help <command>: Help on a specific command."), NULL); | 6956 help_command_cb, _("help <command>: Help on a specific command."), NULL); |
6957 | 6957 |
6958 /********************************************************************** | 6958 /********************************************************************** |
6959 * UI operations | 6959 * UI operations |
6960 **********************************************************************/ | 6960 **********************************************************************/ |
6961 | 6961 |
6962 gaim_signal_connect(gaim_connections_get_handle(), "signed-on", handle, | 6962 purple_signal_connect(purple_connections_get_handle(), "signed-on", handle, |
6963 G_CALLBACK(account_signed_off_cb), | 6963 G_CALLBACK(account_signed_off_cb), |
6964 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_ONLINE)); | 6964 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_ONLINE)); |
6965 gaim_signal_connect(gaim_connections_get_handle(), "signed-off", handle, | 6965 purple_signal_connect(purple_connections_get_handle(), "signed-off", handle, |
6966 G_CALLBACK(account_signed_off_cb), | 6966 G_CALLBACK(account_signed_off_cb), |
6967 GINT_TO_POINTER(GAIM_CONV_ACCOUNT_OFFLINE)); | 6967 GINT_TO_POINTER(PURPLE_CONV_ACCOUNT_OFFLINE)); |
6968 | 6968 |
6969 gaim_signal_connect(gaim_conversations_get_handle(), "received-im-msg", | 6969 purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", |
6970 handle, G_CALLBACK(received_im_msg_cb), NULL); | 6970 handle, G_CALLBACK(received_im_msg_cb), NULL); |
6971 | 6971 |
6972 gaim_conversations_set_ui_ops(&conversation_ui_ops); | 6972 purple_conversations_set_ui_ops(&conversation_ui_ops); |
6973 | 6973 |
6974 hidden_convwin = pidgin_conv_window_new(); | 6974 hidden_convwin = pidgin_conv_window_new(); |
6975 window_list = g_list_remove(window_list, hidden_convwin); | 6975 window_list = g_list_remove(window_list, hidden_convwin); |
6976 | 6976 |
6977 gaim_signal_connect(gaim_accounts_get_handle(), "account-status-changed", | 6977 purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", |
6978 handle, GAIM_CALLBACK(account_status_changed_cb), NULL); | 6978 handle, PURPLE_CALLBACK(account_status_changed_cb), NULL); |
6979 | 6979 |
6980 /* Callbacks to update a conversation */ | 6980 /* Callbacks to update a conversation */ |
6981 gaim_signal_connect(blist_handle, "buddy-added", handle, | 6981 purple_signal_connect(blist_handle, "buddy-added", handle, |
6982 G_CALLBACK(buddy_update_cb), NULL); | 6982 G_CALLBACK(buddy_update_cb), NULL); |
6983 gaim_signal_connect(blist_handle, "buddy-removed", handle, | 6983 purple_signal_connect(blist_handle, "buddy-removed", handle, |
6984 G_CALLBACK(buddy_update_cb), NULL); | 6984 G_CALLBACK(buddy_update_cb), NULL); |
6985 gaim_signal_connect(blist_handle, "buddy-signed-on", | 6985 purple_signal_connect(blist_handle, "buddy-signed-on", |
6986 handle, GAIM_CALLBACK(update_buddy_sign), "on"); | 6986 handle, PURPLE_CALLBACK(update_buddy_sign), "on"); |
6987 gaim_signal_connect(blist_handle, "buddy-signed-off", | 6987 purple_signal_connect(blist_handle, "buddy-signed-off", |
6988 handle, GAIM_CALLBACK(update_buddy_sign), "off"); | 6988 handle, PURPLE_CALLBACK(update_buddy_sign), "off"); |
6989 gaim_signal_connect(blist_handle, "buddy-status-changed", | 6989 purple_signal_connect(blist_handle, "buddy-status-changed", |
6990 handle, GAIM_CALLBACK(update_buddy_status_changed), NULL); | 6990 handle, PURPLE_CALLBACK(update_buddy_status_changed), NULL); |
6991 gaim_signal_connect(blist_handle, "buddy-privacy-changed", | 6991 purple_signal_connect(blist_handle, "buddy-privacy-changed", |
6992 handle, GAIM_CALLBACK(update_buddy_privacy_changed), NULL); | 6992 handle, PURPLE_CALLBACK(update_buddy_privacy_changed), NULL); |
6993 gaim_signal_connect(blist_handle, "buddy-idle-changed", | 6993 purple_signal_connect(blist_handle, "buddy-idle-changed", |
6994 handle, GAIM_CALLBACK(update_buddy_idle_changed), NULL); | 6994 handle, PURPLE_CALLBACK(update_buddy_idle_changed), NULL); |
6995 gaim_signal_connect(blist_handle, "buddy-icon-changed", | 6995 purple_signal_connect(blist_handle, "buddy-icon-changed", |
6996 handle, GAIM_CALLBACK(update_buddy_icon), NULL); | 6996 handle, PURPLE_CALLBACK(update_buddy_icon), NULL); |
6997 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing", | 6997 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", |
6998 handle, GAIM_CALLBACK(update_buddy_typing), NULL); | 6998 handle, PURPLE_CALLBACK(update_buddy_typing), NULL); |
6999 gaim_signal_connect(gaim_conversations_get_handle(), "buddy-typing-stopped", | 6999 purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", |
7000 handle, GAIM_CALLBACK(update_buddy_typing), NULL); | 7000 handle, PURPLE_CALLBACK(update_buddy_typing), NULL); |
7001 gaim_signal_connect(pidgin_conversations_get_handle(), "conversation-switched", | 7001 purple_signal_connect(pidgin_conversations_get_handle(), "conversation-switched", |
7002 handle, GAIM_CALLBACK(update_conversation_switched), NULL); | 7002 handle, PURPLE_CALLBACK(update_conversation_switched), NULL); |
7003 gaim_signal_connect(gaim_conversations_get_handle(), "chat-left", handle, | 7003 purple_signal_connect(purple_conversations_get_handle(), "chat-left", handle, |
7004 GAIM_CALLBACK(update_chat), NULL); | 7004 PURPLE_CALLBACK(update_chat), NULL); |
7005 gaim_signal_connect(gaim_conversations_get_handle(), "chat-joined", handle, | 7005 purple_signal_connect(purple_conversations_get_handle(), "chat-joined", handle, |
7006 GAIM_CALLBACK(update_chat), NULL); | 7006 PURPLE_CALLBACK(update_chat), NULL); |
7007 gaim_signal_connect(gaim_conversations_get_handle(), "chat-topic-changed", handle, | 7007 purple_signal_connect(purple_conversations_get_handle(), "chat-topic-changed", handle, |
7008 GAIM_CALLBACK(update_chat_topic), NULL); | 7008 PURPLE_CALLBACK(update_chat_topic), NULL); |
7009 gaim_signal_connect_priority(gaim_conversations_get_handle(), "conversation-updated", handle, | 7009 purple_signal_connect_priority(purple_conversations_get_handle(), "conversation-updated", handle, |
7010 GAIM_CALLBACK(pidgin_conv_updated), NULL, | 7010 PURPLE_CALLBACK(pidgin_conv_updated), NULL, |
7011 GAIM_SIGNAL_PRIORITY_LOWEST); | 7011 PURPLE_SIGNAL_PRIORITY_LOWEST); |
7012 } | 7012 } |
7013 | 7013 |
7014 void | 7014 void |
7015 pidgin_conversations_uninit(void) | 7015 pidgin_conversations_uninit(void) |
7016 { | 7016 { |
7017 gaim_prefs_disconnect_by_handle(pidgin_conversations_get_handle()); | 7017 purple_prefs_disconnect_by_handle(pidgin_conversations_get_handle()); |
7018 gaim_signals_disconnect_by_handle(pidgin_conversations_get_handle()); | 7018 purple_signals_disconnect_by_handle(pidgin_conversations_get_handle()); |
7019 gaim_signals_unregister_by_instance(pidgin_conversations_get_handle()); | 7019 purple_signals_unregister_by_instance(pidgin_conversations_get_handle()); |
7020 pidgin_conv_window_destroy(hidden_convwin); | 7020 pidgin_conv_window_destroy(hidden_convwin); |
7021 hidden_convwin=NULL; | 7021 hidden_convwin=NULL; |
7022 } | 7022 } |
7023 | 7023 |
7024 | 7024 |
7041 | 7041 |
7042 /** | 7042 /** |
7043 * @file gtkconvwin.c GTK+ Conversation Window API | 7043 * @file gtkconvwin.c GTK+ Conversation Window API |
7044 * @ingroup gtkui | 7044 * @ingroup gtkui |
7045 * | 7045 * |
7046 * gaim | 7046 * purple |
7047 * | 7047 * |
7048 * Gaim is the legal property of its developers, whose names are too numerous | 7048 * Purple is the legal property of its developers, whose names are too numerous |
7049 * to list here. Please refer to the COPYRIGHT file distributed with this | 7049 * to list here. Please refer to the COPYRIGHT file distributed with this |
7050 * source distribution. | 7050 * source distribution. |
7051 * | 7051 * |
7052 * This program is free software; you can redistribute it and/or modify | 7052 * This program is free software; you can redistribute it and/or modify |
7053 * it under the terms of the GNU General Public License as published by | 7053 * it under the terms of the GNU General Public License as published by |
7171 /* If there are unread messages then show a warning dialog */ | 7171 /* If there are unread messages then show a warning dialog */ |
7172 for (l = pidgin_conv_window_get_gtkconvs(win); | 7172 for (l = pidgin_conv_window_get_gtkconvs(win); |
7173 l != NULL; l = l->next) | 7173 l != NULL; l = l->next) |
7174 { | 7174 { |
7175 PidginConversation *gtkconv = l->data; | 7175 PidginConversation *gtkconv = l->data; |
7176 if (gaim_conversation_get_type(gtkconv->active_conv) == GAIM_CONV_TYPE_IM && | 7176 if (purple_conversation_get_type(gtkconv->active_conv) == PURPLE_CONV_TYPE_IM && |
7177 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT) | 7177 gtkconv->unseen_state >= PIDGIN_UNSEEN_TEXT) |
7178 { | 7178 { |
7179 build_warn_close_dialog(win); | 7179 build_warn_close_dialog(win); |
7180 gtk_widget_show_all(warn_close_dialog); | 7180 gtk_widget_show_all(warn_close_dialog); |
7181 | 7181 |
7203 | 7203 |
7204 if (state > gtkconv->unseen_state) | 7204 if (state > gtkconv->unseen_state) |
7205 gtkconv->unseen_state = state; | 7205 gtkconv->unseen_state = state; |
7206 } | 7206 } |
7207 | 7207 |
7208 gaim_conversation_update(gtkconv->active_conv, GAIM_CONV_UPDATE_UNSEEN); | 7208 purple_conversation_update(gtkconv->active_conv, PURPLE_CONV_UPDATE_UNSEEN); |
7209 } | 7209 } |
7210 | 7210 |
7211 /* | 7211 /* |
7212 * When a conversation window is focused, we know the user | 7212 * When a conversation window is focused, we know the user |
7213 * has looked at it so we know there are no longer unseen | 7213 * has looked at it so we know there are no longer unseen |
7397 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) | 7397 if (e->button != 1 || e->type != GDK_BUTTON_PRESS) |
7398 return FALSE; | 7398 return FALSE; |
7399 | 7399 |
7400 | 7400 |
7401 if (win->in_drag) { | 7401 if (win->in_drag) { |
7402 gaim_debug(GAIM_DEBUG_WARNING, "gtkconv", | 7402 purple_debug(PURPLE_DEBUG_WARNING, "gtkconv", |
7403 "Already in the middle of a window drag at tab_press_cb\n"); | 7403 "Already in the middle of a window drag at tab_press_cb\n"); |
7404 return TRUE; | 7404 return TRUE; |
7405 } | 7405 } |
7406 | 7406 |
7407 /* | 7407 /* |
7463 | 7463 |
7464 static gboolean | 7464 static gboolean |
7465 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) | 7465 notebook_release_cb(GtkWidget *widget, GdkEventButton *e, PidginWindow *win) |
7466 { | 7466 { |
7467 PidginWindow *dest_win; | 7467 PidginWindow *dest_win; |
7468 GaimConversation *conv; | 7468 PurpleConversation *conv; |
7469 PidginConversation *gtkconv; | 7469 PidginConversation *gtkconv; |
7470 gint dest_page_num = 0; | 7470 gint dest_page_num = 0; |
7471 gboolean new_window = FALSE; | 7471 gboolean new_window = FALSE; |
7472 gboolean to_right = FALSE; | 7472 gboolean to_right = FALSE; |
7473 | 7473 |
7534 } | 7534 } |
7535 | 7535 |
7536 if (dest_win == NULL) | 7536 if (dest_win == NULL) |
7537 return FALSE; | 7537 return FALSE; |
7538 | 7538 |
7539 gaim_signal_emit(pidgin_conversations_get_handle(), | 7539 purple_signal_emit(pidgin_conversations_get_handle(), |
7540 "conversation-dragging", win, dest_win); | 7540 "conversation-dragging", win, dest_win); |
7541 | 7541 |
7542 /* Get the destination page number. */ | 7542 /* Get the destination page number. */ |
7543 if (!new_window) | 7543 if (!new_window) |
7544 dest_page_num = pidgin_conv_get_tab_at_xy(dest_win, | 7544 dest_page_num = pidgin_conv_get_tab_at_xy(dest_win, |
7576 static void | 7576 static void |
7577 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | 7577 before_switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
7578 gpointer user_data) | 7578 gpointer user_data) |
7579 { | 7579 { |
7580 PidginWindow *win; | 7580 PidginWindow *win; |
7581 GaimConversation *conv; | 7581 PurpleConversation *conv; |
7582 PidginConversation *gtkconv; | 7582 PidginConversation *gtkconv; |
7583 | 7583 |
7584 win = user_data; | 7584 win = user_data; |
7585 conv = pidgin_conv_window_get_active_conversation(win); | 7585 conv = pidgin_conv_window_get_active_conversation(win); |
7586 | 7586 |
7587 g_return_if_fail(conv != NULL); | 7587 g_return_if_fail(conv != NULL); |
7588 | 7588 |
7589 if (gaim_conversation_get_type(conv) != GAIM_CONV_TYPE_IM) | 7589 if (purple_conversation_get_type(conv) != PURPLE_CONV_TYPE_IM) |
7590 return; | 7590 return; |
7591 | 7591 |
7592 gtkconv = PIDGIN_CONVERSATION(conv); | 7592 gtkconv = PIDGIN_CONVERSATION(conv); |
7593 | 7593 |
7594 stop_anim(NULL, gtkconv); | 7594 stop_anim(NULL, gtkconv); |
7713 static void | 7713 static void |
7714 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, | 7714 switch_conv_cb(GtkNotebook *notebook, GtkWidget *page, gint page_num, |
7715 gpointer user_data) | 7715 gpointer user_data) |
7716 { | 7716 { |
7717 PidginWindow *win; | 7717 PidginWindow *win; |
7718 GaimConversation *conv; | 7718 PurpleConversation *conv; |
7719 PidginConversation *gtkconv; | 7719 PidginConversation *gtkconv; |
7720 const char *sound_method; | 7720 const char *sound_method; |
7721 | 7721 |
7722 win = user_data; | 7722 win = user_data; |
7723 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, page_num); | 7723 gtkconv = pidgin_conv_window_get_gtkconv_at_index(win, page_num); |
7731 } | 7731 } |
7732 | 7732 |
7733 /* Update the menubar */ | 7733 /* Update the menubar */ |
7734 | 7734 |
7735 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), | 7735 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(gtkconv->win->menu.logging), |
7736 gaim_conversation_is_logging(conv)); | 7736 purple_conversation_is_logging(conv)); |
7737 | 7737 |
7738 generate_send_to_items(win); | 7738 generate_send_to_items(win); |
7739 regenerate_options_items(win); | 7739 regenerate_options_items(win); |
7740 | 7740 |
7741 pidgin_conv_switch_active_conversation(conv); | 7741 pidgin_conv_switch_active_conversation(conv); |
7742 | 7742 |
7743 sound_method = gaim_prefs_get_string("/gaim/gtk/sound/method"); | 7743 sound_method = purple_prefs_get_string("/purple/gtk/sound/method"); |
7744 if (strcmp(sound_method, "none") != 0) | 7744 if (strcmp(sound_method, "none") != 0) |
7745 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), | 7745 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.sounds), |
7746 gtkconv->make_sound); | 7746 gtkconv->make_sound); |
7747 | 7747 |
7748 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), | 7748 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_formatting_toolbar), |
7749 gaim_prefs_get_bool("/gaim/gtk/conversations/show_formatting_toolbar")); | 7749 purple_prefs_get_bool("/purple/gtk/conversations/show_formatting_toolbar")); |
7750 | 7750 |
7751 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), | 7751 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_timestamps), |
7752 gaim_prefs_get_bool("/gaim/gtk/conversations/show_timestamps")); | 7752 purple_prefs_get_bool("/purple/gtk/conversations/show_timestamps")); |
7753 | 7753 |
7754 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM && | 7754 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM && |
7755 gaim_prefs_get_bool("/gaim/gtk/conversations/im/show_buddy_icons")) | 7755 purple_prefs_get_bool("/purple/gtk/conversations/im/show_buddy_icons")) |
7756 { | 7756 { |
7757 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), | 7757 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(win->menu.show_icon), |
7758 gtkconv->u.im->show_icon); | 7758 gtkconv->u.im->show_icon); |
7759 } | 7759 } |
7760 | 7760 |
7761 /* | 7761 /* |
7762 * We pause icons when they are not visible. If this icon should | 7762 * We pause icons when they are not visible. If this icon should |
7763 * be animated then start it back up again. | 7763 * be animated then start it back up again. |
7764 */ | 7764 */ |
7765 if ((gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) && | 7765 if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && |
7766 (gtkconv->u.im->animate)) | 7766 (gtkconv->u.im->animate)) |
7767 start_anim(NULL, gtkconv); | 7767 start_anim(NULL, gtkconv); |
7768 | 7768 |
7769 gaim_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); | 7769 purple_signal_emit(pidgin_conversations_get_handle(), "conversation-switched", conv); |
7770 } | 7770 } |
7771 | 7771 |
7772 /************************************************************************** | 7772 /************************************************************************** |
7773 * GTK+ window ops | 7773 * GTK+ window ops |
7774 **************************************************************************/ | 7774 **************************************************************************/ |
7837 G_CALLBACK(focus_win_cb), win); | 7837 G_CALLBACK(focus_win_cb), win); |
7838 | 7838 |
7839 /* Create the notebook. */ | 7839 /* Create the notebook. */ |
7840 win->notebook = gtk_notebook_new(); | 7840 win->notebook = gtk_notebook_new(); |
7841 | 7841 |
7842 pos = gaim_prefs_get_int("/gaim/gtk/conversations/tab_side"); | 7842 pos = purple_prefs_get_int("/purple/gtk/conversations/tab_side"); |
7843 | 7843 |
7844 #if 0 | 7844 #if 0 |
7845 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(win->notebook), 0); | 7845 gtk_notebook_set_tab_hborder(GTK_NOTEBOOK(win->notebook), 0); |
7846 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(win->notebook), 0); | 7846 gtk_notebook_set_tab_vborder(GTK_NOTEBOOK(win->notebook), 0); |
7847 #endif | 7847 #endif |
7890 } | 7890 } |
7891 | 7891 |
7892 void | 7892 void |
7893 pidgin_conv_window_destroy(PidginWindow *win) | 7893 pidgin_conv_window_destroy(PidginWindow *win) |
7894 { | 7894 { |
7895 gaim_prefs_disconnect_by_handle(win); | 7895 purple_prefs_disconnect_by_handle(win); |
7896 window_list = g_list_remove(window_list, win); | 7896 window_list = g_list_remove(window_list, win); |
7897 | 7897 |
7898 /* Close the "Find" dialog if it's open */ | 7898 /* Close the "Find" dialog if it's open */ |
7899 if (win->dialogs.search) | 7899 if (win->dialogs.search) |
7900 gtk_widget_destroy(win->dialogs.search); | 7900 gtk_widget_destroy(win->dialogs.search); |
7904 if (win->gtkconvs) { | 7904 if (win->gtkconvs) { |
7905 while (win->gtkconvs) { | 7905 while (win->gtkconvs) { |
7906 GList *nextgtk = win->gtkconvs->next; | 7906 GList *nextgtk = win->gtkconvs->next; |
7907 PidginConversation *gtkconv = win->gtkconvs->data; | 7907 PidginConversation *gtkconv = win->gtkconvs->data; |
7908 GList *nextcore = gtkconv->convs->next; | 7908 GList *nextcore = gtkconv->convs->next; |
7909 GaimConversation *conv = gtkconv->convs->data; | 7909 PurpleConversation *conv = gtkconv->convs->data; |
7910 gaim_conversation_destroy(conv); | 7910 purple_conversation_destroy(conv); |
7911 if (!nextgtk && !nextcore) | 7911 if (!nextgtk && !nextcore) |
7912 /* we'll end up invoking ourselves when we destroy our last child */ | 7912 /* we'll end up invoking ourselves when we destroy our last child */ |
7913 /* so don't destroy ourselves right now */ | 7913 /* so don't destroy ourselves right now */ |
7914 return; | 7914 return; |
7915 } | 7915 } |
7917 } | 7917 } |
7918 gtk_widget_destroy(win->window); | 7918 gtk_widget_destroy(win->window); |
7919 | 7919 |
7920 g_object_unref(G_OBJECT(win->menu.item_factory)); | 7920 g_object_unref(G_OBJECT(win->menu.item_factory)); |
7921 | 7921 |
7922 gaim_notify_close_with_handle(win); | 7922 purple_notify_close_with_handle(win); |
7923 | 7923 |
7924 g_free(win); | 7924 g_free(win); |
7925 } | 7925 } |
7926 | 7926 |
7927 void | 7927 void |
7951 } | 7951 } |
7952 | 7952 |
7953 void | 7953 void |
7954 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv) | 7954 pidgin_conv_window_add_gtkconv(PidginWindow *win, PidginConversation *gtkconv) |
7955 { | 7955 { |
7956 GaimConversation *conv = gtkconv->active_conv; | 7956 PurpleConversation *conv = gtkconv->active_conv; |
7957 PidginConversation *focus_gtkconv; | 7957 PidginConversation *focus_gtkconv; |
7958 GtkWidget *tabby, *menu_tabby; | 7958 GtkWidget *tabby, *menu_tabby; |
7959 GtkWidget *tab_cont = gtkconv->tab_cont; | 7959 GtkWidget *tab_cont = gtkconv->tab_cont; |
7960 GtkWidget *close_image; | 7960 GtkWidget *close_image; |
7961 GaimConversationType conv_type; | 7961 PurpleConversationType conv_type; |
7962 const gchar *tmp_lab; | 7962 const gchar *tmp_lab; |
7963 gint close_button_width, close_button_height, focus_width, focus_pad; | 7963 gint close_button_width, close_button_height, focus_width, focus_pad; |
7964 gboolean tabs_side = FALSE; | 7964 gboolean tabs_side = FALSE; |
7965 gint angle = 0; | 7965 gint angle = 0; |
7966 | 7966 |
7967 conv_type = gaim_conversation_get_type(conv); | 7967 conv_type = purple_conversation_get_type(conv); |
7968 | 7968 |
7969 | 7969 |
7970 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); | 7970 win->gtkconvs = g_list_append(win->gtkconvs, gtkconv); |
7971 gtkconv->win = win; | 7971 gtkconv->win = win; |
7972 | 7972 |
7973 if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_LEFT || | 7973 if (purple_prefs_get_int("/purple/gtk/conversations/tab_side") == GTK_POS_LEFT || |
7974 gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == GTK_POS_RIGHT) | 7974 purple_prefs_get_int("/purple/gtk/conversations/tab_side") == GTK_POS_RIGHT) |
7975 tabs_side = TRUE; | 7975 tabs_side = TRUE; |
7976 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_LEFT|8)) | 7976 else if (purple_prefs_get_int("/purple/gtk/conversations/tab_side") == (GTK_POS_LEFT|8)) |
7977 angle = 90; | 7977 angle = 90; |
7978 else if (gaim_prefs_get_int("/gaim/gtk/conversations/tab_side") == (GTK_POS_RIGHT|8)) | 7978 else if (purple_prefs_get_int("/purple/gtk/conversations/tab_side") == (GTK_POS_RIGHT|8)) |
7979 angle = 270; | 7979 angle = 270; |
7980 | 7980 |
7981 if (angle) | 7981 if (angle) |
7982 gtkconv->tabby = tabby = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); | 7982 gtkconv->tabby = tabby = gtk_vbox_new(FALSE, PIDGIN_HIG_BOX_SPACE); |
7983 else | 7983 else |
8023 gtkconv->icon = gtk_image_new(); | 8023 gtkconv->icon = gtk_image_new(); |
8024 gtkconv->menu_icon = gtk_image_new(); | 8024 gtkconv->menu_icon = gtk_image_new(); |
8025 update_tab_icon(conv); | 8025 update_tab_icon(conv); |
8026 | 8026 |
8027 /* Tab label. */ | 8027 /* Tab label. */ |
8028 gtkconv->tab_label = gtk_label_new(tmp_lab = gaim_conversation_get_title(conv)); | 8028 gtkconv->tab_label = gtk_label_new(tmp_lab = purple_conversation_get_title(conv)); |
8029 | 8029 |
8030 #if GTK_CHECK_VERSION(2,6,0) | 8030 #if GTK_CHECK_VERSION(2,6,0) |
8031 if (!angle) | 8031 if (!angle) |
8032 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); | 8032 g_object_set(G_OBJECT(gtkconv->tab_label), "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
8033 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); | 8033 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), 6); |
8035 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), MIN(g_utf8_strlen(tmp_lab, -1), 12)); | 8035 gtk_label_set_width_chars(GTK_LABEL(gtkconv->tab_label), MIN(g_utf8_strlen(tmp_lab, -1), 12)); |
8036 } | 8036 } |
8037 if (angle) | 8037 if (angle) |
8038 gtk_label_set_angle(GTK_LABEL(gtkconv->tab_label), angle); | 8038 gtk_label_set_angle(GTK_LABEL(gtkconv->tab_label), angle); |
8039 #endif | 8039 #endif |
8040 gtkconv->menu_label = gtk_label_new(gaim_conversation_get_title(conv)); | 8040 gtkconv->menu_label = gtk_label_new(purple_conversation_get_title(conv)); |
8041 #if 0 | 8041 #if 0 |
8042 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); | 8042 gtk_misc_set_alignment(GTK_MISC(gtkconv->tab_label), 0.00, 0.5); |
8043 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); | 8043 gtk_misc_set_padding(GTK_MISC(gtkconv->tab_label), 4, 0); |
8044 #endif | 8044 #endif |
8045 | 8045 |
8062 | 8062 |
8063 if (angle == 90) | 8063 if (angle == 90) |
8064 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); | 8064 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->icon, FALSE, FALSE, 0); |
8065 else | 8065 else |
8066 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); | 8066 gtk_box_pack_start(GTK_BOX(tabby), gtkconv->close, FALSE, FALSE, 0); |
8067 if (gaim_prefs_get_bool("/gaim/gtk/conversations/close_on_tabs")) | 8067 if (purple_prefs_get_bool("/purple/gtk/conversations/close_on_tabs")) |
8068 gtk_widget_show(gtkconv->close); | 8068 gtk_widget_show(gtkconv->close); |
8069 | 8069 |
8070 gtk_widget_show(tabby); | 8070 gtk_widget_show(tabby); |
8071 gtk_widget_show(menu_tabby); | 8071 gtk_widget_show(menu_tabby); |
8072 | 8072 |
8073 if (gaim_conversation_get_type(conv) == GAIM_CONV_TYPE_IM) | 8073 if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) |
8074 pidgin_conv_update_buddy_icon(conv); | 8074 pidgin_conv_update_buddy_icon(conv); |
8075 | 8075 |
8076 /* Add this pane to the conversation's notebook. */ | 8076 /* Add this pane to the conversation's notebook. */ |
8077 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby); | 8077 gtk_notebook_append_page_menu(GTK_NOTEBOOK(win->notebook), tab_cont, tabby, menu_tabby); |
8078 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); | 8078 gtk_notebook_set_tab_label_packing(GTK_NOTEBOOK(win->notebook), tab_cont, !tabs_side && !angle, TRUE, GTK_PACK_START); |
8083 if (pidgin_conv_window_get_gtkconv_count(win) == 1) { | 8083 if (pidgin_conv_window_get_gtkconv_count(win) == 1) { |
8084 /* Er, bug in notebooks? Switch to the page manually. */ | 8084 /* Er, bug in notebooks? Switch to the page manually. */ |
8085 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); | 8085 gtk_notebook_set_current_page(GTK_NOTEBOOK(win->notebook), 0); |
8086 | 8086 |
8087 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), | 8087 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), |
8088 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); | 8088 purple_prefs_get_bool("/purple/gtk/conversations/tabs")); |
8089 } else | 8089 } else |
8090 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); | 8090 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), TRUE); |
8091 | 8091 |
8092 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win), | 8092 focus_gtkconv = g_list_nth_data(pidgin_conv_window_get_gtkconvs(win), |
8093 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); | 8093 gtk_notebook_get_current_page(GTK_NOTEBOOK(win->notebook))); |
8099 | 8099 |
8100 void | 8100 void |
8101 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv) | 8101 pidgin_conv_window_remove_gtkconv(PidginWindow *win, PidginConversation *gtkconv) |
8102 { | 8102 { |
8103 unsigned int index; | 8103 unsigned int index; |
8104 GaimConversationType conv_type; | 8104 PurpleConversationType conv_type; |
8105 | 8105 |
8106 conv_type = gaim_conversation_get_type(gtkconv->active_conv); | 8106 conv_type = purple_conversation_get_type(gtkconv->active_conv); |
8107 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); | 8107 index = gtk_notebook_page_num(GTK_NOTEBOOK(win->notebook), gtkconv->tab_cont); |
8108 | 8108 |
8109 g_object_ref(gtkconv->tab_cont); | 8109 g_object_ref(gtkconv->tab_cont); |
8110 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); | 8110 gtk_object_sink(GTK_OBJECT(gtkconv->tab_cont)); |
8111 | 8111 |
8112 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); | 8112 gtk_notebook_remove_page(GTK_NOTEBOOK(win->notebook), index); |
8113 | 8113 |
8114 /* go back to tabless if need be */ | 8114 /* go back to tabless if need be */ |
8115 if (pidgin_conv_window_get_gtkconv_count(win) <= 2) { | 8115 if (pidgin_conv_window_get_gtkconv_count(win) <= 2) { |
8116 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), | 8116 gtk_notebook_set_show_tabs(GTK_NOTEBOOK(win->notebook), |
8117 gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")); | 8117 purple_prefs_get_bool("/purple/gtk/conversations/tabs")); |
8118 } | 8118 } |
8119 | 8119 |
8120 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); | 8120 win->gtkconvs = g_list_remove(win->gtkconvs, gtkconv); |
8121 | 8121 |
8122 if (!win->gtkconvs && win != hidden_convwin) | 8122 if (!win->gtkconvs && win != hidden_convwin) |
8148 return NULL; | 8148 return NULL; |
8149 return g_object_get_data(G_OBJECT(tab_cont), "PidginConversation"); | 8149 return g_object_get_data(G_OBJECT(tab_cont), "PidginConversation"); |
8150 } | 8150 } |
8151 | 8151 |
8152 | 8152 |
8153 GaimConversation * | 8153 PurpleConversation * |
8154 pidgin_conv_window_get_active_conversation(const PidginWindow *win) | 8154 pidgin_conv_window_get_active_conversation(const PidginWindow *win) |
8155 { | 8155 { |
8156 PidginConversation *gtkconv; | 8156 PidginConversation *gtkconv; |
8157 | 8157 |
8158 gtkconv = pidgin_conv_window_get_active_gtkconv(win); | 8158 gtkconv = pidgin_conv_window_get_active_gtkconv(win); |
8159 return gtkconv ? gtkconv->active_conv : NULL; | 8159 return gtkconv ? gtkconv->active_conv : NULL; |
8160 } | 8160 } |
8161 | 8161 |
8162 gboolean | 8162 gboolean |
8163 pidgin_conv_window_is_active_conversation(const GaimConversation *conv) | 8163 pidgin_conv_window_is_active_conversation(const PurpleConversation *conv) |
8164 { | 8164 { |
8165 return conv == pidgin_conv_window_get_active_conversation(PIDGIN_CONVERSATION(conv)->win); | 8165 return conv == pidgin_conv_window_get_active_conversation(PIDGIN_CONVERSATION(conv)->win); |
8166 } | 8166 } |
8167 | 8167 |
8168 gboolean | 8168 gboolean |
8208 { | 8208 { |
8209 return g_list_length(win->gtkconvs); | 8209 return g_list_length(win->gtkconvs); |
8210 } | 8210 } |
8211 | 8211 |
8212 PidginWindow * | 8212 PidginWindow * |
8213 pidgin_conv_window_first_with_type(GaimConversationType type) | 8213 pidgin_conv_window_first_with_type(PurpleConversationType type) |
8214 { | 8214 { |
8215 GList *wins, *convs; | 8215 GList *wins, *convs; |
8216 PidginWindow *win; | 8216 PidginWindow *win; |
8217 PidginConversation *conv; | 8217 PidginConversation *conv; |
8218 | 8218 |
8219 if (type == GAIM_CONV_TYPE_UNKNOWN) | 8219 if (type == PURPLE_CONV_TYPE_UNKNOWN) |
8220 return NULL; | 8220 return NULL; |
8221 | 8221 |
8222 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) { | 8222 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) { |
8223 win = wins->data; | 8223 win = wins->data; |
8224 | 8224 |
8226 convs != NULL; | 8226 convs != NULL; |
8227 convs = convs->next) { | 8227 convs = convs->next) { |
8228 | 8228 |
8229 conv = convs->data; | 8229 conv = convs->data; |
8230 | 8230 |
8231 if (gaim_conversation_get_type(conv->active_conv) == type) | 8231 if (purple_conversation_get_type(conv->active_conv) == type) |
8232 return win; | 8232 return win; |
8233 } | 8233 } |
8234 } | 8234 } |
8235 | 8235 |
8236 return NULL; | 8236 return NULL; |
8237 } | 8237 } |
8238 | 8238 |
8239 PidginWindow * | 8239 PidginWindow * |
8240 pidgin_conv_window_last_with_type(GaimConversationType type) | 8240 pidgin_conv_window_last_with_type(PurpleConversationType type) |
8241 { | 8241 { |
8242 GList *wins, *convs; | 8242 GList *wins, *convs; |
8243 PidginWindow *win; | 8243 PidginWindow *win; |
8244 PidginConversation *conv; | 8244 PidginConversation *conv; |
8245 | 8245 |
8246 if (type == GAIM_CONV_TYPE_UNKNOWN) | 8246 if (type == PURPLE_CONV_TYPE_UNKNOWN) |
8247 return NULL; | 8247 return NULL; |
8248 | 8248 |
8249 for (wins = g_list_last(pidgin_conv_windows_get_list()); | 8249 for (wins = g_list_last(pidgin_conv_windows_get_list()); |
8250 wins != NULL; | 8250 wins != NULL; |
8251 wins = wins->prev) { | 8251 wins = wins->prev) { |
8256 convs != NULL; | 8256 convs != NULL; |
8257 convs = convs->next) { | 8257 convs = convs->next) { |
8258 | 8258 |
8259 conv = convs->data; | 8259 conv = convs->data; |
8260 | 8260 |
8261 if (gaim_conversation_get_type(conv->active_conv) == type) | 8261 if (purple_conversation_get_type(conv->active_conv) == type) |
8262 return win; | 8262 return win; |
8263 } | 8263 } |
8264 } | 8264 } |
8265 | 8265 |
8266 return NULL; | 8266 return NULL; |
8304 static void | 8304 static void |
8305 conv_placement_last_created_win_type(PidginConversation *conv) | 8305 conv_placement_last_created_win_type(PidginConversation *conv) |
8306 { | 8306 { |
8307 PidginWindow *win; | 8307 PidginWindow *win; |
8308 | 8308 |
8309 win = pidgin_conv_window_last_with_type(gaim_conversation_get_type(conv->active_conv)); | 8309 win = pidgin_conv_window_last_with_type(purple_conversation_get_type(conv->active_conv)); |
8310 | 8310 |
8311 if (win == NULL) { | 8311 if (win == NULL) { |
8312 win = pidgin_conv_window_new(); | 8312 win = pidgin_conv_window_new(); |
8313 | 8313 |
8314 pidgin_conv_window_add_gtkconv(win, conv); | 8314 pidgin_conv_window_add_gtkconv(win, conv); |
8328 pidgin_conv_window_add_gtkconv(win, conv); | 8328 pidgin_conv_window_add_gtkconv(win, conv); |
8329 | 8329 |
8330 pidgin_conv_window_show(win); | 8330 pidgin_conv_window_show(win); |
8331 } | 8331 } |
8332 | 8332 |
8333 static GaimGroup * | 8333 static PurpleGroup * |
8334 conv_get_group(PidginConversation *conv) | 8334 conv_get_group(PidginConversation *conv) |
8335 { | 8335 { |
8336 GaimGroup *group = NULL; | 8336 PurpleGroup *group = NULL; |
8337 | 8337 |
8338 if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_IM) { | 8338 if (purple_conversation_get_type(conv->active_conv) == PURPLE_CONV_TYPE_IM) { |
8339 GaimBuddy *buddy; | 8339 PurpleBuddy *buddy; |
8340 | 8340 |
8341 buddy = gaim_find_buddy(gaim_conversation_get_account(conv->active_conv), | 8341 buddy = purple_find_buddy(purple_conversation_get_account(conv->active_conv), |
8342 gaim_conversation_get_name(conv->active_conv)); | 8342 purple_conversation_get_name(conv->active_conv)); |
8343 | 8343 |
8344 if (buddy != NULL) | 8344 if (buddy != NULL) |
8345 group = gaim_buddy_get_group(buddy); | 8345 group = purple_buddy_get_group(buddy); |
8346 | 8346 |
8347 } else if (gaim_conversation_get_type(conv->active_conv) == GAIM_CONV_TYPE_CHAT) { | 8347 } else if (purple_conversation_get_type(conv->active_conv) == PURPLE_CONV_TYPE_CHAT) { |
8348 GaimChat *chat; | 8348 PurpleChat *chat; |
8349 | 8349 |
8350 chat = gaim_blist_find_chat(gaim_conversation_get_account(conv->active_conv), | 8350 chat = purple_blist_find_chat(purple_conversation_get_account(conv->active_conv), |
8351 gaim_conversation_get_name(conv->active_conv)); | 8351 purple_conversation_get_name(conv->active_conv)); |
8352 | 8352 |
8353 if (chat != NULL) | 8353 if (chat != NULL) |
8354 group = gaim_chat_get_group(chat); | 8354 group = purple_chat_get_group(chat); |
8355 } | 8355 } |
8356 | 8356 |
8357 return group; | 8357 return group; |
8358 } | 8358 } |
8359 | 8359 |
8363 * open windows will get a new window. | 8363 * open windows will get a new window. |
8364 */ | 8364 */ |
8365 static void | 8365 static void |
8366 conv_placement_by_group(PidginConversation *conv) | 8366 conv_placement_by_group(PidginConversation *conv) |
8367 { | 8367 { |
8368 GaimConversationType type; | 8368 PurpleConversationType type; |
8369 GaimGroup *group = NULL; | 8369 PurpleGroup *group = NULL; |
8370 GList *wl, *cl; | 8370 GList *wl, *cl; |
8371 | 8371 |
8372 type = gaim_conversation_get_type(conv->active_conv); | 8372 type = purple_conversation_get_type(conv->active_conv); |
8373 | 8373 |
8374 group = conv_get_group(conv); | 8374 group = conv_get_group(conv); |
8375 | 8375 |
8376 /* Go through the list of IMs and find one with this group. */ | 8376 /* Go through the list of IMs and find one with this group. */ |
8377 for (wl = pidgin_conv_windows_get_list(); wl != NULL; wl = wl->next) { | 8377 for (wl = pidgin_conv_windows_get_list(); wl != NULL; wl = wl->next) { |
8378 PidginWindow *win2; | 8378 PidginWindow *win2; |
8379 PidginConversation *conv2; | 8379 PidginConversation *conv2; |
8380 GaimGroup *group2 = NULL; | 8380 PurpleGroup *group2 = NULL; |
8381 | 8381 |
8382 win2 = wl->data; | 8382 win2 = wl->data; |
8383 | 8383 |
8384 for (cl = win2->gtkconvs; | 8384 for (cl = win2->gtkconvs; |
8385 cl != NULL; | 8385 cl != NULL; |
8402 | 8402 |
8403 /* This groups things by account. Otherwise, the same semantics as above */ | 8403 /* This groups things by account. Otherwise, the same semantics as above */ |
8404 static void | 8404 static void |
8405 conv_placement_by_account(PidginConversation *conv) | 8405 conv_placement_by_account(PidginConversation *conv) |
8406 { | 8406 { |
8407 GaimConversationType type; | 8407 PurpleConversationType type; |
8408 GList *wins, *convs; | 8408 GList *wins, *convs; |
8409 GaimAccount *account; | 8409 PurpleAccount *account; |
8410 | 8410 |
8411 account = gaim_conversation_get_account(conv->active_conv); | 8411 account = purple_conversation_get_account(conv->active_conv); |
8412 type = gaim_conversation_get_type(conv->active_conv); | 8412 type = purple_conversation_get_type(conv->active_conv); |
8413 | 8413 |
8414 /* Go through the list of IMs and find one with this group. */ | 8414 /* Go through the list of IMs and find one with this group. */ |
8415 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) { | 8415 for (wins = pidgin_conv_windows_get_list(); wins != NULL; wins = wins->next) { |
8416 PidginWindow *win2; | 8416 PidginWindow *win2; |
8417 PidginConversation *conv2; | 8417 PidginConversation *conv2; |
8421 for (convs = win2->gtkconvs; | 8421 for (convs = win2->gtkconvs; |
8422 convs != NULL; | 8422 convs != NULL; |
8423 convs = convs->next) { | 8423 convs = convs->next) { |
8424 conv2 = convs->data; | 8424 conv2 = convs->data; |
8425 | 8425 |
8426 if (account == gaim_conversation_get_account(conv2->active_conv)) { | 8426 if (account == purple_conversation_get_account(conv2->active_conv)) { |
8427 pidgin_conv_window_add_gtkconv(win2, conv); | 8427 pidgin_conv_window_add_gtkconv(win2, conv); |
8428 return; | 8428 return; |
8429 } | 8429 } |
8430 } | 8430 } |
8431 } | 8431 } |
8561 pidgin_conv_placement_set_current_func(PidginConvPlacementFunc func) | 8561 pidgin_conv_placement_set_current_func(PidginConvPlacementFunc func) |
8562 { | 8562 { |
8563 g_return_if_fail(func != NULL); | 8563 g_return_if_fail(func != NULL); |
8564 | 8564 |
8565 /* If tabs are enabled, set the function, otherwise, NULL it out. */ | 8565 /* If tabs are enabled, set the function, otherwise, NULL it out. */ |
8566 if (gaim_prefs_get_bool("/gaim/gtk/conversations/tabs")) | 8566 if (purple_prefs_get_bool("/purple/gtk/conversations/tabs")) |
8567 place_conv = func; | 8567 place_conv = func; |
8568 else | 8568 else |
8569 place_conv = NULL; | 8569 place_conv = NULL; |
8570 } | 8570 } |
8571 | 8571 |
8680 } | 8680 } |
8681 } | 8681 } |
8682 | 8682 |
8683 if (i < numcolors) { | 8683 if (i < numcolors) { |
8684 GdkColor *c = colors; | 8684 GdkColor *c = colors; |
8685 gaim_debug_warning("gtkconv", "Unable to generate enough random colors before timeout. %u colors found.\n", i); | 8685 purple_debug_warning("gtkconv", "Unable to generate enough random colors before timeout. %u colors found.\n", i); |
8686 colors = g_memdup(c, i * sizeof(GdkColor)); | 8686 colors = g_memdup(c, i * sizeof(GdkColor)); |
8687 g_free(c); | 8687 g_free(c); |
8688 *color_count = i; | 8688 *color_count = i; |
8689 } | 8689 } |
8690 | 8690 |