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; }
static gboolean plugin_load(PurplePlugin *plugin, GError **error) { PurpleNotifyUiOps *ops = purple_notify_get_ui_ops(); purple_prefs_add_none(PREFS_BASE); purple_prefs_add_int(PREF_LENGTH, 30); purple_prefs_add_string(PREF_URL, "http://tinyurl.com/api-create.php?url="); g_object_set_data(G_OBJECT(plugin), "notify-uri", ops->notify_uri); ops->notify_uri = tinyurl_notify_uri; tinyurl_cache = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, g_free); purple_signal_connect(purple_conversations_get_handle(), "wrote-im-msg", plugin, PURPLE_CALLBACK(wrote_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "wrote-chat-msg", plugin, PURPLE_CALLBACK(wrote_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "writing-im-msg", plugin, PURPLE_CALLBACK(writing_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "writing-chat-msg", plugin, PURPLE_CALLBACK(writing_msg), NULL); purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", plugin, PURPLE_CALLBACK(free_conv_urls), NULL); return TRUE; }
static gboolean plugin_load (PurplePlugin * plugin) { printf("Foobar"); purple_debug_info("core-hoh-hubbub-pidgin", "Fork debug\n"); /* purple_notify_message (plugin, PURPLE_NOTIFY_MSG_INFO, "Hello World!", "Welcome to the Hubbub-Pidgin plugin ! Make sure the OTR plugin is loaded after me.", NULL, NULL, NULL); */ purple_signal_connect( purple_conversations_get_handle(), "receiving-im-msg", plugin, PURPLE_CALLBACK(receiving_im_msg_cb), NULL); purple_signal_connect( purple_conversations_get_handle(), "writing-im-msg", plugin, PURPLE_CALLBACK(writing_im_msg_cb), NULL); helloworld_plugin = plugin; /* assign this here so we have a valid handle later */ //hubbub_engine_status = system("/home/okso/Documents/Thesis/Hubbub/venv3/bin/python3 -m hubbub fork"); purple_debug_info("core-hoh-hubbub-pidgin", "Fork finished launching Python.\n"); return TRUE; }
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; }
/* * 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; }
void twitter_conv_icon_account_load(PurpleAccount * account) { PurpleConnection *gc = purple_account_get_connection(account); TwitterConnectionData *twitter = gc->proto_data; twitter->icons = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) twitter_conv_icon_free); purple_signal_connect(pidgin_conversations_get_handle(), "displaying-chat-msg", twitter->icons, PURPLE_CALLBACK(twitter_conv_icon_displaying_chat_cb), account); purple_signal_connect(pidgin_conversations_get_handle(), "displayed-chat-msg", twitter->icons, PURPLE_CALLBACK(twitter_conv_icon_displayed_chat_cb), account); purple_signal_connect(purple_conversations_get_handle(), "conversation-created", twitter->icons, PURPLE_CALLBACK(twitter_conv_icon_conversation_created_cb), account); purple_signal_connect(purple_conversations_get_handle(), "deleting-conversation", twitter->icons, PURPLE_CALLBACK(twitter_conv_icon_deleting_conversation_cb), account); }
static gboolean plugin_unload(PurplePlugin *plugin) { bar_set(FALSE); /* Turn the led off */ purple_signal_disconnect(purple_conversations_get_handle(), "conversation-updated", plugin, PURPLE_CALLBACK(lednot_conversation_updated)); return TRUE; }
static gboolean plugin_load(PurplePlugin *plugin) { void *conv_handle; GHashTable *users; guint id; gpointer *data; users = g_hash_table_new_full((GHashFunc)joinpart_key_hash, (GEqualFunc)joinpart_key_equal, (GDestroyNotify)joinpart_key_destroy, g_free); conv_handle = purple_conversations_get_handle(); purple_signal_connect(conv_handle, "chat-buddy-joining", plugin, PURPLE_CALLBACK(chat_buddy_joining_cb), users); purple_signal_connect(conv_handle, "chat-buddy-leaving", plugin, PURPLE_CALLBACK(chat_buddy_leaving_cb), users); purple_signal_connect(conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(received_chat_msg_cb), users); /* Cleanup every 5 minutes */ id = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, users); data = g_new(gpointer, 2); data[0] = users; data[1] = GUINT_TO_POINTER(id); plugin->extra = data; return TRUE; }
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; }
static gboolean plugin_load(PurplePlugin *plugin) { void *conv_handle; PurpleConversationUiOps *ui_ops; purple_prefs_set_bool(PURPLE_NICKCHANGE_PREF, FALSE); userstable = g_hash_table_new_full((GHashFunc)joinpart_key_hash, (GEqualFunc)joinpart_key_equal, (GDestroyNotify)joinpart_key_destroy, g_free); conv_handle = purple_conversations_get_handle(); //purple_signal_connect(conv_handle, "chat-buddy-joining", plugin, PURPLE_CALLBACK(chat_buddy_joining_cb), userstable); //purple_signal_connect(conv_handle, "chat-buddy-leaving", plugin, PURPLE_CALLBACK(chat_buddy_leaving_cb), userstable); purple_signal_connect(conv_handle, "received-chat-msg", plugin, PURPLE_CALLBACK(received_chat_msg_cb), userstable); //purple_prefs_connect_callback(plugin, const char *name, PurplePrefCallback cb, gpointer data) //Attempt overriding the global UI ops ui_ops = pidgin_conversations_get_conv_ui_ops(); /* Cleanup every 5 minutes */ clean_user_timeout = purple_timeout_add_seconds(60 * 5, (GSourceFunc)clean_users_hash, userstable); if (ui_ops) { orig_chat_rename_user = ui_ops->chat_rename_user; ui_ops->chat_rename_user = nickchange_chat_rename_user; } else { //TODO make it work for !Pidgin too return FALSE; } return TRUE; }
static gboolean plugin_load(PurplePlugin * plugin) { asprintf(&hook_script, "%s/%s", purple_user_dir(), AUTORESPOND); void *conv_handle = purple_conversations_get_handle(); purple_signal_connect(conv_handle, "received-im-msg", plugin, PURPLE_CALLBACK(received_im_msg_cb), NULL); return TRUE; }
static gboolean plugin_load(PurplePlugin * plugin) { plugin_self = plugin; purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(timezone_createconv_cb), NULL); purple_plugin_ipc_register(plugin, BUDDYTIME_BUDDY_GET_TIMEZONE, PURPLE_CALLBACK(buddy_get_timezone), marshal_POINTER__POINTER_BOOL, purple_value_new(PURPLE_TYPE_STRING), 2, purple_value_new(PURPLE_TYPE_SUBTYPE, PURPLE_SUBTYPE_BLIST_NODE), purple_value_new(PURPLE_TYPE_BOOLEAN)); purple_plugin_ipc_register(plugin, BUDDYTIME_TIMEZONE_GET_TIME, PURPLE_CALLBACK(timezone_get_time), marshal_POINTER__POINTER_POINTER_POINTER, purple_value_new(PURPLE_TYPE_INT), 2, purple_value_new(PURPLE_TYPE_POINTER), purple_value_new(PURPLE_TYPE_POINTER)); /* This is done as an idle callback to avoid an infinite loop * when we try to load the UI plugin which depends on this plugin * which isn't officially loaded yet. */ purple_timeout_add(0, load_ui_plugin, NULL); 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 translate_sending_chat_message_cb(const gchar *original_phrase, const gchar *translated_phrase, const gchar *detected_language, gpointer userdata) { struct TranslateConvMessage *convmsg = userdata; gchar *html_text; int err = 0; html_text = purple_strdup_withhtml(translated_phrase); err = serv_chat_send(purple_account_get_connection(convmsg->account), purple_conv_chat_get_id(PURPLE_CONV_CHAT(convmsg->conv)), html_text, convmsg->flags); g_free(html_text); html_text = purple_strdup_withhtml(original_phrase); //if (err > 0) //{ // purple_conversation_write(convmsg->conv, convmsg->sender, html_text, convmsg->flags, time(NULL)); //} purple_signal_emit(purple_conversations_get_handle(), "sent-chat-msg", convmsg->account, html_text, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convmsg->conv))); g_free(html_text); g_free(convmsg->sender); g_free(convmsg); }
static gboolean plugin_unload(PurplePlugin *plugin) { purple_signal_disconnect(purple_conversations_get_handle(), "received-im-msg", plugin, PURPLE_CALLBACK(msg_received)); return TRUE; }
void msn_session_destroy (MsnSession *session) { if (!session) return; pn_oim_session_free (session->oim_session); purple_signal_disconnect (purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK (conversation_created_cb)); if (session->connected) msn_session_disconnect (session); #if defined(PECAN_CVR) g_hash_table_destroy (session->links); #endif /* defined(PECAN_CVR) */ msn_notification_destroy (session->notification); pn_dp_manager_free (session->dp_manager); g_hash_table_destroy (session->conversations); g_hash_table_destroy (session->chats); pn_contactlist_destroy (session->contactlist); g_free (session->passport_info.kv); g_free (session->passport_info.sid); g_free (session->passport_info.mspauth); g_free (session->passport_info.client_ip); g_free (session->passport_info.mail_url); g_free (session->passport_cookie.t); g_free (session->passport_cookie.p); if (session->autoupdate_tune.timer) g_source_remove (session->autoupdate_tune.timer); if (session->sync) msn_sync_destroy (session->sync); if (session->nexus) msn_nexus_destroy (session->nexus); pn_contact_free (session->user); g_hash_table_destroy (session->config); g_free (session->username); g_free (session->password); #ifdef INTERNAL_MAINLOOP purple_timeout_remove (session->g_main_loop_timer); g_main_loop_unref (session->g_main_loop); #endif g_free (session); }
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_load(PurplePlugin *plugin) { void *conv_list_handle; PURPLE_DBUS_RETURN_FALSE_IF_DISABLED(plugin); /* First, we have to register our four exported functions with the main purple dbus loop. Without this statement, the purple dbus code wouldn't know about our functions. */ PURPLE_DBUS_REGISTER_BINDINGS(plugin); /* Keep the plugin for reference (needed for notify's) */ plugin_pointer = plugin; /* Add the button to all the current conversations */ purple_conversation_foreach (init_conversation); /* Listen for any new conversations */ conv_list_handle = purple_conversations_get_handle(); purple_signal_connect(conv_list_handle, "conversation-created", plugin, PURPLE_CALLBACK(init_conversation), NULL); /* Listen for conversations that are ending */ purple_signal_connect(conv_list_handle, "deleting-conversation", plugin, PURPLE_CALLBACK(conv_destroyed), NULL); /* Listen for sending/receiving messages to replace tags */ purple_signal_connect(conv_list_handle, "sending-im-msg", plugin, PURPLE_CALLBACK(intercept_sent), NULL); purple_signal_connect(conv_list_handle, "receiving-im-msg", plugin, PURPLE_CALLBACK(intercept_received), NULL); return TRUE; }
MsnSession * msn_session_new (const gchar *username, const gchar *password, gboolean http_method) { MsnSession *session; session = g_new0 (MsnSession, 1); session->username = pn_normalize (username); session->password = g_strndup (password, 16); #ifdef INTERNAL_MAINLOOP session->g_main_loop = g_main_loop_new (NULL, FALSE); session->g_main_loop_timer = purple_timeout_add (1000, g_main_context_iteration_timer, NULL); #endif session->config = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); /** @todo sb and ns need this here but should be updated on-the-fly. */ msn_session_set_bool (session, "use_http_method", http_method); #if 0 if (session->http_method) { PnNode *foo; foo = PN_NODE (pn_http_server_new ("foo server")); foo->session = session; session->http_conn = foo; } #endif session->dp_manager = pn_dp_manager_new (session); session->notification = msn_notification_new (session); pn_node_set_id(session->notification->cmdproc->conn, session->conn_count++, "ns"); session->contactlist = pn_contactlist_new (session); session->user = pn_contact_new (NULL); pn_contact_set_passport (session->user, session->username); session->conv_seq = 1; session->oim_session = pn_oim_session_new (session); session->conversations = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) msn_switchboard_unref); session->chats = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify) msn_switchboard_unref); #if defined(PECAN_CVR) session->links = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify) pn_peer_link_unref); #endif /* defined(PECAN_CVR) */ purple_signal_connect (purple_conversations_get_handle(), "conversation-created", session, PURPLE_CALLBACK (conversation_created_cb), session); return session; }
static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect(purple_conversations_get_handle(), "conversation-created", plugin, PURPLE_CALLBACK(historize), NULL); return TRUE; }
int irc_cmd_ctcp_action(struct irc_conn *irc, const char *cmd, const char *target, const char **args) { PurpleConnection *gc = purple_account_get_connection(irc->account); char *action, *escaped, *dst, **newargs; const char *src; char *msg; PurpleConversation *convo; PurpleMessage *pmsg; if (!args || !args[0] || !gc) return 0; convo = purple_conversations_find_with_account(target, irc->account); msg = g_strdup_printf("/me %s", args[0]); /* XXX: we'd prefer to keep this in conversation.c */ if (PURPLE_IS_IM_CONVERSATION(convo)) { pmsg = purple_message_new_outgoing( purple_conversation_get_name(convo), msg, 0); purple_signal_emit(purple_conversations_get_handle(), "sending-im-msg", irc->account, pmsg); } else { pmsg = purple_message_new_outgoing(NULL, msg, 0); purple_signal_emit(purple_conversations_get_handle(), "sending-chat-msg", irc->account, pmsg, purple_chat_conversation_get_id(PURPLE_CHAT_CONVERSATION(convo))); } g_free(msg); if (purple_message_is_empty(pmsg)) return 0; msg = g_strdup(purple_message_get_contents(pmsg)); /* XXX: is it really necessary? */ if (strncmp(msg, "/me ", 4) != 0) { newargs = g_new0(char *, 2); newargs[0] = g_strdup(target); newargs[1] = msg; irc_cmd_privmsg(irc, cmd, target, (const char **)newargs); g_free(newargs[0]); g_free(newargs); } else {
/* register "sending" message signal callback */ static gboolean plugin_load(PurplePlugin *plugin) { purple_signal_connect_priority(purple_conversations_get_handle(), "sending-im-msg", plugin, PURPLE_CALLBACK(sending_im_msg_cb), NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST); purple_signal_connect_priority(purple_conversations_get_handle(), "sending-chat-msg", plugin, PURPLE_CALLBACK(sending_chat_msg_cb), NULL, PURPLE_SIGNAL_PRIORITY_HIGHEST); 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, GError **error) { GList *convs = purple_conversations_get_all(); PurpleSavedStatus *saved_status; void *conv_handle = purple_conversations_get_handle(); void *gtk_conv_handle = pidgin_conversations_get_handle(); void *savedstat_handle = purple_savedstatuses_get_handle(); purple_prefs_add_none("/plugins/gtk"); purple_prefs_add_none("/plugins/gtk/unity"); purple_prefs_add_int("/plugins/gtk/unity/launcher_count", LAUNCHER_COUNT_SOURCES); purple_prefs_add_int("/plugins/gtk/unity/messaging_menu_text", MESSAGING_MENU_COUNT); purple_prefs_add_bool("/plugins/gtk/unity/alert_chat_nick", TRUE); alert_chat_nick = purple_prefs_get_bool("/plugins/gtk/unity/alert_chat_nick"); mmapp = messaging_menu_app_new("pidgin.desktop"); g_object_ref(mmapp); messaging_menu_app_register(mmapp); messaging_menu_text = purple_prefs_get_int("/plugins/gtk/unity/messaging_menu_text"); g_signal_connect(mmapp, "activate-source", G_CALLBACK(message_source_activated), NULL); g_signal_connect(mmapp, "status-changed", G_CALLBACK(messaging_menu_status_changed), NULL); saved_status = purple_savedstatus_get_current(); status_changed_cb(saved_status); purple_signal_connect(savedstat_handle, "savedstatus-changed", plugin, PURPLE_CALLBACK(status_changed_cb), NULL); launcher = unity_launcher_entry_get_for_desktop_id("pidgin.desktop"); g_object_ref(launcher); launcher_count = purple_prefs_get_int("/plugins/gtk/unity/launcher_count"); purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, PURPLE_CALLBACK(message_displayed_cb), NULL); purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, PURPLE_CALLBACK(message_displayed_cb), NULL); purple_signal_connect(conv_handle, "sent-im-msg", plugin, PURPLE_CALLBACK(im_sent_im), NULL); purple_signal_connect(conv_handle, "sent-chat-msg", plugin, PURPLE_CALLBACK(chat_sent_im), NULL); purple_signal_connect(conv_handle, "conversation-created", plugin, PURPLE_CALLBACK(conv_created), NULL); purple_signal_connect(conv_handle, "deleting-conversation", plugin, PURPLE_CALLBACK(deleting_conv), NULL); while (convs) { PurpleConversation *conv = (PurpleConversation *)convs->data; attach_signals(conv); convs = convs->next; } 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); }
/* Connects signal handlers used by the plugin. * Currently, this consists of only the receiving-chat-msg signal. */ static void connect_signals(PurplePlugin *plugin) { /* The conversation handle is used for conversation-related signals */ void *conv_handle = purple_conversations_get_handle() ; /* Register the receiving-chat-msg signal handler */ purple_signal_connect(conv_handle, "receiving-chat-msg", plugin, PURPLE_CALLBACK(receiving_chat_msg_cb), NULL) ; /* Done, nothing to return */ return ; }
void purple_conversations_uninit(void) { while (conversations) g_object_unref(G_OBJECT(conversations->data)); g_hash_table_destroy(conversation_cache); purple_signals_unregister_by_instance(purple_conversations_get_handle()); }
static void purple_prpl_attention(PurpleConversation *conv, const char *who, guint type, PurpleMessageFlags flags, time_t mtime) { PurpleAccount *account = purple_conversation_get_account(conv); purple_signal_emit(purple_conversations_get_handle(), flags == PURPLE_MESSAGE_SEND ? "sent-attention" : "got-attention", account, who, conv, type); }
void set_buddy_typing(PurplePlugin *plugin, PyObject *func) { static PyObject *buddy_typing_cb = 0; Py_XINCREF(func); Py_XDECREF(buddy_typing_cb); buddy_typing_cb = func; purple_signal_connect(purple_conversations_get_handle(), "buddy-typing", plugin, PURPLE_CALLBACK(buddy_typing), buddy_typing_cb); }