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 finch_pounces_init(void) { purple_pounces_register_handler(FINCH_UI, pounce_cb, new_pounce, free_pounce); purple_prefs_add_none("/finch/pounces"); purple_prefs_add_none("/finch/pounces/default_actions"); purple_prefs_add_bool("/finch/pounces/default_actions/open-window", FALSE); purple_prefs_add_bool("/finch/pounces/default_actions/popup-notify", TRUE); purple_prefs_add_bool("/finch/pounces/default_actions/send-message", FALSE); purple_prefs_add_bool("/finch/pounces/default_actions/execute-command", FALSE); purple_prefs_add_bool("/finch/pounces/default_actions/play-beep", FALSE); purple_prefs_add_none("/finch/pounces/dialog"); purple_signal_connect(purple_connections_get_handle(), "signed-on", finch_pounces_get_handle(), PURPLE_CALLBACK(signed_on_off_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-off", finch_pounces_get_handle(), PURPLE_CALLBACK(signed_on_off_cb), NULL); }
static void connect_to_signals(void) { static int handle; purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, PURPLE_CALLBACK(signed_on), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-off", &handle, PURPLE_CALLBACK(signed_off), NULL); }
void purple_idle_init() { purple_signal_connect(purple_connections_get_handle(), "signing-on", purple_idle_get_handle(), PURPLE_CALLBACK(signing_on_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signing-off", purple_idle_get_handle(), PURPLE_CALLBACK(signing_off_cb), NULL); }
static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(online), NULL); purple_signal_connect(purple_connections_get_handle(), "signing-off", plugin, PURPLE_CALLBACK(signoff), NULL); purple_signal_connect(purple_accounts_get_handle(), "account-status-changed", plugin, PURPLE_CALLBACK(status_changed), NULL); under_recursion = TRUE; return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { PurpleBuddyList *buddy_list; void *conv_handle; if (cc_init_gtk_gl()) return FALSE; cc_init(&cc_info); buddy_list = purple_get_blist(); if (buddy_list) { purple_signal_connect(PIDGIN_BLIST (buddy_list), "drawing-menu", plugin, PURPLE_CALLBACK(cc_buddy_menu), NULL); conv_handle = purple_conversations_get_handle(); purple_signal_connect(conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(receive_im_cb), &cc_info); purple_signal_connect(conv_handle, "displaying-im-msg", plugin, PURPLE_CALLBACK(display_im_cb), &cc_info); } else { purple_signal_connect (purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(cc_signed_on), plugin); } Debug("CrazyChat plugin loaded.\n"); return 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 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; }
static VALUE watch_signed_off_event(VALUE self) { set_callback(&signed_off_handler, "signed_off_handler"); int handle; purple_signal_connect(purple_connections_get_handle(), "signed-off", &handle, PURPLE_CALLBACK(signed_off), NULL); return signed_off_handler; }
static gboolean plugin_load(PurplePlugin *plugin) { PurplePlugin *prpl = NULL; PurpleAccountOption *option; void *gc_handle = NULL; #if !PURPLE_VERSION_CHECK(2,4,0) gchar *notice_help = NULL; #endif prpl = purple_find_prpl("prpl-irc"); /* if we didn't find the prpl, bail */ if (!prpl) return FALSE; #if !PURPLE_VERSION_CHECK(2,4,0) /* specify our help string and register our command */ notice_help = _("notice target message: Send a notice to the specified target."); notice_cmd_id = purple_cmd_register("notice", "ws", PURPLE_CMD_P_PLUGIN, PURPLE_CMD_FLAG_IM | PURPLE_CMD_FLAG_CHAT | PURPLE_CMD_FLAG_PRPL_ONLY, "prpl-irc", notice_cmd_cb, notice_help, NULL); #endif /* we need this handle for the signed-on signal */ gc_handle = purple_connections_get_handle(); /* list signals in alphabetical order for consistency */ purple_signal_connect(prpl, "irc-sending-text", plugin, G_CALLBACK(irc_sending_text), NULL); purple_signal_connect(prpl, "irc-receiving-text", plugin, G_CALLBACK(irc_receiving_text), NULL); purple_signal_connect(gc_handle, "signed-on", plugin, G_CALLBACK(signed_on_cb), NULL); irc_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); /* Alphabetize the option label strings */ option = purple_account_option_string_new(_("Auto-Join Channels"), "autojoin", ""); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("CTCP Version reply"), "ctcp-message", "Purple IRC"); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("Default Quit Message"), "quit-message", "Leaving."); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("Default Part Message"), "part-message", "Leaving."); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("Set User Modes On Connect"), "setumodes", "i"); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); option = purple_account_option_string_new(_("Unset User Modes On Connect"), "unsetumodes", ""); irc_info->protocol_options = g_list_append(irc_info->protocol_options, option); return TRUE; }
static void connect_to_signals(void) { static int handle; purple_signal_connect(purple_connections_get_handle(), "signed-on", &handle, PURPLE_CALLBACK(signed_on), NULL); purple_signal_connect(purple_conversations_get_handle(), "received-im-msg", &handle, PURPLE_CALLBACK(received_im_msg), NULL); }
void set_connection_error(PurplePlugin *plugin, PyObject *func) { static PyObject *connection_error_cb = 0; Py_XINCREF(func); Py_XDECREF(connection_error_cb); connection_error_cb = func; purple_signal_connect(purple_connections_get_handle(), "connection-error", plugin, PURPLE_CALLBACK(connection_error), connection_error_cb); }
//----------------------------------------------------------------------------- void set_signing_off(PurplePlugin *plugin, PyObject *func) { static PyObject *signing_off_cb = 0; Py_XINCREF(func); Py_XDECREF(signing_off_cb); signing_off_cb = func; purple_signal_connect(purple_connections_get_handle(), "signing-off", plugin, PURPLE_CALLBACK(connection_python_cb), signing_off_cb); }
void _purple_connection_new_unregister(PurpleAccount *account, const char *password, PurpleAccountUnregistrationCb cb, void *user_data) { /* Lots of copy/pasted code to avoid API changes. You might want to integrate that into the previous function when posssible. */ PurpleConnection *gc; PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; g_return_if_fail(account != NULL); prpl = purple_find_prpl(purple_account_get_protocol_id(account)); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); else { gchar *message; message = g_strdup_printf(_("Missing protocol plugin for %s"), purple_account_get_username(account)); purple_notify_error(NULL, _("Unregistration Error"), message, NULL); g_free(message); return; } if (!purple_account_is_disconnected(account)) { prpl_info->unregister_user(account, cb, user_data); return; } if (((password == NULL) || (*password == '\0')) && !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) { purple_debug_error("connection", "Cannot connect to account %s without " "a password.\n", purple_account_get_username(account)); return; } gc = g_new0(PurpleConnection, 1); PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); gc->prpl = prpl; if ((password != NULL) && (*password != '\0')) gc->password = g_strdup(password); purple_connection_set_account(gc, account); purple_connection_set_state(gc, PURPLE_CONNECTING); connections = g_list_append(connections, gc); purple_account_set_connection(account, gc); purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); purple_debug_info("connection", "Unregistering. gc = %p\n", gc); prpl_info->unregister_user(account, cb, user_data); }
static gboolean plugin_unload(PurplePlugin *plugin) { purple_signal_disconnect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(online)); purple_signal_disconnect(purple_connections_get_handle(), "signing-off", plugin, PURPLE_CALLBACK(signoff)); purple_signal_disconnect(purple_accounts_get_handle(), "account-status-changed", plugin, PURPLE_CALLBACK(status_changed)); if(timeoutint > 0) { g_source_remove(timeoutint); timeoutint = 0; } return TRUE; }
/************************************************************************** * Plugin stuff **************************************************************************/ static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(signed_on_cb), NULL); /* we don't check if we're offline */ if(purple_connections_get_all()) do_check(); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { PurplePlugin *jabber; jabber = purple_find_prpl("prpl-jabber"); if (!jabber) return FALSE; xmpp_console_handle = plugin; purple_signal_connect(jabber, "jabber-receiving-xmlnode", xmpp_console_handle, PURPLE_CALLBACK(xmlnode_received_cb), NULL); purple_signal_connect(jabber, "jabber-sending-text", xmpp_console_handle, PURPLE_CALLBACK(xmlnode_sent_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signing-on", plugin, PURPLE_CALLBACK(signing_on_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-off", plugin, PURPLE_CALLBACK(signed_off_cb), NULL); return TRUE; }
void purple_connection_error_reason (PurpleConnection *gc, PurpleConnectionError reason, const char *description) { PurpleConnectionUiOps *ops; g_return_if_fail(gc != NULL); /* This sanity check relies on PURPLE_CONNECTION_ERROR_OTHER_ERROR * being the last member of the PurpleConnectionError enum in * connection.h; if other reasons are added after it, this check should * be updated. */ if (reason > PURPLE_CONNECTION_ERROR_OTHER_ERROR) { purple_debug_error("connection", "purple_connection_error_reason: reason %u isn't a " "valid reason\n", reason); reason = PURPLE_CONNECTION_ERROR_OTHER_ERROR; } if (description == NULL) { purple_debug_error("connection", "purple_connection_error_reason called with NULL description\n"); description = _("Unknown error"); } /* If we've already got one error, we don't need any more */ if (gc->disconnect_timeout > 0) return; gc->wants_to_die = purple_connection_error_is_fatal (reason); purple_debug_info("connection", "Connection error on %p (reason: %u description: %s)\n", gc, reason, description); ops = purple_connections_get_ui_ops(); if (ops != NULL) { if (ops->report_disconnect_reason != NULL) ops->report_disconnect_reason (gc, reason, description); if (ops->report_disconnect != NULL) ops->report_disconnect (gc, description); } purple_signal_emit(purple_connections_get_handle(), "connection-error", gc, reason, description); gc->disconnect_timeout = purple_timeout_add(0, purple_connection_disconnect_cb, purple_connection_get_account(gc)); }
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; }
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; }
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; }
static gboolean plugin_load(PurplePlugin *plugin) { PurpleBuddyList *list = purple_get_blist(); void *conn_handle = purple_connections_get_handle(); if (!check_timeout(NULL)) { purple_debug_warning("mailchk", "Could not read $MAIL or /var/spool/mail/$USER\n"); return FALSE; } if (list && PURPLE_IS_GTK_BLIST(list) && PIDGIN_BLIST(list)->vbox) timer = g_timeout_add(2000, check_timeout, NULL); purple_signal_connect(conn_handle, "signed-on", plugin, PURPLE_CALLBACK(signon_cb), NULL); purple_signal_connect(conn_handle, "signed-off", plugin, PURPLE_CALLBACK(signoff_cb), NULL); return TRUE; }
static gboolean cc_signed_on(PurpleConnection *gc, void *plugin) { struct crazychat *extra; void *conv_handle; assert(plugin); extra = (struct crazychat*)((PurplePlugin*)plugin)->info->extra_info; purple_signal_disconnect (purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(cc_signed_on)); purple_signal_connect(PIDGIN_BLIST (purple_get_blist()), "drawing-menu", plugin, PURPLE_CALLBACK(cc_buddy_menu), NULL); conv_handle = purple_conversations_get_handle(); purple_signal_connect(conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(receive_im_cb), extra); purple_signal_connect(conv_handle, "displaying-im-msg", plugin, PURPLE_CALLBACK(display_im_cb), extra); return FALSE; }
void purple_connections_init(void) { void *handle = purple_connections_get_handle(); purple_signal_register(handle, "signing-on", purple_marshal_VOID__POINTER, NULL, 1, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION)); purple_signal_register(handle, "signed-on", purple_marshal_VOID__POINTER, NULL, 1, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION)); purple_signal_register(handle, "signing-off", purple_marshal_VOID__POINTER, NULL, 1, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION)); purple_signal_register(handle, "signed-off", purple_marshal_VOID__POINTER, NULL, 1, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION)); purple_signal_register(handle, "connection-error", purple_marshal_VOID__POINTER_INT_POINTER, NULL, 3, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION), purple_value_new(PURPLE_TYPE_ENUM), purple_value_new(PURPLE_TYPE_STRING)); purple_signal_register(handle, "autojoin", purple_marshal_BOOLEAN__POINTER, NULL, 1, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_CONNECTION)); }
static gboolean unload_plugin(PurplePlugin *plugin) { int i; GList *current; twitter_debug("called\n"); /* disconnect from signal */ purple_signal_disconnect(purple_conversations_get_handle(), "writing-im-msg", plugin, PURPLE_CALLBACK(writing_im_cb)); purple_signal_disconnect(purple_conversations_get_handle(), "sending-im-msg", plugin, PURPLE_CALLBACK(sending_im_cb)); purple_signal_disconnect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(conv_created_cb)); purple_signal_disconnect(pidgin_conversations_get_handle(), "displaying-im-msg", plugin, PURPLE_CALLBACK(displaying_im_cb)); purple_signal_disconnect(pidgin_conversations_get_handle(), "displayed-im-msg", plugin, PURPLE_CALLBACK(displayed_im_cb)); purple_signal_disconnect(purple_conversations_get_handle(), "receiving-im-msg", plugin, PURPLE_CALLBACK(receiving_im_cb)); purple_signal_disconnect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(deleting_conv_cb)); purple_signal_disconnect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(signed_on_cb)); /* unreference regp */ for(i = 0; i < NUM_REGPS; i++) { g_regex_unref(regp[i]); } /* remove mark list in each hash entry */ /* cancel request that has not been finished yet */ for(i = twitter_service; i < NUM_SERVICES; i++) { /* delete mark list and stop requeset for each hash table */ g_hash_table_foreach(icon_hash[i], (GHFunc)cleanup_hash_entry_func, NULL); /* destroy hash table for icon_data */ g_hash_table_destroy(icon_hash[i]); } g_hash_table_destroy(conv_hash); /* detach from twitter window */ detach_from_window(); /* free wassr_parrot_list */ current = g_list_first(wassr_parrot_list); while(current) { GList *next; next = g_list_next(current); g_free(current->data); wassr_parrot_list = g_list_delete_link(wassr_parrot_list, current); current = next; } g_list_free(wassr_parrot_list); wassr_parrot_list = NULL; /* free identica_parot_list */ current = g_list_first(identica_parrot_list); while(current) { GList *next; next = g_list_next(current); g_free(current->data); identica_parrot_list = g_list_delete_link(identica_parrot_list, current); current = next; } g_list_free(identica_parrot_list); identica_parrot_list = NULL; return TRUE; }
static gboolean load_plugin(PurplePlugin *plugin) { int i; /* connect to signal */ purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", plugin, PURPLE_CALLBACK(writing_im_cb), NULL); purple_signal_connect(purple_conversations_get_handle(), "sending-im-msg", plugin, PURPLE_CALLBACK(sending_im_cb), NULL); purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(conv_created_cb), NULL); purple_signal_connect(purple_conversations_get_handle(), "receiving-im-msg", plugin, PURPLE_CALLBACK(receiving_im_cb), NULL); purple_signal_connect(pidgin_conversations_get_handle(), "displaying-im-msg", plugin, PURPLE_CALLBACK(displaying_im_cb), NULL); purple_signal_connect(pidgin_conversations_get_handle(), "displayed-im-msg", plugin, PURPLE_CALLBACK(displayed_im_cb), NULL); purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(deleting_conv_cb), NULL); purple_signal_connect(purple_connections_get_handle(), "signed-on", plugin, PURPLE_CALLBACK(signed_on_cb), NULL); /* compile regex */ regp[RECIPIENT] = g_regex_new(P_RECIPIENT, 0, 0, NULL); regp[SENDER] = g_regex_new(P_SENDER, 0, 0, NULL); regp[SENDER_FFEED] = g_regex_new(P_SENDER_FFEED, 0, 0, NULL); regp[COMMAND] = g_regex_new(P_COMMAND, G_REGEX_RAW, 0, NULL); regp[PSEUDO] = g_regex_new(P_PSEUDO, G_REGEX_RAW, 0, NULL); regp[USER] = g_regex_new(P_USER, 0, 0, NULL); regp[CHANNEL_WASSR] = g_regex_new(P_CHANNEL, 0, 0, NULL); regp[TAG_TWITTER] = g_regex_new(P_TAG_TWITTER, 0, 0, NULL); regp[TAG_IDENTICA] = g_regex_new(P_TAG_IDENTICA, 0, 0, NULL); regp[GROUP_IDENTICA] = g_regex_new(P_GROUP_IDENTICA, 0, 0, NULL); regp[IMAGE_TWITTER] = g_regex_new(P_IMAGE_TWITTER, 0, 0, NULL); regp[IMAGE_WASSR] = g_regex_new(P_IMAGE_WASSR, 0, 0, NULL); regp[IMAGE_IDENTICA] = g_regex_new(P_IMAGE_IDENTICA, 0, 0, NULL); regp[IMAGE_JISKO] = g_regex_new(P_IMAGE_JISKO, 0, 0, NULL); regp[IMAGE_FFEED] = g_regex_new(P_IMAGE_FFEED, 0, 0, NULL); regp[SIZE_128_WASSR] = g_regex_new(P_SIZE_128_WASSR, 0, 0, NULL); regp[EXCESS_LF] = g_regex_new(P_EXCESS_LF, 0, 0, NULL); regp[TRAIL_HASH] = g_regex_new(P_TRAIL_HASH, 0, 0, NULL); for(i = twitter_service; i < NUM_SERVICES; i++) { icon_hash[i] = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL); } conv_hash = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, NULL); /* attach counter to the existing twitter window */ if(purple_prefs_get_bool(OPT_COUNTER)) { attach_to_window(); } 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(); }
static void pidgin_sound_init(void) { void *gtk_sound_handle = pidgin_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", gtk_sound_handle, PURPLE_CALLBACK(account_signon_cb), NULL); purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound"); purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/enabled"); purple_prefs_add_none(PIDGIN_PREFS_ROOT "/sound/file"); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/login", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/login", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/logout", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/logout", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/im_recv", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/im_recv", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/first_im_recv", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/first_im_recv", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_im", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_im", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/join_chat", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/join_chat", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/left_chat", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/left_chat", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/send_chat_msg", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/send_chat_msg", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/chat_msg_recv", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/chat_msg_recv", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/nick_said", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/nick_said", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/pounce_default", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/pounce_default", ""); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/theme", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/sent_attention", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/sent_attention", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/enabled/got_attention", TRUE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/file/got_attention", ""); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/conv_focus", TRUE); purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/sound/mute", FALSE); purple_prefs_add_path(PIDGIN_PREFS_ROOT "/sound/command", ""); purple_prefs_add_string(PIDGIN_PREFS_ROOT "/sound/method", "automatic"); purple_prefs_add_int(PIDGIN_PREFS_ROOT "/sound/volume", 50); #ifdef USE_GSTREAMER purple_debug_info("sound", "Initializing sound output drivers.\n"); gst_registry_fork_set_enabled(FALSE); if ((gst_init_failed = !gst_init_check(NULL, NULL, &error))) { purple_notify_error(NULL, _("GStreamer Failure"), _("GStreamer failed to initialize."), error ? error->message : "", NULL); if (error) { g_error_free(error); error = NULL; } } #endif /* USE_GSTREAMER */ purple_signal_connect(blist_handle, "buddy-signed-on", gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_SOUND_BUDDY_ARRIVE)); purple_signal_connect(blist_handle, "buddy-signed-off", gtk_sound_handle, PURPLE_CALLBACK(buddy_state_cb), GINT_TO_POINTER(PURPLE_SOUND_BUDDY_LEAVE)); purple_signal_connect(conv_handle, "received-im-msg", gtk_sound_handle, PURPLE_CALLBACK(im_msg_received_cb), GINT_TO_POINTER(PURPLE_SOUND_RECEIVE)); purple_signal_connect(conv_handle, "sent-im-msg", gtk_sound_handle, PURPLE_CALLBACK(im_msg_sent_cb), GINT_TO_POINTER(PURPLE_SOUND_SEND)); purple_signal_connect(conv_handle, "chat-user-joined", gtk_sound_handle, PURPLE_CALLBACK(chat_user_join_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_JOIN)); purple_signal_connect(conv_handle, "chat-user-left", gtk_sound_handle, PURPLE_CALLBACK(chat_user_left_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_LEAVE)); purple_signal_connect(conv_handle, "sent-chat-msg", gtk_sound_handle, PURPLE_CALLBACK(chat_msg_sent_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_YOU_SAY)); purple_signal_connect(conv_handle, "received-chat-msg", gtk_sound_handle, PURPLE_CALLBACK(chat_msg_received_cb), GINT_TO_POINTER(PURPLE_SOUND_CHAT_SAY)); purple_signal_connect(conv_handle, "got-attention", gtk_sound_handle, PURPLE_CALLBACK(got_attention_cb), GINT_TO_POINTER(PURPLE_SOUND_GOT_ATTENTION)); /* for the time being, don't handle sent-attention here, since playing a sound would result induplicate sounds. And fixing that would require changing the conversation signal for msg-recv */ }
void _purple_connection_new(PurpleAccount *account, gboolean regist, const char *password) { PurpleConnection *gc; PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info; g_return_if_fail(account != NULL); if (!purple_account_is_disconnected(account)) return; prpl = purple_find_prpl(purple_account_get_protocol_id(account)); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); else { gchar *message; message = g_strdup_printf(_("Missing protocol plugin for %s"), purple_account_get_username(account)); purple_notify_error(NULL, regist ? _("Registration Error") : _("Connection Error"), message, NULL); g_free(message); return; } if (regist) { if (prpl_info->register_user == NULL) return; } else { if (((password == NULL) || (*password == '\0')) && !(prpl_info->options & OPT_PROTO_NO_PASSWORD) && !(prpl_info->options & OPT_PROTO_PASSWORD_OPTIONAL)) { purple_debug_error("connection", "Cannot connect to account %s without " "a password.\n", purple_account_get_username(account)); return; } } gc = g_new0(PurpleConnection, 1); PURPLE_DBUS_REGISTER_POINTER(gc, PurpleConnection); gc->prpl = prpl; if ((password != NULL) && (*password != '\0')) gc->password = g_strdup(password); purple_connection_set_account(gc, account); purple_connection_set_state(gc, PURPLE_CONNECTING); connections = g_list_append(connections, gc); purple_account_set_connection(account, gc); purple_signal_emit(purple_connections_get_handle(), "signing-on", gc); if (regist) { purple_debug_info("connection", "Registering. gc = %p\n", gc); /* set this so we don't auto-reconnect after registering */ gc->wants_to_die = TRUE; prpl_info->register_user(account); } else { purple_debug_info("connection", "Connecting. gc = %p\n", gc); purple_signal_emit(purple_accounts_get_handle(), "account-connecting", account); prpl_info->login(account); } }