static gboolean plugin_load(PurplePlugin *plugin, GError **error) { purple_prefs_add_none("/plugins"); purple_prefs_add_none("/plugins/gnt"); purple_prefs_add_none("/plugins/gnt/gntgf"); purple_prefs_add_none(PREFS_EVENT); purple_prefs_add_bool(PREFS_EVENT_SIGNONF, TRUE); purple_prefs_add_bool(PREFS_EVENT_IM_MSG, TRUE); purple_prefs_add_bool(PREFS_EVENT_CHAT_MSG, TRUE); purple_prefs_add_bool(PREFS_EVENT_CHAT_NICK, TRUE); purple_prefs_add_bool(PREFS_BEEP, TRUE); #ifdef HAVE_X11 purple_prefs_add_bool(PREFS_URGENT, FALSE); #endif 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(purple_conversations_get_handle(), "received-im-msg", plugin, PURPLE_CALLBACK(received_im_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", plugin, PURPLE_CALLBACK(received_chat_msg), NULL); memset(&gpsy, 0, sizeof(gpsy)); memset(&gpsw, 0, sizeof(gpsw)); 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; }
void IMInvoker::setupPurpleSignals() { int handle; // connection signals purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, PURPLE_CALLBACK(signedOnCB), NULL); // conversation signals purple_signal_connect(purple_conversations_get_handle(), "conversation-created", &handle, PURPLE_CALLBACK(conversationCreatedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "chat-joined", &handle, PURPLE_CALLBACK(chatJoinedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "chat-join-failed", &handle, PURPLE_CALLBACK(chatJoinFailedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", &handle, PURPLE_CALLBACK(buddyTypingCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typed", &handle, PURPLE_CALLBACK(buddyTypedCB), NULL); purple_signal_connect(purple_conversations_get_handle(), "buddy-typing-stopped", &handle, PURPLE_CALLBACK(buddyTypingStoppedCB), NULL); // buddy signals purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNON)); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNOFF)); purple_signal_connect(purple_blist_get_handle(), "buddy-got-login-time", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_SIGNON_TIME)); purple_signal_connect(purple_blist_get_handle(), "buddy-idle-changed", &handle, PURPLE_CALLBACK(buddyIdleChangedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-status-changed", &handle, PURPLE_CALLBACK(buddyStatusChangedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-icon-changed", &handle, PURPLE_CALLBACK(buddyEventCB), GINT_TO_POINTER(PURPLE_BUDDY_ICON)); purple_signal_connect(purple_blist_get_handle(), "buddy-added", &handle, PURPLE_CALLBACK(buddyAddedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-removed", &handle, PURPLE_CALLBACK(buddyRemovedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "blist-node-aliased", &handle, PURPLE_CALLBACK(blistNodeAliasedCB), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-caps-changed", &handle, PURPLE_CALLBACK(buddyCapsChangedCB), NULL); // xfer signals purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", &handle, PURPLE_CALLBACK(fileRecvRequestCB), NULL); }
static void connect_to_signals_for_demonstration_purposes_only(void) { static int handle; purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", &handle, PURPLE_CALLBACK(buddy_presence), NULL); purple_signal_connect(purple_blist_get_handle(), "buddy-signed-off", &handle, PURPLE_CALLBACK(buddy_presence), NULL); }
static void waprpl_login(PurpleAccount * acct) { PurpleConnection *gc = purple_account_get_connection(acct); purple_debug_info(WHATSAPP_ID, "logging in %s\n", purple_account_get_username(acct)); purple_connection_update_progress(gc, "Connecting", 0, 4); whatsapp_connection *wconn = g_new0(whatsapp_connection, 1); wconn->fd = -1; wconn->sslfd = -1; wconn->account = acct; wconn->rh = 0; wconn->wh = 0; wconn->timer = 0; wconn->connected = 0; wconn->conv_id = 1; wconn->gsc = 0; wconn->sslrh = 0; wconn->sslwh = 0; const char *username = purple_account_get_username(acct); const char *password = purple_account_get_password(acct); const char *nickname = purple_account_get_string(acct, "nick", ""); wconn->waAPI = waAPI_create(username, password, nickname); purple_connection_set_protocol_data(gc, wconn); const char *hostname = purple_account_get_string(acct, "server", ""); int port = purple_account_get_int(acct, "port", WHATSAPP_DEFAULT_PORT); char hn[256]; if (strlen(hostname) == 0) { sprintf(hn, "e%d.whatsapp.net", rand() % 9 + 1); hostname = hn; } if (purple_proxy_connect(gc, acct, hostname, port, waprpl_connect_cb, gc) == NULL) { purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, "Unable to connect"); } static int sig_con = 0; if (!sig_con) { sig_con = 1; purple_signal_connect(purple_blist_get_handle(), "blist-node-removed", _whatsapp_protocol, PURPLE_CALLBACK(waprpl_blist_node_removed), NULL); purple_signal_connect(purple_blist_get_handle(), "blist-node-added", _whatsapp_protocol, PURPLE_CALLBACK(waprpl_blist_node_added), NULL); } }
static gboolean plugin_load(PurplePlugin *plugin) { FILE *which_pf; char line[1024]; which_pf= popen("which festival 2>/dev/null","r"); fscanf(which_pf,"%1023s",line); pclose(which_pf); if( *line != '/') return FALSE; char proc[1024]; sprintf(proc, "%s %s", snd((char *)purple_prefs_get_string("/pidgin/sound/method")), line); purple_debug(PURPLE_DEBUG_INFO, "pidgin festival", proc); int errno=0; festival_pf= popen(proc,"w"); if(errno) { pclose(festival_pf); return FALSE; } load_conf(); void *conv_handle = purple_conversations_get_handle(); void *blist_handle = purple_blist_get_handle(); void *accounts_handle = purple_accounts_get_handle(); purple_signal_connect(conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(im_recv_im), NULL); purple_signal_connect(conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(im_recv_im), NULL); purple_signal_connect(conv_handle, "conversation-created", plugin, PURPLE_CALLBACK(chat_created), NULL); purple_signal_connect(blist_handle, "buddy-signed-on", plugin, PURPLE_CALLBACK(buddy_signed_on_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-off", plugin, PURPLE_CALLBACK(buddy_signed_off_cb), NULL); purple_signal_connect(conv_handle, "chat-buddy-joined", plugin, PURPLE_CALLBACK(chat_buddy_joined_cb), NULL); purple_signal_connect(conv_handle, "chat-buddy-left", plugin, PURPLE_CALLBACK(chat_buddy_left_cb), NULL); /* Buddy List subsystem signals */ purple_signal_connect(blist_handle, "buddy-away", plugin, PURPLE_CALLBACK(buddy_away_cb), NULL); purple_signal_connect(blist_handle, "buddy-back", plugin, PURPLE_CALLBACK(buddy_back_cb), NULL); purple_signal_connect(blist_handle, "buddy-idle", plugin, PURPLE_CALLBACK(buddy_idle_cb), NULL); purple_signal_connect(blist_handle, "buddy-unidle", plugin, PURPLE_CALLBACK(buddy_unidle_cb), NULL); purple_signal_connect(accounts_handle, "account-connecting", plugin, PURPLE_CALLBACK(account_connecting_cb), NULL); return TRUE; }
void init_buddy_icon_changed_event() { void *handle = purple_wg_get_handle(); purple_signal_connect(purple_blist_get_handle(), "buddy-icon-changed", handle, PURPLE_CALLBACK(update_buddy_icon), NULL); }
void purple_prpl_got_user_login_time(PurpleAccount *account, const char *name, time_t login_time) { GSList *list; PurplePresence *presence; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); if ((list = purple_find_buddies(account, name)) == NULL) return; if (login_time == 0) login_time = time(NULL); while (list) { PurpleBuddy *buddy = list->data; presence = purple_buddy_get_presence(buddy); list = g_slist_delete_link(list, list); if (purple_presence_get_login_time(presence) != login_time) { purple_presence_set_login_time(presence, login_time); purple_signal_emit(purple_blist_get_handle(), "buddy-got-login-time", buddy); } } }
void purple_prpl_got_media_caps(PurpleAccount *account, const char *name) { #ifdef USE_VV GSList *list; g_return_if_fail(account != NULL); g_return_if_fail(name != NULL); if ((list = purple_find_buddies(account, name)) == NULL) return; while (list) { PurpleBuddy *buddy = list->data; PurpleMediaCaps oldcaps = purple_buddy_get_media_caps(buddy); PurpleMediaCaps newcaps = 0; const gchar *bname = purple_buddy_get_name(buddy); list = g_slist_delete_link(list, list); newcaps = purple_prpl_get_media_caps(account, bname); purple_buddy_set_media_caps(buddy, newcaps); if (oldcaps == newcaps) continue; purple_signal_emit(purple_blist_get_handle(), "buddy-caps-changed", buddy, newcaps, oldcaps); } #endif }
static gboolean plugin_unload (PurplePlugin *plugin) { void *conv_handle, *blist_handle, *conn_handle; conv_handle = purple_conversations_get_handle (); blist_handle = purple_blist_get_handle (); conn_handle = purple_connections_get_handle(); purple_signal_disconnect (blist_handle, "buddy-signed-on", plugin, PURPLE_CALLBACK(notify_buddy_signon_cb)); purple_signal_disconnect (blist_handle, "buddy-signed-off", plugin, PURPLE_CALLBACK(notify_buddy_signoff_cb)); purple_signal_disconnect (conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(notify_new_message_cb)); purple_signal_disconnect (conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(notify_chat_nick)); purple_signal_disconnect (conv_handle, "deleting-conversation", plugin, PURPLE_CALLBACK(notify_deleting_conversation_cb)); purple_signal_disconnect (conn_handle, "signed-on", plugin, PURPLE_CALLBACK(event_connection_throttle)); g_hash_table_destroy (buddy_hash); notify_uninit (); return TRUE; }
void purple_pounces_init(void) { void *handle = purple_pounces_get_handle(); void *blist_handle = purple_blist_get_handle(); void *conv_handle = purple_conversations_get_handle(); pounce_handlers = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, free_pounce_handler); purple_signal_connect(blist_handle, "buddy-idle-changed", handle, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); purple_signal_connect(blist_handle, "buddy-status-changed", handle, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-on", handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_POUNCE_SIGNON)); purple_signal_connect(blist_handle, "buddy-signed-off", handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_POUNCE_SIGNOFF)); purple_signal_connect(conv_handle, "buddy-typing", handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); purple_signal_connect(conv_handle, "buddy-typed", handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); purple_signal_connect(conv_handle, "buddy-typing-stopped", handle, PURPLE_CALLBACK(buddy_typing_cb), NULL); purple_signal_connect(conv_handle, "received-im-msg", handle, PURPLE_CALLBACK(received_message_cb), NULL); purple_pounces_load(); }
static gboolean plugin_unload(PurplePlugin *plugin) { purple_signal_disconnect(purple_conversations_get_handle(), "receiving-im-msg", plugin, PURPLE_CALLBACK(translate_receiving_im_msg)); purple_signal_disconnect(purple_conversations_get_handle(), "sending-im-msg", plugin, PURPLE_CALLBACK(translate_sending_im_msg)); purple_signal_disconnect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, PURPLE_CALLBACK(translate_blist_extended_menu)); purple_signal_disconnect(purple_conversations_get_handle(), "blist-node-extended-menu", plugin, PURPLE_CALLBACK(translate_conv_extended_menu)); purple_signal_disconnect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(translate_conversation_created)); purple_signal_disconnect(purple_conversations_get_handle(), "receiving-chat-msg", plugin, PURPLE_CALLBACK(translate_receiving_chat_msg)); purple_signal_disconnect(purple_conversations_get_handle(), "sending-chat-msg", plugin, PURPLE_CALLBACK(translate_sending_chat_msg)); return TRUE; }
static gboolean plugin_load (PurplePlugin * plugin) { purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, PURPLE_CALLBACK(extended_menu_cb), NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { 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(purple_conversations_get_handle(), "received-im-msg", plugin, PURPLE_CALLBACK(received_im_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "received-chat-msg", plugin, PURPLE_CALLBACK(received_chat_msg), NULL); memset(&gpsy, 0, sizeof(gpsy)); memset(&gpsw, 0, sizeof(gpsw)); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, PURPLE_CALLBACK(file_recv_request_cb), plugin); purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, PURPLE_CALLBACK(context_menu), plugin); return TRUE; }
void set_blist_node_aliased(PurplePlugin *plugin, PyObject *func) { static PyObject *blist_node_aliased_cb = 0; Py_XINCREF(func); Py_XDECREF(blist_node_aliased_cb); blist_node_aliased_cb = func; purple_signal_connect(purple_blist_get_handle(), "blist-node-aliased", plugin, PURPLE_CALLBACK(blist_node_aliased), blist_node_aliased_cb); }
void set_buddy_added(PurplePlugin *plugin, PyObject *func) { static PyObject *buddy_added_cb = 0; Py_XINCREF(func); Py_XDECREF(buddy_added_cb); buddy_added_cb = func; purple_signal_connect(purple_blist_get_handle(), "buddy-added", plugin, PURPLE_CALLBACK(buddy_added), buddy_added_cb); }
GList * purple_blist_node_get_extended_menu(PurpleBlistNode *n) { GList *menu = NULL; g_return_val_if_fail(n != NULL, NULL); purple_signal_emit(purple_blist_get_handle(), "blist-node-extended-menu", n, &menu); return menu; }
static gboolean plugin_load(PurplePlugin *plugin) { void *blist_handle = purple_blist_get_handle(); purple_signal_connect(blist_handle, "buddy-status-changed", plugin, PURPLE_CALLBACK(buddy_status_changed_cb), NULL); purple_signal_connect(blist_handle, "buddy-idle-changed", plugin, PURPLE_CALLBACK(buddy_idle_changed_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-on", plugin, PURPLE_CALLBACK(buddy_signon_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-off", plugin, PURPLE_CALLBACK(buddy_signoff_cb), 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; }
static gboolean plugin_load(PurplePlugin *plugin) { /* this is for doing something fun when we sign on */ purple_signal_connect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(echo_hi), NULL); /* this is for doing something fun when we get a message */ purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg", plugin, PURPLE_CALLBACK(reverse), NULL); /* this is for doing something fun when a buddy comes online */ purple_signal_connect(purple_blist_get_handle(), "buddy-signed-on", plugin, PURPLE_CALLBACK(bud), NULL); return TRUE; }
gboolean purple_privacy_permit_remove(PurpleAccount *account, const char *who, gboolean local_only) { GSList *l; const char *name; PurpleBuddy *buddy; char *del; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); name = purple_normalize(account, who); for (l = account->permit; l != NULL; l = l->next) { if (!purple_utf8_strcasecmp(name, (char *)l->data)) break; } if (l == NULL) return FALSE; /* We should not free l->data just yet. There can be occasions where * l->data == who. In such cases, freeing l->data here can cause crashes * later when who is used. */ del = l->data; account->permit = g_slist_delete_link(account->permit, l); if (!local_only && purple_account_is_connected(account)) serv_rem_permit(purple_account_get_connection(account), who); if (privacy_ops != NULL && privacy_ops->permit_removed != NULL) privacy_ops->permit_removed(account, who); purple_blist_schedule_save(); buddy = purple_find_buddy(account, name); if (buddy != NULL) { purple_signal_emit(purple_blist_get_handle(), "buddy-privacy-changed", buddy); } g_free(del); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { void *blist_handle = purple_blist_get_handle(); purple_signal_connect(purple_connections_get_handle(), "signed-off", plugin, PURPLE_CALLBACK(signoff_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-on", plugin, PURPLE_CALLBACK(buddy_signon_cb), NULL); purple_signal_connect(blist_handle, "buddy-signed-off", plugin, PURPLE_CALLBACK(buddy_signoff_cb), NULL); purple_signal_connect(blist_handle, "buddy-status-changed", plugin, PURPLE_CALLBACK(status_changed_cb), NULL); if (purple_connections_get_all()) buddy_ticker_show(); return TRUE; }
gboolean purple_privacy_deny_remove(PurpleAccount *account, const char *who, gboolean local_only) { GSList *l; const char *normalized; char *name; PurpleBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); normalized = purple_normalize(account, who); for (l = account->deny; l != NULL; l = l->next) { if (!purple_utf8_strcasecmp(normalized, (char *)l->data)) break; } buddy = purple_find_buddy(account, normalized); if (l == NULL) return FALSE; name = l->data; account->deny = g_slist_delete_link(account->deny, l); if (!local_only && purple_account_is_connected(account)) serv_rem_deny(purple_account_get_connection(account), name); if (privacy_ops != NULL && privacy_ops->deny_removed != NULL) privacy_ops->deny_removed(account, who); if (buddy != NULL) { purple_signal_emit(purple_blist_get_handle(), "buddy-privacy-changed", buddy); } g_free(name); purple_blist_schedule_save(); return TRUE; }
gboolean purple_privacy_permit_add(PurpleAccount *account, const char *who, gboolean local_only) { GSList *l; char *name; PurpleBuddy *buddy; g_return_val_if_fail(account != NULL, FALSE); g_return_val_if_fail(who != NULL, FALSE); name = g_strdup(purple_normalize(account, who)); for (l = account->permit; l != NULL; l = l->next) { if (!purple_utf8_strcasecmp(name, (char *)l->data)) break; } if (l != NULL) { g_free(name); return FALSE; } account->permit = g_slist_append(account->permit, name); if (!local_only && purple_account_is_connected(account)) serv_add_permit(purple_account_get_connection(account), who); if (privacy_ops != NULL && privacy_ops->permit_added != NULL) privacy_ops->permit_added(account, who); purple_blist_schedule_save(); /* This lets the UI know a buddy has had its privacy setting changed */ buddy = purple_find_buddy(account, name); if (buddy != NULL) { purple_signal_emit(purple_blist_get_handle(), "buddy-privacy-changed", buddy); } return TRUE; }
static gboolean plugin_load (PurplePlugin *plugin) { void *conv_handle, *blist_handle, *conn_handle; construct_list(); if (!notify_is_initted () && !notify_init ("Pidgin")) { purple_debug_error (PLUGIN_ID, "libnotify not running!\n"); return FALSE; } conv_handle = purple_conversations_get_handle (); blist_handle = purple_blist_get_handle (); conn_handle = purple_connections_get_handle(); buddy_hash = g_hash_table_new (NULL, NULL); purple_signal_connect (blist_handle, "buddy-signed-on", plugin, PURPLE_CALLBACK(notify_buddy_signon_cb), NULL); purple_signal_connect (blist_handle, "buddy-signed-off", plugin, PURPLE_CALLBACK(notify_buddy_signoff_cb), NULL); purple_signal_connect (conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(notify_new_message_cb), NULL); purple_signal_connect (conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(notify_chat_nick), NULL); purple_signal_connect (conv_handle, "deleting-conversation", plugin, PURPLE_CALLBACK(notify_deleting_conversation_cb), NULL); purple_prefs_connect_callback(plugin, "/plugins/gtk/libnotify/triggerMessages", (PurplePrefCallback)construct_list, NULL); /* used just to not display the flood of guifications we'd get */ purple_signal_connect (conn_handle, "signed-on", plugin, PURPLE_CALLBACK(event_connection_throttle), NULL); return TRUE; }
void PurpleLine::disconnect_signals() { purple_signal_disconnect( purple_blist_get_handle(), "blist-node-removed", (void *)this, PURPLE_CALLBACK(WRAPPER_TYPE(PurpleLine::signal_blist_node_removed, signal))); purple_signal_disconnect( purple_conversations_get_handle(), "conversation-created", (void *)this, PURPLE_CALLBACK(WRAPPER_TYPE(PurpleLine::signal_conversation_created, signal))); purple_signal_disconnect( purple_conversations_get_handle(), "deleting-conversation", (void *)this, PURPLE_CALLBACK(WRAPPER_TYPE(PurpleLine::signal_deleting_conversation, signal))); }
// // Called when the plugin is unloaded // static gboolean budicons_plugin_unload (PurplePlugin *purple) { BudiconsPlugin *plugin = (BudiconsPlugin *) purple->extra; purple->extra = NULL; if (plugin) { purple_signal_disconnect( purple_blist_get_handle(), "buddy-added", plugin->purple, PURPLE_CALLBACK(budicons_buddy_added_callback) ); if (plugin->session) g_object_unref(plugin->session); if (plugin->buddies) g_slist_free(plugin->buddies); if (plugin->users) g_hash_table_destroy(plugin->users); g_free(plugin); } return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { /* migrate the old pref (we should only care if the plugin is actually *used*) */ /* * TODO: We should eventually call purple_prefs_remove(PREFS_STRANGER_OLD) * to clean up after ourselves, but we don't want to do it yet * so that we don't break users who share a .purple directory * between old libpurple clients and new libpurple clients. * --Mark Doliner, 2011-01-03 */ if (!purple_prefs_exists(PREF_STRANGER)) { if (purple_prefs_get_bool(PREF_STRANGER_OLD)) purple_prefs_add_int(PREF_STRANGER, FT_REJECT); else purple_prefs_set_int(PREF_STRANGER, FT_ASK); } purple_signal_connect(purple_xfers_get_handle(), "file-recv-request", plugin, PURPLE_CALLBACK(file_recv_request_cb), plugin); purple_signal_connect(purple_blist_get_handle(), "blist-node-extended-menu", plugin, PURPLE_CALLBACK(context_menu), plugin); return TRUE; }
static void finch_sound_init(void) { void *gnt_sound_handle = finch_sound_get_handle(); void *blist_handle = purple_blist_get_handle(); void *conv_handle = purple_conversations_get_handle(); #ifdef USE_GSTREAMER GError *error = NULL; #endif purple_signal_connect(purple_connections_get_handle(), "signed-on", gnt_sound_handle, PURPLE_CALLBACK(account_signon_cb), NULL); purple_prefs_add_none(FINCH_PREFS_ROOT "/sound"); purple_prefs_add_string(FINCH_PREFS_ROOT "/sound/actprofile", DEFAULT_PROFILE); purple_prefs_add_none(FINCH_PREFS_ROOT "/sound/profiles"); purple_prefs_connect_callback(gnt_sound_handle, FINCH_PREFS_ROOT "/sound/actprofile", initialize_profile, NULL); purple_prefs_trigger_callback(FINCH_PREFS_ROOT "/sound/actprofile"); #ifdef USE_GSTREAMER purple_debug_info("sound", "Initializing sound output drivers.\n"); #if (GST_VERSION_MAJOR > 0 || \ (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR > 10) || \ (GST_VERSION_MAJOR == 0 && GST_VERSION_MINOR == 10 && GST_VERSION_MICRO >= 10)) gst_registry_fork_set_enabled(FALSE); #endif if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { purple_notify_error(NULL, _("GStreamer Failure"), _("GStreamer failed to initialize."), error ? error->message : ""); if (error) { g_error_free(error); error = NULL; } } #endif /* USE_GSTREAMER */ purple_signal_connect(blist_handle, "buddy-signed-on", gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE)); purple_signal_connect(blist_handle, "buddy-signed-off", gnt_sound_handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE)); purple_signal_connect(conv_handle, "received-im-msg", gnt_sound_handle, PURPLE_CALLBACK(im_msg_received_cb), GINT_TO_POINTER(PURPLE_SOUND_RECEIVE)); purple_signal_connect(conv_handle, "sent-im-msg", gnt_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb), GINT_TO_POINTER(PURPLE_SOUND_SEND)); purple_signal_connect(conv_handle, "chat-buddy-joined", gnt_sound_handle, PURPLE_CALLBACK(chat_buddy_join_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN)); purple_signal_connect(conv_handle, "chat-buddy-left", gnt_sound_handle, PURPLE_CALLBACK(chat_buddy_left_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE)); purple_signal_connect(conv_handle, "sent-chat-msg", gnt_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY)); purple_signal_connect(conv_handle, "received-chat-msg", gnt_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY)); purple_signal_connect(conv_handle, "got-attention", gnt_sound_handle, PURPLE_CALLBACK(got_attention_cb), GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION)); update_profiles(); }