| 3282 } |
3282 } |
| 3283 return ret; |
3283 return ret; |
| 3284 } |
3284 } |
| 3285 |
3285 |
| 3286 static void |
3286 static void |
| |
3287 regenerate_media_items(PidginWindow *win) |
| |
3288 { |
| |
3289 #ifdef USE_VV |
| |
3290 PurpleAccount *account; |
| |
3291 PurpleConversation *conv; |
| |
3292 |
| |
3293 conv = pidgin_conv_window_get_active_conversation(win); |
| |
3294 |
| |
3295 if (conv == NULL) { |
| |
3296 purple_debug_error("gtkconv", "couldn't get active conversation" |
| |
3297 " when regenerating media items\n"); |
| |
3298 return; |
| |
3299 } |
| |
3300 |
| |
3301 account = purple_conversation_get_account(conv); |
| |
3302 |
| |
3303 if (account == NULL) { |
| |
3304 purple_debug_error("gtkconv", "couldn't get account when" |
| |
3305 " regenerating media items\n"); |
| |
3306 return; |
| |
3307 } |
| |
3308 |
| |
3309 /* |
| |
3310 * Check if account support voice and/or calls, and |
| |
3311 * if the current buddy supports it. |
| |
3312 */ |
| |
3313 if (account != NULL && purple_conversation_get_type(conv) |
| |
3314 == PURPLE_CONV_TYPE_IM) { |
| |
3315 PurpleMediaCaps caps = |
| |
3316 purple_prpl_get_media_caps(account, |
| |
3317 purple_conversation_get_name(conv)); |
| |
3318 |
| |
3319 gtk_widget_set_sensitive(win->audio_call, |
| |
3320 caps & PURPLE_MEDIA_CAPS_AUDIO |
| |
3321 ? TRUE : FALSE); |
| |
3322 gtk_widget_set_sensitive(win->video_call, |
| |
3323 caps & PURPLE_MEDIA_CAPS_VIDEO |
| |
3324 ? TRUE : FALSE); |
| |
3325 gtk_widget_set_sensitive(win->audio_video_call, |
| |
3326 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO |
| |
3327 ? TRUE : FALSE); |
| |
3328 } else if (purple_conversation_get_type(conv) |
| |
3329 == PURPLE_CONV_TYPE_CHAT) { |
| |
3330 /* for now, don't care about chats... */ |
| |
3331 gtk_widget_set_sensitive(win->audio_call, FALSE); |
| |
3332 gtk_widget_set_sensitive(win->video_call, FALSE); |
| |
3333 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
| |
3334 } else { |
| |
3335 gtk_widget_set_sensitive(win->audio_call, FALSE); |
| |
3336 gtk_widget_set_sensitive(win->video_call, FALSE); |
| |
3337 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
| |
3338 } |
| |
3339 #endif |
| |
3340 } |
| |
3341 |
| |
3342 static void |
| 3287 regenerate_options_items(PidginWindow *win) |
3343 regenerate_options_items(PidginWindow *win) |
| 3288 { |
3344 { |
| 3289 GtkWidget *menu; |
3345 GtkWidget *menu; |
| 3290 PidginConversation *gtkconv; |
3346 PidginConversation *gtkconv; |
| 3291 GList *list; |
3347 GList *list; |
| 3366 } |
3422 } |
| 3367 |
3423 |
| 3368 static void menubar_activated(GtkWidget *item, gpointer data) |
3424 static void menubar_activated(GtkWidget *item, gpointer data) |
| 3369 { |
3425 { |
| 3370 PidginWindow *win = data; |
3426 PidginWindow *win = data; |
| |
3427 regenerate_media_items(win); |
| 3371 regenerate_options_items(win); |
3428 regenerate_options_items(win); |
| 3372 regenerate_plugins_items(win); |
3429 regenerate_plugins_items(win); |
| 3373 |
3430 |
| 3374 /* The following are to make sure the 'More' submenu is not regenerated every time |
3431 /* The following are to make sure the 'More' submenu is not regenerated every time |
| 3375 * the focus shifts from 'Conversations' to some other menu and back. */ |
3432 * the focus shifts from 'Conversations' to some other menu and back. */ |
| 4214 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
4271 if(current_topic && !g_utf8_collate(new_topic, current_topic)){ |
| 4215 g_free(new_topic); |
4272 g_free(new_topic); |
| 4216 return; |
4273 return; |
| 4217 } |
4274 } |
| 4218 |
4275 |
| 4219 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); |
4276 if (current_topic) |
| |
4277 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), current_topic); |
| |
4278 else |
| |
4279 gtk_entry_set_text(GTK_ENTRY(gtkchat->topic_text), ""); |
| |
4280 |
| 4220 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
4281 prpl_info->set_chat_topic(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(conv)), |
| 4221 new_topic); |
4282 new_topic); |
| 4222 |
4283 |
| 4223 g_free(new_topic); |
4284 g_free(new_topic); |
| 4224 } |
4285 } |
| 5246 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
5307 received_im_msg_cb(PurpleAccount *account, char *sender, char *message, |
| 5247 PurpleConversation *conv, PurpleMessageFlags flags) |
5308 PurpleConversation *conv, PurpleMessageFlags flags) |
| 5248 { |
5309 { |
| 5249 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
5310 PurpleConversationUiOps *ui_ops = pidgin_conversations_get_conv_ui_ops(); |
| 5250 gboolean hide = FALSE; |
5311 gboolean hide = FALSE; |
| |
5312 guint timer; |
| 5251 |
5313 |
| 5252 /* create hidden conv if hide_new pref is always */ |
5314 /* create hidden conv if hide_new pref is always */ |
| 5253 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
5315 if (strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/conversations/im/hide_new"), "always") == 0) |
| 5254 hide = TRUE; |
5316 hide = TRUE; |
| 5255 |
5317 |
| 5268 |
5330 |
| 5269 if (hide) { |
5331 if (hide) { |
| 5270 ui_ops->create_conversation = pidgin_conv_new_hidden; |
5332 ui_ops->create_conversation = pidgin_conv_new_hidden; |
| 5271 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
5333 purple_conversation_new(PURPLE_CONV_TYPE_IM, account, sender); |
| 5272 ui_ops->create_conversation = pidgin_conv_new; |
5334 ui_ops->create_conversation = pidgin_conv_new; |
| |
5335 } |
| |
5336 |
| |
5337 /* Somebody wants to keep this conversation around, so don't time it out */ |
| |
5338 timer = GPOINTER_TO_INT(purple_conversation_get_data(conv, "close-timer")); |
| |
5339 if (timer) { |
| |
5340 purple_timeout_remove(timer); |
| |
5341 purple_conversation_set_data(conv, "close-timer", GINT_TO_POINTER(0)); |
| 5273 } |
5342 } |
| 5274 } |
5343 } |
| 5275 |
5344 |
| 5276 static void |
5345 static void |
| 5277 pidgin_conv_destroy(PurpleConversation *conv) |
5346 pidgin_conv_destroy(PurpleConversation *conv) |
| 6119 |
6188 |
| 6120 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) |
6189 if (conv->features & PURPLE_CONNECTION_ALLOW_CUSTOM_SMILEY) |
| 6121 buttons |= GTK_IMHTML_CUSTOM_SMILEY; |
6190 buttons |= GTK_IMHTML_CUSTOM_SMILEY; |
| 6122 else |
6191 else |
| 6123 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; |
6192 buttons &= ~GTK_IMHTML_CUSTOM_SMILEY; |
| 6124 |
|
| 6125 #ifdef USE_VV |
|
| 6126 /* check if account support voice calls, and if the current buddy |
|
| 6127 supports it */ |
|
| 6128 if (account != NULL && purple_conversation_get_type(conv) |
|
| 6129 == PURPLE_CONV_TYPE_IM) { |
|
| 6130 PurpleMediaCaps caps = |
|
| 6131 purple_prpl_get_media_caps(account, |
|
| 6132 purple_conversation_get_name(conv)); |
|
| 6133 |
|
| 6134 gtk_widget_set_sensitive(win->audio_call, |
|
| 6135 caps & PURPLE_MEDIA_CAPS_AUDIO |
|
| 6136 ? TRUE : FALSE); |
|
| 6137 gtk_widget_set_sensitive(win->video_call, |
|
| 6138 caps & PURPLE_MEDIA_CAPS_VIDEO |
|
| 6139 ? TRUE : FALSE); |
|
| 6140 gtk_widget_set_sensitive(win->audio_video_call, |
|
| 6141 caps & PURPLE_MEDIA_CAPS_AUDIO_VIDEO |
|
| 6142 ? TRUE : FALSE); |
|
| 6143 } else if (purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) { |
|
| 6144 /* for now, don't care about chats... */ |
|
| 6145 gtk_widget_set_sensitive(win->audio_call, FALSE); |
|
| 6146 gtk_widget_set_sensitive(win->video_call, FALSE); |
|
| 6147 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
|
| 6148 } else { |
|
| 6149 gtk_widget_set_sensitive(win->audio_call, FALSE); |
|
| 6150 gtk_widget_set_sensitive(win->video_call, FALSE); |
|
| 6151 gtk_widget_set_sensitive(win->audio_video_call, FALSE); |
|
| 6152 } |
|
| 6153 #endif |
|
| 6154 |
6193 |
| 6155 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
6194 gtk_imhtml_set_format_functions(GTK_IMHTML(gtkconv->entry), buttons); |
| 6156 if (account != NULL) |
6195 if (account != NULL) |
| 6157 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
6196 gtk_imhtmltoolbar_associate_smileys(GTK_IMHTMLTOOLBAR(gtkconv->toolbar), purple_account_get_protocol_id(account)); |
| 6158 |
6197 |