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


C++ purple_connection_get_account函数代码示例

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


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

示例1: qq_room_data_initial

/* this should be called upon signin, even when we did not open group chat window */
void qq_room_data_initial(PurpleConnection *gc)
{
	PurpleAccount *account;
	PurpleChat *chat;
	PurpleGroup *purple_group;
	PurpleBlistNode *node;
	qq_data *qd;
	qq_room_data *rmd;
	gint count;

	account = purple_connection_get_account(gc);
	qd = (qq_data *) gc->proto_data;

	purple_debug_info("QQ", "Initial QQ Qun configurations\n");
	purple_group = purple_find_group(PURPLE_GROUP_QQ_ROOM);
	if (purple_group == NULL) {
		purple_debug_info("QQ", "We have no QQ Qun\n");
		return;
	}

	count = 0;
	for (node = purple_blist_node_get_first_child((PurpleBlistNode *)purple_group);
	     node != NULL;
		 node = purple_blist_node_get_sibling_next(node))
	{
		if ( !PURPLE_BLIST_NODE_IS_CHAT(node)) {
			continue;
		}
		/* got one */
		chat = (PurpleChat *) node;
		if (account != purple_chat_get_account(chat))	/* not qq account*/
			continue;

		rmd = room_data_new_by_hashtable(gc, purple_chat_get_components(chat));
		rmd->my_role = QQ_ROOM_ROLE_NO;		//now set all old qun data detached 'cause we don't know if we are still in
		qd->rooms = g_slist_append(qd->rooms, rmd);
		count++;
	}

	purple_debug_info("QQ", "Load %d QQ Qun configurations\n", count);
}
开发者ID:1dot75cm,项目名称:pidgin-libqq,代码行数:42,代码来源:group_internal.c

示例2: ggp_avatar_own_got_token

