当前位置: 首页>>代码示例>>C++>>正文


C++ purple_account_get_protocol_id函数代码示例

本文整理汇总了C++中purple_account_get_protocol_id函数的典型用法代码示例。如果您正苦于以下问题:C++ purple_account_get_protocol_id函数的具体用法?C++ purple_account_get_protocol_id怎么用?C++ purple_account_get_protocol_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了purple_account_get_protocol_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: compare_protocol

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
	);
}
开发者ID:kgraefe,项目名称:pidgin-extended-blist-sort,代码行数:30,代码来源:sort_methods.c

示例2: write_conv

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);
    }
  }
}
开发者ID:strelok1111,项目名称:purple_ruby,代码行数:26,代码来源:purple_ruby.c

示例3: call_if_nullprpl

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);
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:7,代码来源:nullprpl.c

示例4: purple_accounts_find_ext

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;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:33,代码来源:dbus-useful.c

示例5: purple_connection_get_account

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 );
    }

}
开发者ID:benquike,项目名称:emacs.d,代码行数:30,代码来源:connections_ui_ops.c

示例6: purple_debug_set_enabled

	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 ());
	}
开发者ID:ForNeVeR,项目名称:leechcraft,代码行数:60,代码来源:protomanager.cpp

示例7: otrg_buddy_prefs_get_policy

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;
}
开发者ID:N8Fear,项目名称:pidgin-otr,代码行数:29,代码来源:common.c

示例8: signed_on

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));

}
开发者ID:ghetzel,项目名称:zee,代码行数:7,代码来源:basic.c

示例9: g_string_new

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);
}
开发者ID:jonyamo,项目名称:centerim5,代码行数:29,代码来源:AccountWindow.cpp

示例10: g_new0

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;
}
开发者ID:nogoth,项目名称:emacs-setup,代码行数:35,代码来源:account_ui_ops.c

示例11: insert_status_change_from_purple_status

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);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:27,代码来源:cap.c

示例12: insert_cap_success

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;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:26,代码来源:cap.c

示例13: twitter_get_list_parse_statuses

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);
}
开发者ID:FourthDr,项目名称:prpltwtr,代码行数:33,代码来源:prpltwtr_endpoint_list.c

示例14: twitter_send_xml_request_with_cursor_cb

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);
    }
}
开发者ID:FourthDr,项目名称:prpltwtr,代码行数:29,代码来源:prpltwtr_request.c

示例15: otrg_conversation_get_contexts

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;
}
开发者ID:N8Fear,项目名称:pidgin-otr,代码行数:33,代码来源:common.c


注:本文中的purple_account_get_protocol_id函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。