static gint compare_protocol(PurpleBlistNode *node1, PurpleBlistNode *node2) { PurpleAccount *acc1=NULL, *acc2=NULL; if(!node1) { return 0; } if(PURPLE_BLIST_NODE_IS_CHAT(node1)) { acc1 = ((PurpleChat *)node1)->account; } else if(PURPLE_BLIST_NODE_IS_BUDDY(node1)) { acc1 = ((PurpleBuddy *)node1)->account; } else if(PURPLE_BLIST_NODE_IS_CONTACT(node1)) { acc1 = (purple_contact_get_priority_buddy((PurpleContact *)node1))->account; } if(node2) { if(PURPLE_BLIST_NODE_IS_CHAT(node2)) { acc2 = ((PurpleChat *)node2)->account; } else if(PURPLE_BLIST_NODE_IS_BUDDY(node2)) { acc2 = ((PurpleBuddy *)node2)->account; } else if(PURPLE_BLIST_NODE_IS_CONTACT(node2)) { acc2 = (purple_contact_get_priority_buddy((PurpleContact *)node2))->account; } } return purple_utf8_strcasecmp( purple_account_get_protocol_id(acc1), acc2 ? purple_account_get_protocol_id(acc2) : NULL ); }
static void write_conv(PurpleConversation *conv, const char *who, const char *alias, const char *message, PurpleMessageFlags flags, time_t mtime) { if (im_handler != Qnil) { PurpleAccount* account = purple_conversation_get_account(conv); if (strcmp(purple_account_get_protocol_id(account), "prpl-msn") == 0 && (strstr(message, "Message could not be sent") != NULL || strstr(message, "Message was not sent") != NULL || strstr(message, "Message may have not been sent") != NULL ) ) { /* I have seen error like 'msn: Connection error from Switchboard server'. * In that case, libpurple will notify user with two regular im message. * The first message is an error message, the second one is the original message that failed to send. */ notify_message(PURPLE_CONNECTION_ERROR_NETWORK_ERROR, message, purple_account_get_protocol_id(account), who); } else { VALUE args[3]; args[0] = Data_Wrap_Struct(cAccount, NULL, NULL, account); args[1] = rb_str_new2(who); args[2] = rb_str_new2(message); check_callback(im_handler, "im_handler"); rb_funcall2(im_handler, CALL, 3, args); } } }
static void call_if_nullprpl(gpointer data, gpointer userdata) { PurpleConnection *gc = (PurpleConnection *)(data); GcFuncData *gcfdata = (GcFuncData *)userdata; if (!strcmp(purple_account_get_protocol_id(purple_connection_get_account(gc)), NULLPRPL_ID)) gcfdata->fn(gcfdata->from, gc, gcfdata->userdata); }
PurpleAccount * purple_accounts_find_ext(const char *name, const char *protocol_id, gboolean (*account_test)(const PurpleAccount *account)) { PurpleAccount *result = NULL; GList *l; char *who; if (name) who = g_strdup(purple_normalize(NULL, name)); else who = NULL; for (l = purple_accounts_get_all(); l != NULL; l = l->next) { PurpleAccount *account = (PurpleAccount *)l->data; if (who && strcmp(purple_normalize(NULL, purple_account_get_username(account)), who)) continue; if (protocol_id && strcmp(purple_account_get_protocol_id(account), protocol_id)) continue; if (account_test && !account_test(account)) continue; result = account; break; } g_free(who); return result; }
void PurpleContactListMngr::UpdateBuddyIcon(PurpleBuddy *buddy) { IMAccount *account = NULL; PurpleIMPresence *mIMPresence = NULL; PurpleAccount *gAccount = purple_buddy_get_account(buddy); const char *gPrclId = purple_account_get_protocol_id(gAccount); account = _accountMngr->FindIMAccount(purple_account_get_username(gAccount), PurpleIMPrcl::GetEnumIMProtocol(gPrclId)); if (!account) return; mIMPresence = _presenceMngr->FindIMPresence(*account); if (!mIMPresence) { LOG_FATAL("IMPresence not found!"); return; } size_t size; OWPicture picture; const char *data = (const char *)purple_buddy_icon_get_data(buddy->icon, &size); if (data && size > 0) picture = OWPicture::pictureFromData(std::string(data, size)); mIMPresence->contactIconChangedEvent(*mIMPresence, purple_buddy_get_name(buddy), picture); }
static void _elim_connect_progress ( PurpleConnection *gc , const char *text , size_t step , size_t step_count ) { PurpleAccount *acct = purple_connection_get_account( gc ); fprintf( stderr, "(_elim_connect_progress)\n" ); if( acct ) { char *ID = new_elim_id(); xmlnode *alist = xnode_new( "alist" ); xmlnode *mcall = func_call( "elim-connection-progress", ID, alist ); const char *aname = purple_account_get_username ( acct ); const char *proto = purple_account_get_protocol_id( acct ); int state = purple_connection_get_state ( gc ); g_free( ID ); AL_PTR ( alist, "account-uid" , acct ); AL_STR ( alist, "account-name", aname ); AL_STR ( alist, "im-protocol" , proto ); AL_INT ( alist, "step" , step ); AL_INT ( alist, "step-count" , step_count ); AL_STR ( alist, "message" , text ); AL_ENUM( alist, "state" , state , ":connection-state" ); add_outbound_sexp( mcall ); } }
void ProtoManager::PluginsAvailable () { purple_debug_set_enabled (true); const auto& dir = Util::CreateIfNotExists ("azoth/velvetbird/purple"); purple_util_set_user_dir (dir.absolutePath ().toUtf8 ().constData ()); purple_core_set_ui_ops (&UiOps); purple_eventloop_set_ui_ops (&EvLoopOps); purple_idle_set_ui_ops (&IdleOps); purple_connections_set_ui_ops (&ConnUiOps); purple_set_blist (purple_blist_new ()); purple_blist_set_ui_data (this); purple_blist_set_ui_ops (&BListUiOps); purple_conversations_set_ui_ops (&ConvUiOps); purple_accounts_set_ui_ops (&AccUiOps); purple_notify_set_ui_ops (&NotifyUiOps); purple_imgstore_init (); purple_buddy_icons_init (); if (!purple_core_init ("leechcraft.azoth")) { qWarning () << Q_FUNC_INFO << "failed initializing libpurple"; return; } QMap<QByteArray, Protocol_ptr> id2proto; auto protos = purple_plugins_get_protocols (); while (protos) { auto item = static_cast<PurplePlugin*> (protos->data); protos = protos->next; const auto& proto = std::make_shared<Protocol> (item, Proxy_); const auto& purpleId = proto->GetPurpleID (); if (purpleId == "prpl-jabber" || purpleId == "prpl-irc") continue; Protocols_ << proto; id2proto [purpleId] = proto; } auto accs = purple_accounts_get_all (); while (accs) { auto acc = static_cast<PurpleAccount*> (accs->data); accs = accs->next; id2proto [purple_account_get_protocol_id (acc)]->PushAccount (acc); } purple_blist_load (); purple_savedstatus_activate (purple_savedstatus_get_startup ()); }
OtrlPolicy otrg_buddy_prefs_get_policy(PurpleAccount *account, const char *name) { const gchar *proto; PurpleBuddy *buddy; gboolean p_enabled, p_automatic, p_onlyprivate; gboolean _unused; proto = purple_account_get_protocol_id(account); if (!otrg_plugin_proto_supports_otr(proto)) return OTRL_POLICY_NEVER; buddy = purple_blist_find_buddy(account, name); if (buddy) { otrg_prefs_buddy_load(buddy, &_unused, &p_enabled, &p_automatic, &p_onlyprivate, &_unused); } else { otrg_prefs_global_load(&p_enabled, &p_automatic, &p_onlyprivate, &_unused); } if (!p_enabled) return OTRL_POLICY_NEVER; if (p_automatic && p_onlyprivate) return OTRL_POLICY_ALWAYS; if (p_automatic) return OTRL_POLICY_OPPORTUNISTIC; return OTRL_POLICY_MANUAL; }
static void signed_on(PurpleConnection *gc) { PurpleAccount *account = purple_connection_get_account(gc); printf("Account connected: \"%s\" (%s)\n", purple_account_get_username(account), purple_account_get_protocol_id(account)); }
void AccountWindow::SplitOption::updateSplits() { SplitWidgets *split_widgets = &account_entry->split_widgets; SplitWidgets::iterator split_widget = split_widgets->begin(); SplitOption *widget = *split_widget; const char *val = widget->getValue(); split_widget++; GString *username = g_string_new(val); PurplePluginProtocolInfo *prplinfo = PURPLE_PLUGIN_PROTOCOL_INFO( purple_find_prpl(purple_account_get_protocol_id(account))); for (GList *iter = prplinfo->user_splits; iter && split_widget != split_widgets->end(); iter = iter->next, split_widget++) { PurpleAccountUserSplit *user_split = reinterpret_cast<PurpleAccountUserSplit*>(iter->data); widget = *split_widget; val = widget->getValue(); if (!val || !*val) val = purple_account_user_split_get_default_value(user_split); g_string_append_printf(username, "%c%s", purple_account_user_split_get_separator(user_split), val); } purple_account_set_username(account, username->str); g_string_free(username, TRUE); }
static void *_elim_request_authorise ( PurpleAccount *account , const char *remote_user , const char *id , const char *alias , const char *message , gboolean on_list , PARA_CB authorize_cb , PARA_CB deny_cb , void *user_data ) { CB_HANDLER *cbh = g_new0( CB_HANDLER, 1 ); AUI_RESP *resp = g_new0( AUI_RESP , 1 ); xmlnode *alist = xnode_new( "alist" ); char *ID = new_elim_id(); fprintf( stderr, "(_elim_request_authorise)\n" ); AL_STR ( alist, "user" , remote_user ); AL_STR ( alist, "id" , id ); AL_STR ( alist, "alias" , alias ); AL_BOOL( alist, "on-list" , on_list ); AL_STR ( alist, "message" , message ); AL_PTR ( alist, "account-uid" , account ); AL_STR ( alist, "account-name", purple_account_get_username ( account ) ); AL_STR ( alist, "im-protocol" , purple_account_get_protocol_id( account ) ); resp->ok = authorize_cb; resp->nok = deny_cb; resp->id = ID; resp->data = user_data; cbh ->func = _elim_request_authorise_cb; cbh ->data = resp; store_cb_data( ID, cbh ); xmlnode *mcall = func_call( "elim-account-request-auth", ID, alist ); add_outbound_sexp( mcall ); return cbh; }
void PurpleChatMngr::UpdateBuddyTyping(PurpleConversation *conv, PurpleTypingState state) { IMChat::TypingState mState; mConvInfo_t *mConv = (mConvInfo_t *)conv->ui_data; PurpleIMChat *mIMChat = FindIMChatByPurpleConv(conv); if (!mIMChat) return; switch (state) { case PURPLE_TYPING: mState = IMChat::TypingStateTyping; break; case PURPLE_TYPED: mState = IMChat::TypingStateStopTyping; break; default: mState = IMChat::TypingStateNotTyping; break; } // Get contact id. If it's a jabber contact, remove its ressource. const char* name = purple_conversation_get_name(conv); PurpleAccount* gAccount = purple_conversation_get_account(conv); const char* gPrclId = purple_account_get_protocol_id(gAccount); std::string contactId = cleanContactId(name, PurpleIMPrcl::GetEnumIMProtocol(gPrclId)); // mIMChat->typingStateChangedEvent(*mIMChat, *((IMChatSession *)(mConv->conv_session)), contactId, mState); mIMChat->typingStateChangedEvent(*mIMChat, *(mConv->conv_session), contactId, mState); //VOXOX - JRT - 2009.07.09 }
static void insert_status_change_from_purple_status(CapStatistics *statistics, PurpleStatus *status) { PurpleAccount *account = purple_buddy_get_account(statistics->buddy); char *sql; const gchar *status_id; const gchar *buddy_name; const gchar *protocol_id; const gchar *account_id; /* It would seem that some protocols receive periodic updates of the buddies status. * Check to make sure the last status is not the same as current status to prevent * to many duplicated useless database entries. */ if(strcmp(statistics->last_status_id, purple_status_get_id(status)) == 0) return; status_id = purple_status_get_id(status); buddy_name = purple_buddy_get_name(statistics->buddy); protocol_id = purple_account_get_protocol_id(account); account_id = purple_account_get_username(account); statistics->last_status_id = purple_status_get_id(status); purple_debug_info("cap", "Executing: insert into cap_status (buddy, account, protocol, status, event_time) values(%s, %s, %s, %s, now());\n", buddy_name, account_id, protocol_id, status_id); sql = sqlite3_mprintf("insert into cap_status values (%Q, %Q, %Q, %Q, now());", buddy_name, account_id, protocol_id, status_id); sqlite3_exec(_db, sql, NULL, NULL, NULL); sqlite3_free(sql); }
static void insert_cap_success(CapStatistics *stats) { PurpleAccount *account = purple_buddy_get_account(stats->buddy); const gchar *buddy_name = purple_buddy_get_name(stats->buddy); const gchar *protocol_id = purple_account_get_protocol_id(account); const gchar *account_id = purple_account_get_username(account); const gchar *status_id = (stats->last_message_status_id) ? stats->last_message_status_id : purple_status_get_id(get_status_for(stats->buddy)); struct tm *current_time; int minute; if(stats->last_message == -1) { time_t now = time(NULL); current_time = localtime(&now); } else { current_time = localtime(&stats->last_message); } minute = current_time->tm_min + current_time->tm_hour * 60; insert_cap_msg_count_success(buddy_name, account_id, protocol_id, minute); insert_cap_status_count_success(buddy_name, account_id, protocol_id, status_id); stats->last_message = -1; stats->last_message_status_id = NULL; }
static void twitter_get_list_parse_statuses(TwitterEndpointChat * endpoint_chat, GList * statuses) { PurpleConnection *gc; GList *l; TwitterUserTweet *user_tweet; purple_debug_info(purple_account_get_protocol_id(endpoint_chat->account), "%s\n", G_STRFUNC); g_return_if_fail(endpoint_chat != NULL); gc = purple_account_get_connection(endpoint_chat->account); if (!statuses) { /* At least update the topic with the new rate limit info */ twitter_chat_update_rate_limit(endpoint_chat); return; } l = g_list_last(statuses); user_tweet = l->data; if (user_tweet && user_tweet->status) /* Tweets might not be sequential anymore. Take since_id from the last one, not the greatest */ #if 0 &&user_tweet->status->id > twitter_connection_get_last_home_timeline_id(gc) #endif /* 0 */ { TwitterListTimeoutContext *ctx = endpoint_chat->endpoint_data; gchar *key = g_strdup_printf("list_%s", ctx->list_name); ctx->last_tweet_id = user_tweet->status->id; purple_account_set_long_long(endpoint_chat->account, key, ctx->last_tweet_id); g_free(key); } twitter_chat_got_user_tweets(endpoint_chat, statuses); }
static void twitter_send_xml_request_with_cursor_cb(TwitterRequestor * r, xmlnode * node, gpointer user_data) { TwitterRequestWithCursorData *request_data = user_data; gchar *next_cursor_str; next_cursor_str = xmlnode_get_child_data(node, "next_cursor"); if (next_cursor_str) { request_data->next_cursor = strtoll(next_cursor_str, NULL, 10); g_free(next_cursor_str); } else { request_data->next_cursor = 0; } purple_debug_info(purple_account_get_protocol_id(r->account), "%s next_cursor: %lld\n", G_STRFUNC, request_data->next_cursor); request_data->nodes = g_list_prepend(request_data->nodes, xmlnode_copy(node)); if (request_data->next_cursor) { int len = request_data->params->len; twitter_request_params_add(request_data->params, twitter_request_param_new_ll("cursor", request_data->next_cursor)); twitter_send_xml_request(r, FALSE, request_data->url, request_data->params, twitter_send_xml_request_with_cursor_cb, twitter_send_xml_request_with_cursor_error_cb, request_data); twitter_request_params_set_size(request_data->params, len); } else { request_data->success_callback(r, request_data->nodes, request_data->user_data); twitter_request_with_cursor_data_free(request_data); } }
GList * otrg_conversation_get_contexts(PurpleConversation *conv) { PurpleAccount *account; const gchar *accountname, *protocol; gchar *username; ConnContext *it = NULL; GList *contexts = NULL; g_return_val_if_fail(conv != NULL, NULL); g_return_val_if_fail(PURPLE_IS_IM_CONVERSATION(conv), NULL); account = purple_conversation_get_account(conv); accountname = purple_account_get_username(account); protocol = purple_account_get_protocol_id(account); username = g_strdup(purple_normalize(account, purple_conversation_get_name(conv))); for (it = otrg_plugin_userstate->context_root; it; it = it->next) { if (g_strcmp0(it->accountname, accountname) != 0) continue; if (g_strcmp0(it->protocol, protocol) != 0) continue; if (g_strcmp0(it->username, username) != 0) continue; contexts = g_list_append(contexts, it); } g_free(username); return contexts; }
void BuddyListChat::onActivate(Button& /*activator*/) { PurpleAccount *account = purple_chat_get_account(chat); PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO( purple_find_prpl(purple_account_get_protocol_id(account))); GHashTable *components = purple_chat_get_components(chat); char *chat_name = NULL; if (prpl_info && prpl_info->get_chat_name) chat_name = prpl_info->get_chat_name(components); const char *name; if (chat_name) name = chat_name; else name = purple_chat_get_name(chat); PurpleConversation *conv = purple_find_conversation_with_account( PURPLE_CONV_TYPE_CHAT, name, account); if (conv) purple_conversation_present(conv); serv_join_chat(purple_account_get_connection(account), components); g_free(chat_name); }
gboolean otrg_buddy_prefs_get_avoid_logging(PurpleAccount *account, const char *name) { const gchar *proto; PurpleBuddy *buddy; gboolean p_enabled, p_avoidloggingotr; gboolean _unused; proto = purple_account_get_protocol_id(account); if (!otrg_plugin_proto_supports_otr(proto)) return TRUE; buddy = purple_blist_find_buddy(account, name); if (buddy) { otrg_prefs_buddy_load(buddy, &_unused, &p_enabled, &_unused, &_unused, &p_avoidloggingotr); } else { otrg_prefs_global_load(&p_enabled, &_unused, &_unused, &p_avoidloggingotr); } if (p_enabled) return p_avoidloggingotr; else return OTRL_POLICY_NEVER; }
static void buddy_status_changed(PurpleBuddy *buddy, PurpleStatus *old_status, PurpleStatus *status) { PurplePlugin *prpl; PurplePluginProtocolInfo *prpl_info = NULL; char *sip_from = find_sip_user(buddy->name); int d = hashtable_get_counter(buddy->name); PurpleStatusPrimitive primitive; enum purple_publish_basic basic; enum purple_publish_activity activity; char *statustext = NULL, *tmp = NULL, *new; const char *end; LM_DBG("buddy <%s> has changed status\n", buddy->name); if ((sip_from) && (d>0)) { primitive = purple_status_type_get_primitive(purple_status_get_type(status)); primitive_parse(primitive, &basic, &activity); // char *note = purple_status_get_attr_string(status, "message"); prpl = purple_find_prpl(purple_account_get_protocol_id(buddy->account)); if (prpl != NULL) prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(prpl); if (prpl_info && prpl_info->status_text && buddy->account->gc) { tmp = prpl_info->status_text(buddy); if(tmp && !g_utf8_validate(tmp, -1, &end)) { new = g_strndup(tmp, g_utf8_pointer_to_offset(tmp, end)); g_free(tmp); tmp = new; }
static void _elim_report_disconnect_reason( PurpleConnection *conn , PurpleConnectionError reason , const char *text ) { PurpleAccount *acct = purple_connection_get_account( conn ); if( acct ) { char *ID = new_elim_id(); xmlnode *alist = xnode_new( "alist" ); fprintf( stderr, "(_elim_report_disconnect_reason)\n" ); xmlnode *mcall = func_call( "elim-disconnect-reason", ID, alist ); const char *aname = purple_account_get_username ( acct ); const char *proto = purple_account_get_protocol_id( acct ); int state = purple_connection_get_state ( conn ); g_free( ID ); AL_PTR ( alist, "account-uid" , acct ); AL_STR ( alist, "account-name", aname ); AL_STR ( alist, "im-protocol" , proto ); AL_STR ( alist, "message" , text ); AL_ENUM( alist, "reason-code" , reason, ":connection-error" ); AL_ENUM( alist, "state" , state , ":connection-state" ); add_outbound_sexp( mcall ); } }
/*------------------------------------------------------------------------ * Adds a link to a message * * @param mx The Markup message object * @param replydata This is the what will be returned when the link gets clicked * @param isStructured Indicates that the reply is a structured reply * @param displaytext This is the text for the link which will be displayed in the UI */ void mxit_add_html_link( struct RXMsgData* mx, const char* replydata, gboolean isStructured, const char* displaytext ) { #ifdef MXIT_LINK_CLICK gchar* link = NULL; gchar* link64 = NULL; /* * The link content is encoded as follows: * MXIT_LINK_KEY | ACCOUNT_USER | ACCOUNT_PROTO | REPLY_TO | REPLY_FORMAT | REPLY_DATA */ link = g_strdup_printf( "%s|%s|%s|%s|%i|%s", MXIT_LINK_KEY, purple_account_get_username( mx->session->acc ), purple_account_get_protocol_id( mx->session->acc ), mx->from, isStructured ? 1 : 0, replydata ); link64 = purple_base64_encode( (const unsigned char*) link, strlen( link ) ); g_string_append_printf( mx->msg, "<a href=\"%s%s\">%s</a>", MXIT_LINK_PREFIX, link64, displaytext ); g_free( link64 ); g_free( link ); #else g_string_append_printf( mx->msg, "<b>%s</b>", replydata ); #endif }
PurpleWhiteboard *purple_whiteboard_new(PurpleAccount *account, const char *who, int state) { PurpleWhiteboard *wb; PurpleProtocol *protocol; g_return_val_if_fail(PURPLE_IS_ACCOUNT(account), NULL); g_return_val_if_fail(who != NULL, NULL); protocol = purple_protocols_find(purple_account_get_protocol_id(account)); g_return_val_if_fail(PURPLE_IS_PROTOCOL(protocol), NULL); if (PURPLE_PROTOCOL_IMPLEMENTS(protocol, FACTORY_IFACE, whiteboard_new)) wb = purple_protocol_factory_iface_whiteboard_new(protocol, account, who, state); else wb = g_object_new(PURPLE_TYPE_WHITEBOARD, "account", account, "who", who, "state", state, NULL ); g_return_val_if_fail(wb != NULL, NULL); return wb; }
static void twitter_get_list_cb(TwitterRequestor * r, xmlnode * node, gpointer user_data) { TwitterEndpointChatId *chat_id = (TwitterEndpointChatId *) user_data; TwitterEndpointChat *endpoint_chat; GList *statuses; purple_debug_info(purple_account_get_protocol_id(r->account), "%s\n", G_STRFUNC); g_return_if_fail(chat_id != NULL); endpoint_chat = twitter_endpoint_chat_find_by_id(chat_id); twitter_endpoint_chat_id_free(chat_id); if (endpoint_chat == NULL) return; endpoint_chat->rate_limit_remaining = r->rate_limit_remaining; endpoint_chat->rate_limit_total = r->rate_limit_total; endpoint_chat->retrieval_in_progress = FALSE; endpoint_chat->retrieval_in_progress_timeout = 0; statuses = twitter_statuses_node_parse(node); twitter_get_list_parse_statuses(endpoint_chat, statuses); }
static PurpleXmlNode * pounce_to_xmlnode(PurplePounce *pounce) { PurpleXmlNode *node, *child; PurpleAccount *pouncer; PurplePounceEvent events; PurplePounceOption options; pouncer = purple_pounce_get_pouncer(pounce); events = purple_pounce_get_events(pounce); options = purple_pounce_get_options(pounce); node = purple_xmlnode_new("pounce"); purple_xmlnode_set_attrib(node, "ui", pounce->ui_type); child = purple_xmlnode_new_child(node, "account"); purple_xmlnode_set_attrib(child, "protocol", purple_account_get_protocol_id(pouncer)); purple_xmlnode_insert_data(child, purple_normalize(pouncer, purple_account_get_username(pouncer)), -1); child = purple_xmlnode_new_child(node, "pouncee"); purple_xmlnode_insert_data(child, purple_pounce_get_pouncee(pounce), -1); /* Write pounce options */ child = purple_xmlnode_new_child(node, "options"); if (options & PURPLE_POUNCE_OPTION_AWAY) add_option_to_xmlnode(child, "on-away"); /* Write pounce events */ child = purple_xmlnode_new_child(node, "events"); if (events & PURPLE_POUNCE_SIGNON) add_event_to_xmlnode(child, "sign-on"); if (events & PURPLE_POUNCE_SIGNOFF) add_event_to_xmlnode(child, "sign-off"); if (events & PURPLE_POUNCE_AWAY) add_event_to_xmlnode(child, "away"); if (events & PURPLE_POUNCE_AWAY_RETURN) add_event_to_xmlnode(child, "return-from-away"); if (events & PURPLE_POUNCE_IDLE) add_event_to_xmlnode(child, "idle"); if (events & PURPLE_POUNCE_IDLE_RETURN) add_event_to_xmlnode(child, "return-from-idle"); if (events & PURPLE_POUNCE_TYPING) add_event_to_xmlnode(child, "start-typing"); if (events & PURPLE_POUNCE_TYPED) add_event_to_xmlnode(child, "typed"); if (events & PURPLE_POUNCE_TYPING_STOPPED) add_event_to_xmlnode(child, "stop-typing"); if (events & PURPLE_POUNCE_MESSAGE_RECEIVED) add_event_to_xmlnode(child, "message-received"); /* Write pounce actions */ child = purple_xmlnode_new_child(node, "actions"); g_hash_table_foreach(pounce->actions, action_parameter_list_to_xmlnode, child); if (purple_pounce_get_save(pounce)) purple_xmlnode_new_child(node, "save"); return node; }
static void purple_protocol_finalize(GObject *object) { PurpleProtocol *protocol = PURPLE_PROTOCOL(object); GList *accounts, *l; accounts = purple_accounts_get_all_active(); for (l = accounts; l != NULL; l = l->next) { PurpleAccount *account = PURPLE_ACCOUNT(l->data); if (purple_account_is_disconnected(account)) continue; if (purple_strequal(protocol->id, purple_account_get_protocol_id(account))) purple_account_disconnect(account); } g_list_free(accounts); purple_request_close_with_handle(protocol); purple_notify_close_with_handle(protocol); purple_signals_disconnect_by_handle(protocol); purple_signals_unregister_by_instance(protocol); purple_prefs_disconnect_by_handle(protocol); user_splits_free(protocol); account_options_free(protocol); icon_spec_free(protocol); PURPLE_DBUS_UNREGISTER_POINTER(protocol); parent_class->finalize(object); }
char * gevo_get_email_for_buddy(PurpleBuddy *buddy) { EContact *contact; char *mail = NULL; contact = gevo_search_buddy_in_contacts(buddy, NULL); if (contact != NULL) { mail = g_strdup(e_contact_get(contact, E_CONTACT_EMAIL_1)); g_object_unref(contact); } if (mail == NULL) { PurpleAccount *account = purple_buddy_get_account(buddy); const char *prpl_id = purple_account_get_protocol_id(account); if (!strcmp(prpl_id, "prpl-msn")) { mail = g_strdup(purple_normalize(account, purple_buddy_get_name(buddy))); } else if (!strcmp(prpl_id, "prpl-yahoo")) { mail = g_strdup_printf("*****@*****.**", purple_normalize(account, purple_buddy_get_name(buddy))); } } return mail; }
EContactField gevo_prpl_get_field(PurpleAccount *account, PurpleBuddy *buddy) { EContactField protocol_field = 0; const char *protocol_id; g_return_val_if_fail(account != NULL, 0); protocol_id = purple_account_get_protocol_id(account); if (!strcmp(protocol_id, "prpl-aim")) protocol_field = E_CONTACT_IM_AIM; else if (!strcmp(protocol_id, "prpl-icq")) protocol_field = E_CONTACT_IM_ICQ; else if (!strcmp(protocol_id, "prpl-msn")) protocol_field = E_CONTACT_IM_MSN; else if (!strcmp(protocol_id, "prpl-yahoo")) protocol_field = E_CONTACT_IM_YAHOO; else if (!strcmp(protocol_id, "prpl-jabber")) protocol_field = E_CONTACT_IM_JABBER; else if (!strcmp(protocol_id, "prpl-novell")) protocol_field = E_CONTACT_IM_GROUPWISE; else if (!strcmp(protocol_id, "prpl-gg")) protocol_field = E_CONTACT_IM_GADUGADU; return protocol_field; }
gboolean twitter_option_use_oauth(PurpleAccount * account) { if (!strcmp(purple_account_get_protocol_id(account), TWITTER_PROTOCOL_ID)) { return TRUE; } else { return purple_account_get_bool(account, TWITTER_PREF_USE_OAUTH, TWITTER_PREF_USE_OAUTH_DEFAULT); } }
const gchar *twitter_option_search_api_subdir(PurpleAccount * account) { if (!strcmp(purple_account_get_protocol_id(account), TWITTER_PROTOCOL_ID)) { return twitter_get_subdir_from_base(purple_account_get_string(account, TWITTER_PREF_SEARCH_API_BASE, TWITTER_PREF_SEARCH_API_BASE_DEFAULT)); } else { return twitter_get_subdir_from_base(purple_account_get_string(account, TWITTER_PREF_SEARCH_API_BASE, STATUSNET_PREF_API_BASE_DEFAULT)); } }