static void
ggp_avatar_own_got_token(PurpleConnection *gc, const gchar *token,
                         gpointer _img)
{
    PurpleHttpRequest *req;
    PurpleImage *img = _img;
    ggp_avatar_own_data *own_data = ggp_avatar_get_avdata(gc)->own_data;
    gchar *img_data, *img_data_e, *request_data;
    PurpleAccount *account = purple_connection_get_account(gc);
    uin_t uin = ggp_str_to_uin(purple_account_get_username(account));

    if (img != own_data->img) {
        purple_debug_warning("gg", "ggp_avatar_own_got_token: "
                             "avatar was changed in meantime\n");
        return;
    }
    own_data->img = NULL;

    img_data = purple_base64_encode(purple_image_get_data(img),
                                    purple_image_get_size(img));
    img_data_e = g_uri_escape_string(img_data, NULL, FALSE);
    g_free(img_data);
    request_data = g_strdup_printf("uin=%d&photo=%s", uin, img_data_e);
    g_free(img_data_e);

    purple_debug_misc("gg", "ggp_avatar_own_got_token: "
                      "uploading new avatar...\n");

    req = purple_http_request_new("http://avatars.nowe.gg/upload");
    purple_http_request_set_max_len(req, GGP_AVATAR_RESPONSE_MAX);
    purple_http_request_set_method(req, "POST");
    purple_http_request_header_set(req, "Authorization", token);
    purple_http_request_header_set(req, "From", "avatars to avatars");
    purple_http_request_header_set(req, "Content-Type",
                                   "application/x-www-form-urlencoded");
    purple_http_request_set_contents(req, request_data, -1);
    purple_http_request(gc, req, ggp_avatar_own_sent, NULL);
    purple_http_request_unref(req);

    g_free(request_data);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:41,代码来源:avatar.c

示例3: ggp_edisc_xfer_send_new

PurpleXfer * ggp_edisc_xfer_send_new(PurpleConnection *gc, const char *who)
{
	PurpleXfer *xfer;
	ggp_edisc_xfer *edisc_xfer;

	g_return_val_if_fail(gc != NULL, NULL);
	g_return_val_if_fail(who != NULL, NULL);

	xfer = purple_xfer_new(purple_connection_get_account(gc),
		PURPLE_XFER_TYPE_SEND, who);
	edisc_xfer = g_new0(ggp_edisc_xfer, 1);
	purple_xfer_set_protocol_data(xfer, edisc_xfer);

	edisc_xfer->gc = gc;

	purple_xfer_set_init_fnc(xfer, ggp_edisc_xfer_send_init);
	purple_xfer_set_start_fnc(xfer, ggp_edisc_xfer_send_start);
	purple_xfer_set_cancel_send_fnc(xfer, ggp_edisc_xfer_cancel);

	return xfer;
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:21,代码来源:edisc.c

示例4: yahoo_ft_new_xfer_struct

static PurpleXfer *
yahoo_ft_new_xfer_struct(PurpleConnection *gc, PurpleXferType type, const char *who)
{
	PurpleXfer *xfer;

	g_return_val_if_fail(gc != NULL, NULL);
	g_return_val_if_fail(who != NULL, NULL);

	xfer = purple_xfer_new(purple_connection_get_account(gc), type, who);

	g_return_val_if_fail(xfer != NULL, NULL);

	purple_xfer_set_init_fnc(xfer, yahoo_xfer_init_15);
	purple_xfer_set_start_fnc(xfer, yahoo_xfer_start);
	purple_xfer_set_end_fnc(xfer, yahoo_xfer_end);
	purple_xfer_set_cancel_send_fnc(xfer, yahoo_xfer_cancel_send);
	purple_xfer_set_cancel_recv_fnc(xfer, yahoo_xfer_cancel_recv);
	purple_xfer_set_request_denied_fnc(xfer, yahoo_xfer_cancel_recv);

	return xfer;
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:21,代码来源:yahoo_filexfer.c

示例5: nullprpl_chat_send

static int nullprpl_chat_send(PurpleConnection *gc, int id, const char *message,
                              PurpleMessageFlags flags) {
  const char *username = purple_account_get_username(purple_connection_get_account(gc));
  PurpleChatConversation *chat = purple_conversations_find_chat(gc, id);

  if (chat) {
    purple_debug_info("nullprpl",
                      "%s is sending message to chat room %s: %s\n", username,
                      purple_conversation_get_name(PURPLE_CONVERSATION(chat)), message);

    /* send message to everyone in the chat room */
    foreach_gc_in_chat(receive_chat_message, gc, id, (gpointer)message);
    return 0;
  } else {
    purple_debug_info("nullprpl",
                      "tried to send message from %s to chat room #%d: %s\n"
                      "but couldn't find chat room",
                      username, id, message);
    return -1;
  }
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:21,代码来源:nullprpl.c

示例6: waprpl_send_chat

static int waprpl_send_chat(PurpleConnection * gc, int id, const char *message, PurpleMessageFlags flags)
{
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	PurpleAccount *account = purple_connection_get_account(gc);
	PurpleConversation *convo = purple_find_chat(gc, id);
	PurpleChat *ch = blist_find_chat_by_convo(gc, id);
	GHashTable *hasht = purple_chat_get_components(ch);
	char *chat_id = g_hash_table_lookup(hasht, "id");
	char *plain;

	purple_markup_html_to_xhtml(message, NULL, &plain);
	waAPI_sendchat(wconn->waAPI, chat_id, plain);
	g_free(plain);

	waprpl_check_output(gc);

	const char *me = purple_account_get_string(account, "nick", "");
	purple_conv_chat_write(PURPLE_CONV_CHAT(convo), me, message, PURPLE_MESSAGE_SEND, time(NULL));

	return 1;
}
开发者ID:magicalbanana,项目名称:whatsapp-purple,代码行数:21,代码来源:wa_purple.c

示例7: yahoo_ft_url_gen

static gchar *
yahoo_ft_url_gen(PurpleXfer *xfer, const gchar *host)
{
	struct yahoo_xfer_data *xfer_data;
	PurpleAccount *account;

	g_return_val_if_fail(host != NULL, NULL);

	xfer_data = purple_xfer_get_protocol_data(xfer);
	account = purple_connection_get_account(xfer_data->gc);

	if (!xfer_data->is_relay) {
		purple_debug_fatal("yahoo", "Non-relay FT aren't tested yet\n");
		return NULL;
	}

	return g_strdup_printf("http://%s/relay?token=%s&sender=%s&recver=%s",
		host, purple_url_encode(xfer_data->xfer_idstring_for_relay),
		purple_normalize(account, purple_account_get_username(account)),
		purple_xfer_get_remote_user(xfer));
}
开发者ID:ArmoredPidgin,项目名称:pidgin-hardened,代码行数:21,代码来源:yahoo_filexfer.c

示例8: waprpl_check_output

/* Checks if the WA protocol has data to output and schedules a write handler */
static void waprpl_check_output(PurpleConnection * gc)
{
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
	if (wconn->fd < 0)
		return;

	if (waAPI_hasoutdata(wconn->waAPI) > 0) {
		/* Need to watch for output data (if we are not doing it already) */
		if (wconn->wh == 0)
			wconn->wh = purple_input_add(wconn->fd, PURPLE_INPUT_WRITE, waprpl_output_cb, gc);
	} else {
		if (wconn->wh != 0)
			purple_input_remove(wconn->wh);

		wconn->wh = 0;
	}

	check_ssl_requests(purple_connection_get_account(gc));
	
	waprpl_check_complete_uploads(gc);
}
开发者ID:magicalbanana,项目名称:whatsapp-purple,代码行数:22,代码来源:wa_purple.c

示例9: ycht_connection_open

void ycht_connection_open(PurpleConnection *gc)
{
	YchtConn *ycht;
	YahooData *yd = purple_connection_get_protocol_data(gc);
	PurpleAccount *account = purple_connection_get_account(gc);

	ycht = g_new0(YchtConn, 1);
	ycht->gc = gc;
	ycht->fd = -1;

	yd->ycht = ycht;

	if (purple_proxy_connect(gc, account,
	                       purple_account_get_string(account, "ycht-server",  YAHOO_YCHT_HOST),
	                       purple_account_get_int(account, "ycht-port", YAHOO_YCHT_PORT),
	                       ycht_got_connected, ycht) == NULL)
	{
		ycht_connection_error(ycht, _("Unable to connect"));
		return;
	}
}
开发者ID:Distrotech,项目名称:pidgin,代码行数:21,代码来源:ycht.c

示例10: fb_mqtt_open

void
fb_mqtt_open(FbMqtt *mqtt, const gchar *host, gint port)
{
	FbMqttPrivate *priv;
	PurpleAccount *acc;

	g_return_if_fail(FB_IS_MQTT(mqtt));
	priv = mqtt->priv;

	acc = purple_connection_get_account(priv->gc);
	fb_mqtt_close(mqtt);
	priv->gsc = purple_ssl_connect(acc, host, port, fb_mqtt_cb_open,
	                               fb_mqtt_cb_open_error, mqtt);

	if (priv->gsc == NULL) {
		fb_mqtt_cb_open_error(NULL, 0, mqtt);
		return;
	}

	fb_mqtt_timeout(mqtt);
}
开发者ID:duxet,项目名称:adium-facebook,代码行数:21,代码来源:mqtt.c

示例11: waprpl_connect_cb

static void waprpl_connect_cb(gpointer data, gint source, const gchar * error_message)
{
	PurpleConnection *gc = data;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);

	PurpleAccount *acct = purple_connection_get_account(gc);
	const char *resource = purple_account_get_string(acct, "resource", default_resource);

	if (source < 0) {
		gchar *tmp = g_strdup_printf("Unable to connect: %s", error_message);
		purple_connection_error_reason(gc, PURPLE_CONNECTION_ERROR_NETWORK_ERROR, tmp);
		g_free(tmp);
	} else {
		wconn->fd = source;
		waAPI_login(wconn->waAPI, resource);
		wconn->rh = purple_input_add(wconn->fd, PURPLE_INPUT_READ, waprpl_input_cb, gc);
		wconn->timer = purple_timeout_add_seconds(20, wa_timer_cb, gc);

		waprpl_check_output(gc);
	}
}
开发者ID:jab15pm,项目名称:whatsapp-purple,代码行数:21,代码来源:wa_purple.c

示例12: spin_sync_buddy

static PurpleBuddy* spin_sync_buddy(SpinData* spin,
				    GSList* buddies,const gchar* id,
				    const gchar* name,guint online,
				    const gchar* away,const gchar* photo)
{
  PurpleAccount* account = purple_connection_get_account(spin->gc);
  /* gchar* lower_name = g_utf8_strdown(name,-1); */
  PurpleBuddy* buddy = spin_find_buddy_in_list(buddies,id);
  if(!buddy)
    {
      purple_debug_info("spin","adding buddy: %s\n",/*lower_*/name);
      buddy = purple_buddy_new(account,/*lower_*/name,NULL);
      purple_blist_add_buddy(buddy,NULL,NULL,NULL);
      purple_blist_node_set_string(&buddy->node,"spin-id",id);
    }
  /* purple_normalize here? */
  if(g_strcmp0(purple_buddy_get_name(buddy),name) != 0)
    {
      spin_notify_nick_changed(spin,purple_buddy_get_name(buddy),name);
      purple_blist_rename_buddy(buddy,name);
    }

  spin_sync_photo(spin,buddy,photo);

  /* do not set status if we got a status after the HTTP request */
  if(g_hash_table_lookup(spin->updated_status_list,
			 purple_normalize(account,name)))
    return buddy;

  if(online && *away)
    purple_prpl_got_user_status(account,/*lower_*/name,"away",
				"message",away,NULL);
  else if(online)
    purple_prpl_got_user_status(account,/*lower_*/name,"available",NULL);
  else
    purple_prpl_got_user_status(account,/*lower_*/name,"offline",NULL);

  return buddy;
  /* g_free(lower_name); */
}
开发者ID:thomas001,项目名称:purple-spin,代码行数:40,代码来源:spin_friends.c

示例13: qq_room_get_next_conv

guint32 qq_room_get_next_conv(PurpleConnection *gc, guint32 room_id)
{
	GSList *list;
	qq_room_data *rmd;
	qq_data *qd;
	gboolean is_find;

	qd = (qq_data *) gc->proto_data;

 	list = qd->rooms;
	if (room_id > 0) {
		/* search next room */
		is_find = FALSE;
		while (list != NULL) {
			rmd = (qq_room_data *) list->data;
			list = list->next;
			if (rmd->id == room_id) {
				is_find = TRUE;
				break;
			}
		}
		g_return_val_if_fail(is_find, 0);
	}

	while (list != NULL) {
		rmd = (qq_room_data *) list->data;
		g_return_val_if_fail(rmd != NULL, 0);

		if (rmd->my_role == QQ_ROOM_ROLE_YES || rmd->my_role == QQ_ROOM_ROLE_ADMIN) {
			if (NULL != purple_find_conversation_with_account(
						PURPLE_CONV_TYPE_CHAT,rmd->name, purple_connection_get_account(gc))) {
				/* In convseration*/
				return rmd->id;
			}
		}
		list = list->next;
	}

	return 0;
}
开发者ID:1dot75cm,项目名称:pidgin-libqq,代码行数:40,代码来源:group_internal.c

示例14: create_account_field

static GntWidget*
create_account_field(PurpleRequestField *field)
{
	gboolean all;
	PurpleAccount *def;
	GList *list;
	GntWidget *combo = gnt_combo_box_new();

	all = purple_request_field_account_get_show_all(field);
	def = purple_request_field_account_get_value(field);
	if (!def)
		def = purple_request_field_account_get_default_value(field);

	if (all)
		list = purple_accounts_get_all();
	else
		list = purple_connections_get_all();

	for (; list; list = list->next)
	{
		PurpleAccount *account;
		char *text;

		if (all)
			account = list->data;
		else
			account = purple_connection_get_account(list->data);

		text = g_strdup_printf("%s (%s)",
				purple_account_get_username(account),
				purple_account_get_protocol_name(account));
		gnt_combo_box_add_data(GNT_COMBO_BOX(combo), account, text);
		g_free(text);
		if (account == def)
			gnt_combo_box_set_selected(GNT_COMBO_BOX(combo), account);
	}
	gnt_widget_set_size(combo, 20, 3); /* ew */
	return combo;
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:39,代码来源:gntrequest.c

示例15: _elim_notice

static void _elim_notice ( PurpleConnection *conn, const char *msg )
{
    PurpleAccount *acct = purple_connection_get_account( conn );
    if( acct )
    {
        char       *ID    = new_elim_id();
        xmlnode    *alist = xnode_new( "alist" );
        xmlnode    *mcall = func_call( "elim-connection-state", 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"     , msg   );
        AL_ENUM( alist, "state"       , state , ":connection-state" );

        add_outbound_sexp( mcall );
    }
}
开发者ID:benquike,项目名称:emacs.d,代码行数:22,代码来源:connections_ui_ops.c


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