/************************************************************************************************** Load plugin **************************************************************************************************/ static gboolean plugin_load(PurplePlugin *plugin) { PidginBuddyList *gtkblist = pidgin_blist_get_default_gtk_blist(); GList *convs = purple_get_conversations(); if (purple_prefs_get_bool("/plugins/core/hidemenu/default_state")) { hmb_is_menu_visible = FALSE; } else { hmb_is_menu_visible = TRUE; } // set callback for 'blist created' signal purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(hmb_blist_created_cb), NULL); // set callback for 'conversation displayed' signal purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", plugin, PURPLE_CALLBACK(hmb_conversation_displayed_cb), NULL); // hide blist menubar hmb_toggle_menubar(gtkblist, NULL); // hide conversations menubar while (convs) { PurpleConversation *conv = (PurpleConversation *)convs->data; if (PIDGIN_IS_PIDGIN_CONVERSATION(conv)) { hmb_toggle_menubar(NULL, PIDGIN_CONVERSATION(conv)); } convs = convs->next; } return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip", plugin, PURPLE_CALLBACK(append_to_tooltip), NULL); return TRUE; }
/* * EXPORTED FUNCTIONS */ static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(new_conversation_cb), NULL); /* Set callback to remove window from the list, if the window is destroyed */ purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(conversation_delete_cb), NULL); purple_signal_connect(pidgin_conversations_get_handle(), "conversation-dragging", plugin, PURPLE_CALLBACK(set_conv_window_trans), NULL); purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", plugin, PURPLE_CALLBACK(conv_updated_cb), NULL); update_existing_convs(); if (blist) blist_created_cb(NULL, NULL); else purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(blist_created_cb), NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin, GError **error) { void *accounts_handle = pidgin_accounts_get_handle(); void *blist_handle = pidgin_blist_get_handle(); void *conv_handle = pidgin_conversations_get_handle(); /* Accounts subsystem signals */ purple_signal_connect(accounts_handle, "account-modified", plugin, PURPLE_CALLBACK(account_modified_cb), NULL); /* Buddy List subsystem signals */ purple_signal_connect(blist_handle, "gtkblist-created", plugin, PURPLE_CALLBACK(blist_created_cb), NULL); purple_signal_connect(blist_handle, "drawing-tooltip", plugin, PURPLE_CALLBACK(blist_drawing_tooltip_cb), NULL); /* Conversations subsystem signals */ purple_signal_connect(conv_handle, "conversation-dragging", plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL); purple_signal_connect(conv_handle, "displaying-im-msg", plugin, PURPLE_CALLBACK(displaying_im_msg_cb), NULL); purple_signal_connect(conv_handle, "displayed-im-msg", plugin, PURPLE_CALLBACK(displayed_im_msg_cb), NULL); purple_signal_connect(conv_handle, "displaying-chat-msg", plugin, PURPLE_CALLBACK(displaying_chat_msg_cb), NULL); purple_signal_connect(conv_handle, "displayed-chat-msg", plugin, PURPLE_CALLBACK(displayed_chat_msg_cb), NULL); purple_signal_connect(conv_handle, "conversation-switched", plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL); return TRUE; }
static void add_plugin_functionality(PurplePlugin *plugin) { if(_signals_connected) return; purple_debug_info("cap", "Adding plugin functionality.\n"); /* Connect all the signals */ purple_signal_connect(purple_conversations_get_handle(), "sent-im-msg", plugin, PURPLE_CALLBACK(sent_im_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", plugin, PURPLE_CALLBACK(received_im_msg), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", plugin, PURPLE_CALLBACK(buddy_status_changed), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", plugin, PURPLE_CALLBACK(buddy_signed_on), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", plugin, PURPLE_CALLBACK(buddy_signed_off), NULL); purple_signal_connect(pidgin_blist_get_handle(), "drawing-tooltip", plugin, PURPLE_CALLBACK(drawing_tooltip), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(signed_on), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-off", plugin, PURPLE_CALLBACK(signed_off), NULL); _signals_connected = TRUE; }
/* calling when plugin load */ static gboolean plugin_load(PurplePlugin *plugin) { void *gtk_blist_handle = pidgin_blist_get_handle(); purple_signal_connect(gtk_blist_handle, "drawing-tooltip", plugin, PURPLE_CALLBACK(gtk_buddy_tooltip), NULL); return TRUE; }
/** * The plugin's load function * * @param[in] plugin Pointer to the plugin * @return Whether to continue loading **/ static gboolean plugin_load(PurplePlugin *plugin) { PidginBuddyList * gtkblist; /*< For determining if blist was initialized */ void *conv_handle; /*< The conversations handle */ void *gtkblist_handle; /*< The Pidgin Buddy List handle */ void *gtkconv_handle; /*< The Pidgin conversations handle */ /* XXX: There should be an interface to list available Buddy List * windows. */ gtkblist = pidgin_blist_get_default_gtk_blist(); conv_handle = purple_conversations_get_handle(); gtkblist_handle = pidgin_blist_get_handle(); gtkconv_handle = pidgin_conversations_get_handle(); /* Add the conversation placement option provided by this plugin. */ pidgin_conv_placement_add_fnc(PLUGIN_TOKEN, _(PWM_STR_CP_BLIST), &conv_placement_by_blist); purple_prefs_trigger_callback(PIDGIN_PREFS_ROOT "/conversations/placement"); /* Rebuild the layout when the preference changes. */ purple_prefs_connect_callback(plugin, PREF_SIDE, pref_convs_side_cb, NULL); /* Toggle the instruction panel as conversations come and go. */ purple_signal_connect(conv_handle, "conversation-created", plugin, PURPLE_CALLBACK(conversation_created_cb), NULL); purple_signal_connect(conv_handle, "deleting-conversation", plugin, PURPLE_CALLBACK(deleting_conversation_cb), NULL); purple_signal_connect(gtkconv_handle, "conversation-dragging", plugin, PURPLE_CALLBACK(conversation_dragging_cb), NULL); purple_signal_connect(gtkconv_handle, "conversation-hiding", plugin, PURPLE_CALLBACK(conversation_hiding_cb), NULL); purple_signal_connect(gtkconv_handle, "conversation-switched", plugin, PURPLE_CALLBACK(conversation_switched_cb), NULL); /* Hijack Buddy Lists as they are created. */ purple_signal_connect(gtkblist_handle, "gtkblist-created", plugin, PURPLE_CALLBACK(gtkblist_created_cb), NULL); /* If a default Buddy List is already available, use it immediately. */ if (gtkblist != NULL && gtkblist->window != NULL) pwm_merge_conversation(gtkblist); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin, GError **error) { purple_prefs_add_none("/plugins/gtk"); purple_prefs_add_none("/plugins/gtk/win32"); purple_prefs_add_none("/plugins/gtk/win32/winprefs"); purple_prefs_add_bool(PREF_DBLIST_DOCKABLE, FALSE); purple_prefs_add_bool(PREF_DBLIST_DOCKED, FALSE); purple_prefs_add_int(PREF_DBLIST_HEIGHT, 0); purple_prefs_add_int(PREF_DBLIST_SIDE, 0); /* Convert old preferences */ if(purple_prefs_exists(PREF_DBLIST_ON_TOP)) { gint blist_top = BLIST_TOP_NEVER; if(purple_prefs_get_bool(PREF_BLIST_ON_TOP)) blist_top = BLIST_TOP_ALWAYS; else if(purple_prefs_get_bool(PREF_DBLIST_ON_TOP)) blist_top = BLIST_TOP_DOCKED; purple_prefs_remove(PREF_BLIST_ON_TOP); purple_prefs_remove(PREF_DBLIST_ON_TOP); purple_prefs_add_int(PREF_BLIST_ON_TOP, blist_top); } else purple_prefs_add_int(PREF_BLIST_ON_TOP, BLIST_TOP_NEVER); purple_prefs_remove(PREF_CHAT_BLINK); handle = plugin; /* blist docking init */ if(purple_blist_get_buddy_list() && PIDGIN_BLIST(purple_blist_get_buddy_list()) && PIDGIN_BLIST(purple_blist_get_buddy_list())->window) { blist_create_cb(purple_blist_get_buddy_list(), NULL); } /* This really shouldn't happen anymore generally, but if for some strange reason, the blist is recreated, we need to set it up again. */ purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(blist_create_cb), NULL); purple_signal_connect((void*)purple_get_core(), "quitting", plugin, PURPLE_CALLBACK(purple_quit_cb), NULL); purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP, winprefs_set_blist_ontop, NULL); purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE, winprefs_set_blist_dockable, NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin, GError **error) { purple_prefs_add_none("/plugins/gtk/win32"); purple_prefs_add_none("/plugins/gtk/win32/wintrans"); purple_prefs_add_bool(OPT_WINTRANS_IM_ENABLED, FALSE); purple_prefs_add_int(OPT_WINTRANS_IM_ALPHA, 255); purple_prefs_add_bool(OPT_WINTRANS_IM_SLIDER, FALSE); purple_prefs_add_bool(OPT_WINTRANS_IM_ONFOCUS, FALSE); purple_prefs_add_bool(OPT_WINTRANS_IM_ONTOP, FALSE); purple_prefs_add_bool(OPT_WINTRANS_BL_ENABLED, FALSE); purple_prefs_add_int(OPT_WINTRANS_BL_ALPHA, 255); purple_prefs_add_bool(OPT_WINTRANS_BL_ONFOCUS, FALSE); purple_prefs_add_bool(OPT_WINTRANS_BL_ONTOP, FALSE); purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(new_conversation_cb), NULL); /* Set callback to remove window from the list, if the window is destroyed */ purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(conversation_delete_cb), NULL); purple_signal_connect(pidgin_conversations_get_handle(), "conversation-dragging", plugin, PURPLE_CALLBACK(set_conv_window_trans), NULL); purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", plugin, PURPLE_CALLBACK(conv_updated_cb), NULL); update_existing_convs(); if (blist) blist_created_cb(NULL, NULL); else purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(blist_created_cb), NULL); return TRUE; }
/* * EXPORTED FUNCTIONS */ static gboolean plugin_load(PurplePlugin *plugin) { MySetLayeredWindowAttributes = (void*) wpurple_find_and_loadproc( "user32.dll", "SetLayeredWindowAttributes"); if (!MySetLayeredWindowAttributes) { purple_debug_error(WINTRANS_PLUGIN_ID, "SetLayeredWindowAttributes API not found (Required W2K+)\n"); return FALSE; } purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(new_conversation_cb), NULL); /* Set callback to remove window from the list, if the window is destroyed */ purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(conversation_delete_cb), NULL); purple_signal_connect(pidgin_conversations_get_handle(), "conversation-dragging", plugin, PURPLE_CALLBACK(set_conv_window_trans), NULL); purple_signal_connect(purple_conversations_get_handle(), "conversation-updated", plugin, PURPLE_CALLBACK(conv_updated_cb), NULL); update_existing_convs(); if (blist) blist_created_cb(NULL, NULL); else purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(blist_created_cb), NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { /* connect construction signal only when needed as when installing the plugin after launching pidgin there is no need to wait for blist creation */ if(is_gtk_blist_created()) { /* create widget and load preferences */ create_widget(); init_widget(); } else /* connect construction signal */ purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(cb_blist_created), NULL); purple_debug_info(NAME,"plugin initialized...\n"); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { handle = plugin; /* blist docking init */ if(purple_get_blist() && PIDGIN_BLIST(purple_get_blist()) && PIDGIN_BLIST(purple_get_blist())->window) { blist_create_cb(purple_get_blist(), NULL); } /* This really shouldn't happen anymore generally, but if for some strange reason, the blist is recreated, we need to set it up again. */ purple_signal_connect(pidgin_blist_get_handle(), "gtkblist-created", plugin, PURPLE_CALLBACK(blist_create_cb), NULL); purple_signal_connect((void*)purple_get_core(), "quitting", plugin, PURPLE_CALLBACK(purple_quit_cb), NULL); purple_prefs_connect_callback(handle, PREF_BLIST_ON_TOP, winprefs_set_blist_ontop, NULL); purple_prefs_connect_callback(handle, PREF_DBLIST_DOCKABLE, winprefs_set_blist_dockable, NULL); return TRUE; }
static void remove_plugin_functionality(PurplePlugin *plugin) { if(!_signals_connected) return; purple_debug_info("cap", "Removing plugin functionality.\n"); /* If there are any timeouts waiting to be processed then cancel them */ g_hash_table_foreach(_buddy_stats, cancel_conversation_timeouts, NULL); /* Connect all the signals */ purple_signal_disconnect(purple_conversations_get_handle(), "sent-im-msg", plugin, PURPLE_CALLBACK(sent_im_msg)); purple_signal_disconnect(purple_conversations_get_handle(), "received-im-msg", plugin, PURPLE_CALLBACK(received_im_msg)); purple_signal_disconnect(purple_blist_get_handle(), "buddy-status-changed", plugin, PURPLE_CALLBACK(buddy_status_changed)); purple_signal_disconnect(purple_blist_get_handle(), "buddy-signed-on", plugin, PURPLE_CALLBACK(buddy_signed_on)); purple_signal_disconnect(purple_blist_get_handle(), "buddy-signed-off", plugin, PURPLE_CALLBACK(buddy_signed_off)); purple_signal_disconnect(pidgin_blist_get_handle(), "drawing-tooltip", plugin, PURPLE_CALLBACK(drawing_tooltip)); purple_signal_disconnect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(signed_on)); purple_signal_disconnect(purple_connections_get_handle(), "signed-off", plugin, PURPLE_CALLBACK(signed_off)); _signals_connected = FALSE; }