static void send_as_image (PidginWindow * win, PidginConversation * _gtkconv) { PurplePlugin *plugin = purple_plugins_find_with_id (PLUGIN_ID); if (PLUGIN (locked)) return; /* Just return, don't fail. */ else { PidginConversation *gtkconv; PLUGIN (locked) = TRUE; PLUGIN (send_as) = SEND_AS_IMAGE; if (win != NULL) gtkconv = PIDGIN_CONVERSATION (pidgin_conv_window_get_active_conversation (win)); else gtkconv = _gtkconv; REMEMBER_ACCOUNT (gtkconv); PLUGIN (conv_features) = gtkconv->active_conv->features; freeze_desktop (plugin, FALSE); } }
static void unnotify(PurpleConversation *conv, gboolean reset) { PurpleConversation *active_conv = NULL; PidginWindow *purplewin = NULL; g_return_if_fail(conv != NULL); if (PIDGIN_CONVERSATION(conv) == NULL) return; purplewin = PIDGIN_CONVERSATION(conv)->win; active_conv = pidgin_conv_window_get_active_conversation(purplewin); /* reset the conversation window title */ purple_conversation_autoset_title(active_conv); if (reset) { /* Only need to actually remove the urgent hinting here, since * removing it just to have it readded in re-notify is an * unnecessary couple extra RTs to the server */ handle_urgent(purplewin, FALSE); purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); /* Same logic as for the urgent hint, xprops are also a RT. * This needs to go here so that it gets the updated message * count. */ handle_count_xprop(purplewin); } return; }
static void send_as_link (PidginWindow * win, PidginConversation * _gtkconv) { PurplePlugin *plugin; plugin = purple_plugins_find_with_id (PLUGIN_ID); if (PLUGIN (locked)) return; /* Just return, don't fail. */ else { PidginConversation *gtkconv; PLUGIN (locked) = TRUE; PLUGIN (send_as) = SEND_AS_HTTP_LINK; if (win != NULL) gtkconv = PIDGIN_CONVERSATION (pidgin_conv_window_get_active_conversation (win)); else gtkconv = _gtkconv; if (!strcmp (purple_prefs_get_string (PREF_UPLOAD_TO), HOST_DISABLED)) { purple_notify_error (plugin, PLUGIN_NAME, PLUGIN_ERROR, PLUGIN_HOST_DISABLED_ERROR); plugin_stop (plugin); return; } REMEMBER_ACCOUNT (gtkconv); PLUGIN (conv_features) = gtkconv->active_conv->features; freeze_desktop (plugin, FALSE); } }
void attach_to_window(void) { GList *list; twitter_debug("called\n"); /* find twitter conv window out and attach to that */ for(list = pidgin_conv_windows_get_list(); list; list = list->next) { PidginWindow *win = list->data; PurpleConversation *conv = pidgin_conv_window_get_active_conversation(win); gint service = get_service_type(conv); /* only attach to twitter conversation window */ switch(service) { case twitter_service: case wassr_service: case identica_service: case jisko_service: case ffeed_service: attach_to_conv(conv, NULL); break; default: twitter_debug("unknown service\n"); break; } } }
static gboolean focus_removed(GtkWidget *widget, GdkEventVisibility *event, PidginWindow *win) { PurpleConversation *conv; PidginConversation *gtkconv; conv = pidgin_conv_window_get_active_conversation(win); g_return_val_if_fail(conv != NULL, FALSE); gtkconv = PIDGIN_CONVERSATION(conv); update_marker_for_gtkconv(gtkconv); return FALSE; }
static void conv_placement_by_number(PidginConversation *conv) { PidginWindow *win = NULL; GList *wins = NULL; if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate")) win = pidgin_conv_window_last_with_type(purple_conversation_get_type(conv->active_conv)); else if ((wins = pidgin_conv_windows_get_list()) != NULL) win = g_list_last(wins)->data; if (win == NULL) { win = pidgin_conv_window_new(); pidgin_conv_window_add_gtkconv(win, conv); pidgin_conv_window_show(win); } else { int max_count = purple_prefs_get_int("/plugins/gtk/extplacement/placement_number"); int count = pidgin_conv_window_get_gtkconv_count(win); if (count < max_count) pidgin_conv_window_add_gtkconv(win, conv); else { GList *l = NULL; for (l = pidgin_conv_windows_get_list(); l != NULL; l = l->next) { win = l->data; if (purple_prefs_get_bool("/plugins/gtk/extplacement/placement_number_separate") && purple_conversation_get_type(pidgin_conv_window_get_active_conversation(win)) != purple_conversation_get_type(conv->active_conv)) continue; count = pidgin_conv_window_get_gtkconv_count(win); if (count < max_count) { pidgin_conv_window_add_gtkconv(win, conv); return; } } win = pidgin_conv_window_new(); pidgin_conv_window_add_gtkconv(win, conv); pidgin_conv_window_show(win); } } }
/** * Handle hiding and showing stuff based on what type of conv this is... */ static void on_conversation_menu_show_cb (PidginWindow * win) { PurpleConversation *conv; GtkWidget *conversation_menu, *img_menuitem, *screenshot_menuitem; #ifdef ENABLE_UPLOAD GtkWidget *link_menuitem, *ftp_link_menuitem; #endif PurplePlugin *plugin = purple_plugins_find_with_id (PLUGIN_ID); conv = pidgin_conv_window_get_active_conversation (win); conversation_menu = gtk_item_factory_get_widget (win->menu.item_factory, N_("/Conversation")); #ifdef ENABLE_UPLOAD link_menuitem = g_object_get_data (G_OBJECT (conversation_menu), "link_menuitem"); ftp_link_menuitem = g_object_get_data (G_OBJECT (conversation_menu), "ftp_link_menuitem"); on_screenshot_insert_as_link_show_cb (link_menuitem, PIDGIN_CONVERSATION (conv)); on_screenshot_insert_as_ftp_link_show_cb (ftp_link_menuitem, PIDGIN_CONVERSATION (conv)); #endif img_menuitem = g_object_get_data (G_OBJECT (conversation_menu), "img_menuitem"); // on_screenshot_insert_as_image_show_cb (img_menuitem, // PIDGIN_CONVERSATION (conv)); screenshot_menuitem = g_object_get_data (G_OBJECT (conversation_menu), "screenshot_menuitem"); gtk_widget_set_sensitive (screenshot_menuitem, !PLUGIN (locked)); }
static gboolean catch_hotkeys_cb (PidginWindow * win, GdkEventKey * event) { if (event->is_modifier == FALSE) { gint all_modifiers = 0; PurpleConversation *conv = NULL; if (event->state & GDK_SHIFT_MASK) all_modifiers |= GDK_SHIFT_MASK; if (event->state & GDK_CONTROL_MASK) all_modifiers |= GDK_CONTROL_MASK; if (event->state & GDK_MOD1_MASK) all_modifiers |= GDK_MOD1_MASK; conv = pidgin_conv_window_get_active_conversation (win); if (gdk_keyval_to_lower (event->keyval) == (guint) purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_FILE) && all_modifiers == purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_FILE_MDFS)) { PurpleConnection *gc = NULL; PurplePluginProtocolInfo *prpl_info = NULL; gc = purple_conversation_get_gc (conv); if ((gc != NULL) && ((purple_conversation_get_type (conv) != PURPLE_CONV_TYPE_CHAT) || !purple_conv_chat_has_left (PURPLE_CONV_CHAT (conv)))) { prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO (gc->prpl); if (purple_conversation_get_type (conv) == PURPLE_CONV_TYPE_IM && prpl_info->send_file != NULL && (!prpl_info->can_receive_file || prpl_info->can_receive_file (gc, purple_conversation_get_name (conv)))) { PurplePlugin *plugin = purple_plugins_find_with_id (PLUGIN_ID); if (PLUGIN (locked)) return FALSE; /* Just return, don't fail. */ else { PLUGIN (locked) = TRUE; PLUGIN (send_as) = SEND_AS_FILE; REMEMBER_ACCOUNT (PIDGIN_CONVERSATION (conv)); freeze_desktop (plugin, FALSE); } } } } #ifdef ENABLE_UPLOAD else if (gdk_keyval_to_lower (event->keyval) == (guint) purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_FTP) && all_modifiers == purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_FTP_MDFS) ) send_as_ftp_link(win, NULL); //on_screenshot_insert_as_ftp_link_fromwin_activate_cb (win); else if (gdk_keyval_to_lower (event->keyval) == (guint) purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_HTTP) && all_modifiers == purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_HTTP_MDFS) ) send_as_link(win, NULL); //on_screenshot_insert_as_link_fromwin_activate_cb (win); #endif else if (gdk_keyval_to_lower (event->keyval) == (guint) purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_IMAGE) && all_modifiers == purple_prefs_get_int (PREF_HOTKEYS_SEND_AS_IMAGE_MDFS) ) { // if (!(purple_conversation_get_features (conv) & // PURPLE_CONNECTION_NO_IMAGES)) // on_screenshot_insert_as_image_fromwin_activate_cb (win); } else { /* nothing match ! */ } return TRUE; } return FALSE; /* let the signal be handled by other callbacks */ }
/** * A callback for when a conversation tab is being dragged out of its window * * The only purpose this serves is to treat dragging a conversation out of a * Buddy List as if it was being deleted, in terms of when to create a dummy * conversation tab. * * @param[in] src The window from which a conversation is being dragged * @param[in] dst The window where a conversation is being dropped **/ static void conversation_dragging_cb(PidginWindow *src, PidginWindow *dst) { if (src != dst && pwm_convs_get_blist(src) != NULL) deleting_conversation_cb( pidgin_conv_window_get_active_conversation(src)); }