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


C++ purple_account_get_connection函数代码示例

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


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

示例1: msn_session_sync_users

static void
msn_session_sync_users(MsnSession *session)
{
	PurpleConnection *gc = purple_account_get_connection(session->account);
	GList *to_remove = NULL;
	GSList *buddies;

	g_return_if_fail(gc != NULL);

	/* The core used to use msn_add_buddy to add all buddies before
	 * being logged in. This no longer happens, so we manually iterate
	 * over the whole buddy list to identify sync issues.
	 */
	for (buddies = purple_find_buddies(session->account, NULL); buddies;
			buddies = g_slist_delete_link(buddies, buddies)) {
		PurpleBuddy *buddy = buddies->data;
		const gchar *buddy_name = purple_buddy_get_name(buddy);
		const gchar *group_name = purple_group_get_name(purple_buddy_get_group(buddy));
		MsnUser *remote_user;
		gboolean found = FALSE;

		remote_user = msn_userlist_find_user(session->userlist, buddy_name);
		if (remote_user && remote_user->list_op & MSN_LIST_FL_OP) {
			GList *l;
			for (l = remote_user->group_ids; l; l = l->next) {
				const char *name = msn_userlist_find_group_name(remote_user->userlist, l->data);
				if (name && !g_ascii_strcasecmp(group_name, name)) {
					found = TRUE;
					break;
				}
			}

			/* We don't care if they're in a different group, as long as they're on the
			 * list somewhere. If we check for the group, we cause pain, agony and
			 * suffering for people who decide to re-arrange their buddy list elsewhere.
			 */
			if (!found) {
				if ((remote_user == NULL) || !(remote_user->list_op & MSN_LIST_FL_OP)) {
					/* The user is not on the server list */
					msn_error_sync_issue(session, buddy_name, group_name);
				} else {
					/* The user is not in that group on the server list */
					to_remove = g_list_prepend(to_remove, buddy);
				}
			}
		}
	}

	if (to_remove != NULL) {
		g_list_foreach(to_remove, (GFunc)purple_blist_remove_buddy, NULL);
		g_list_free(to_remove);
	}
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:53,代码来源:session.c

示例2: purple_connection_get_protocol_data

static char *waprpl_status_text(PurpleBuddy * buddy)
{
	char *statusmsg;
	whatsapp_connection *wconn = purple_connection_get_protocol_data(purple_account_get_connection(purple_buddy_get_account(buddy)));
	if (!wconn)
		return 0;

	statusmsg = waAPI_getuserstatusstring(wconn->waAPI, purple_buddy_get_name(buddy));
	if (!statusmsg || strlen(statusmsg) == 0)
		return NULL;
	return statusmsg;
}
开发者ID:HackLabMX,项目名称:whatsapp-purple,代码行数:12,代码来源:wa_purple.c

示例3: oscar_auth_sendrequest_menu

void
oscar_auth_sendrequest_menu(PurpleBlistNode *node, gpointer ignored)
{
	PurpleBuddy *buddy;
	PurpleConnection *gc;

	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));

	buddy = (PurpleBuddy *) node;
	gc = purple_account_get_connection(purple_buddy_get_account(buddy));
	oscar_auth_sendrequest(gc, purple_buddy_get_name(buddy), NULL);
}
开发者ID:matyapiro31,项目名称:instantbird-1.5,代码行数:12,代码来源:authorization.c

示例4: adc_error

static void
adc_error(MsnCmdProc *cmdproc, MsnTransaction *trans, int error)
{
    MsnSession *session;
    PurpleAccount *account;
    PurpleConnection *gc;
    const char *list, *passport;
    const char *reason;
    char *msg = NULL;
    char **params;

    session = cmdproc->session;
    account = session->account;
    gc = purple_account_get_connection(account);
    params = g_strsplit(trans->params, " ", 0);

    list     = params[0];
    passport = params[1];

    if (!strcmp(list, "FL"))
        msg = pecan_strdup_printf(_("Unable to add user on %s (%s)"),
                                  purple_account_get_username(account),
                                  purple_account_get_protocol_name(account));
    else if (!strcmp(list, "BL"))
        msg = pecan_strdup_printf(_("Unable to block user on %s (%s)"),
                                  purple_account_get_username(account),
                                  purple_account_get_protocol_name(account));
    else if (!strcmp(list, "AL"))
        msg = pecan_strdup_printf(_("Unable to permit user on %s (%s)"),
                                  purple_account_get_username(account),
                                  purple_account_get_protocol_name(account));

    reason = pecan_error_to_string (error);

    if (msg != NULL)
    {
        purple_notify_error(gc, NULL, msg, reason);
        g_free(msg);
    }

    if (!strcmp(list, "FL"))
    {
        PurpleBuddy *buddy;

        buddy = purple_find_buddy(account, passport);

        if (buddy != NULL)
            purple_blist_remove_buddy(buddy);
    }

    g_strfreev(params);
}
开发者ID:deadcow,项目名称:msn-pecan,代码行数:52,代码来源:notification.c

示例5: irc_dccsend_network_listen_cb

static void
irc_dccsend_network_listen_cb(int sock, gpointer data)
{
	PurpleXfer *xfer = data;
	struct irc_xfer_send_data *xd;
	PurpleConnection *gc;
	struct irc_conn *irc;
	const char *arg[2];
	char *tmp;
	struct in_addr addr;
	unsigned short int port;

	xd = xfer->data;
	xd->listen_data = NULL;

	if (purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_LOCAL
			|| purple_xfer_get_status(xfer) == PURPLE_XFER_STATUS_CANCEL_REMOTE) {
		purple_xfer_unref(xfer);
		return;
	}

	xd = xfer->data;
	gc = purple_account_get_connection(purple_xfer_get_account(xfer));
	irc = gc->proto_data;

	purple_xfer_unref(xfer);

	if (sock < 0) {
		purple_notify_error(gc, NULL, _("File Transfer Failed"),
		                  _("Could not open a listening port."));
		purple_xfer_cancel_local(xfer);
		return;
	}

	xd->fd = sock;

	port = purple_network_get_port_from_fd(sock);
	purple_debug_misc("irc", "port is %hu\n", port);
	/* Monitor the listening socket */
	xfer->watcher = purple_input_add(sock, PURPLE_INPUT_READ,
	                               irc_dccsend_send_connected, xfer);

	/* Send the intended recipient the DCC request */
	arg[0] = xfer->who;
	inet_aton(purple_network_get_my_ip(irc->fd), &addr);
	arg[1] = tmp = g_strdup_printf("\001DCC SEND \"%s\" %u %hu %" G_GSIZE_FORMAT "\001",
	                         xfer->filename, ntohl(addr.s_addr),
	                         port, xfer->size);

	irc_cmd_privmsg(gc->proto_data, "msg", NULL, arg);
	g_free(tmp);
}
开发者ID:arminius2,项目名称:apolloim,代码行数:52,代码来源:dcc_send.c

示例6: irc_msg_join

void irc_msg_join(struct irc_conn *irc, const char *name, const char *from, char **args)
{
	PurpleConnection *gc = purple_account_get_connection(irc->account);
	PurpleConversation *convo;
	char *nick = irc_mask_nick(from), *userhost;
	struct irc_buddy *ib;
	static int id = 1;

	if (!gc) {
		g_free(nick);
		return;
	}

	if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
		/* We are joining a channel for the first time */
		serv_got_joined_chat(gc, id++, args[0]);
		g_free(nick);
		convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT,
							    args[0],
							    irc->account);

		if (convo == NULL) {
			purple_debug_error("irc", "tried to join %s but couldn't\n", args[0]);
			return;
		}
		purple_conversation_set_data(convo, IRC_NAMES_FLAG,
					   GINT_TO_POINTER(FALSE));
		/* Until purple_conversation_present does something that
		 * one would expect in Pidgin, this call produces buggy
		 * behavior both for the /join and auto-join cases. */
		/* purple_conversation_present(convo); */
		return;
	}

	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
	if (convo == NULL) {
		purple_debug(PURPLE_DEBUG_ERROR, "irc", "JOIN for %s failed\n", args[0]);
		g_free(nick);
		return;
	}

	userhost = irc_mask_userhost(from);
	purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), nick, userhost, PURPLE_CBFLAGS_NONE, TRUE);

	if ((ib = g_hash_table_lookup(irc->buddies, nick)) != NULL) {
		ib->flag = TRUE;
		irc_buddy_status(nick, ib, irc);
	}

	g_free(userhost);
	g_free(nick);
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:52,代码来源:msgs.c

示例7: bonjour_bytestreams_connect

static void
bonjour_bytestreams_connect(PurpleXfer *xfer)
{
	PurpleBuddy *pb;
	PurpleAccount *account = NULL;
	XepXfer *xf;
	char dstaddr[41];
	const gchar *name = NULL;
	unsigned char hashval[20];
	char *p;
	int i;

	if(xfer == NULL)
		return;

	purple_debug_info("bonjour", "bonjour-bytestreams-connect.\n");

	xf = (XepXfer*)xfer->data;
	if(!xf)
		return;

	pb = xf->pb;
	name = purple_buddy_get_name(pb);
	account = purple_buddy_get_account(pb);

	p = g_strdup_printf("%s%s%s", xf->sid, name, bonjour_get_jid(account));
	purple_cipher_digest_region("sha1", (guchar *)p, strlen(p),
				    sizeof(hashval), hashval, NULL);
	g_free(p);

	memset(dstaddr, 0, 41);
	p = dstaddr;
	for(i = 0; i < 20; i++, p += 2)
		snprintf(p, 3, "%02x", hashval[i]);

	xf->proxy_info = purple_proxy_info_new();
	purple_proxy_info_set_type(xf->proxy_info, PURPLE_PROXY_SOCKS5);
	purple_proxy_info_set_host(xf->proxy_info, xf->proxy_host);
	purple_proxy_info_set_port(xf->proxy_info, xf->proxy_port);
	xf->proxy_connection = purple_proxy_connect_socks5_account(
							   purple_account_get_connection(account),
							   account,
							   xf->proxy_info,
							   dstaddr, 0,
							   bonjour_bytestreams_connect_cb, xfer);

	if(xf->proxy_connection == NULL) {
		xep_ft_si_reject(xf->data, xf->iq_id, xfer->who, "404", "cancel");
		/* Cancel the connection */
		purple_xfer_cancel_local(xfer);
	}
}
开发者ID:dylex,项目名称:pidgin,代码行数:52,代码来源:bonjour_ft.c

示例8: stress_login

static void
stress_login(PurpleAccount *account) {
	PurpleConnection *pc = NULL;
	PurpleGroup *g = NULL;
	gint n_buddies = 0, i = 0, interval = 0, maxevents = 0;

	/* build our possible events from the account settings */
	add_event("trigger_signon", STRESS_EVENT_SIGN_ON, STRESS_EVENT_SIGN_OFF);
	add_event("trigger_idle", STRESS_EVENT_IDLE, STRESS_EVENT_UNIDLE);
	add_event("trigger_away", STRESS_EVENT_AWAY, STRESS_EVENT_BACK);
	add_event("trigger_typing", STRESS_EVENT_TYPING, STRESS_EVENT_STOPPED_TYPING);
	add_event("send_messages", STRESS_EVENT_SEND_MESSAGE, -1);

	nevents = g_list_length(events);

	/* get our connection and set it as online */
	pc = purple_account_get_connection(account);
	purple_connection_set_state(pc, PURPLE_CONNECTED);

	/* grab the account settings we need for buddies */
	n_buddies = purple_account_get_int(account, "nbuddies", 50);
	maxevents = purple_account_get_int(account, "maxevents", 100);
	interval = (guint)purple_account_get_int(account, "interval", 500);
	message_min = purple_account_get_int(account, "message_min", 16);
	message_max = purple_account_get_int(account, "message_max", 128);

	g = purple_group_new("prpl-stress");

	for(i = 0; i < n_buddies; i++) {
		PurpleBuddy *b = NULL;
		StressBuddy *sb = NULL;
		gchar *name = NULL;

		/* create the buddy and it's name */
		name = g_strdup_printf("stress-%04x", i);
		b = purple_buddy_new(account, name, NULL);
		g_free(name);

		/* add our data to the buddy */
		sb = g_new0(StressBuddy, 1);
		sb->buddy = b;
		sb->maxevents = maxevents;
		purple_buddy_set_protocol_data(b, sb);

		/* add the buddy to our list and the purple blist */
		buddies = g_list_prepend(buddies, sb);
		purple_blist_add_buddy(b, NULL, g, NULL);

		/* add our event timer to the buddy */
		sb->timer_id = g_timeout_add(interval, stress_event_cb, sb);
	}
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:52,代码来源:stress.c

示例9: tgprpl_roomlist_cancel

void tgprpl_roomlist_cancel (PurpleRoomlist *list) {
  PurpleConnection *gc = purple_account_get_connection (list->account);
  if (! gc) {
    return;
  }
  
  connection_data *conn = purple_connection_get_protocol_data (gc);
  purple_roomlist_set_in_progress (list, FALSE);
  if (conn->roomlist == list) {
    conn->roomlist = NULL;
    purple_roomlist_unref (list);
  }
}
开发者ID:Houlbek,项目名称:telegram-purple,代码行数:13,代码来源:tgp-chat.c

示例10: yahoo_doodle_send_draw_list

void yahoo_doodle_send_draw_list(PurpleWhiteboard *wb, GList *draw_list)
{
	PurpleAccount *account = purple_whiteboard_get_account(wb);
	PurpleConnection *gc = purple_account_get_connection(account);
	doodle_session *ds = purple_whiteboard_get_protocol_data(wb);
	char *message;

	g_return_if_fail(draw_list != NULL);

	message = yahoo_doodle_build_draw_string(ds, draw_list);
	yahoo_doodle_command_send_draw(gc, purple_whiteboard_get_who(wb), message, ds->imv_key);
	g_free(message);
}
开发者ID:N8Fear,项目名称:purple-facebook,代码行数:13,代码来源:yahoo_doodle.c

示例11: silcpurple_buddy_getkey_menu

static void
silcpurple_buddy_getkey_menu(PurpleBlistNode *node, gpointer data)
{
	PurpleBuddy *buddy;
	PurpleConnection *gc;

	g_return_if_fail(PURPLE_BLIST_NODE_IS_BUDDY(node));

	buddy = (PurpleBuddy *) node;
	gc = purple_account_get_connection(buddy->account);

	silcpurple_buddy_getkey(gc, buddy->name);
}
开发者ID:dylex,项目名称:pidgin,代码行数:13,代码来源:buddy.c

示例12: netsoul_set_away

static void netsoul_set_away(PurpleAccount *account, PurpleStatus* status)
{
  int	ns_state;
  PurplePresence* state = purple_status_get_presence (status);

  if (purple_presence_is_available (state))
    ns_state = NS_STATE_ACTIF;
  else if (purple_presence_is_idle (state))
    ns_state = NS_STATE_IDLE;
  else
    ns_state = NS_STATE_AWAY;
  ns_send_state(purple_account_get_connection (account), ns_state, time(NULL));
}
开发者ID:Bocaa,项目名称:netsoul-purple,代码行数:13,代码来源:netsoul.c

示例13: yahoo_doodle_end

void yahoo_doodle_end(PurpleWhiteboard *wb)
{
	PurpleConnection *gc = purple_account_get_connection(wb->account);
	doodle_session *ds = wb->proto_data;

	/* g_debug_debug("yahoo", "doodle: yahoo_doodle_end()\n"); */

	if (gc && wb->state != DOODLE_STATE_CANCELLED)
		yahoo_doodle_command_send_shutdown(gc, wb->who);

	g_free(ds->imv_key);
	g_free(wb->proto_data);
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:13,代码来源:yahoo_doodle.c

示例14: notify_button_activated

static void
notify_button_activated(GntWidget *widget, PurpleNotifySearchButton *b)
{
	GList *list = NULL;
	PurpleAccount *account = g_object_get_data(G_OBJECT(widget), "notify-account");
	gpointer data = g_object_get_data(G_OBJECT(widget), "notify-data");

	list = gnt_tree_get_selection_text_list(GNT_TREE(g_object_get_data(G_OBJECT(widget), "notify-tree")));

	b->callback(purple_account_get_connection(account), list, data);
	g_list_foreach(list, (GFunc)g_free, NULL);
	g_list_free(list);
}
开发者ID:Draghtnod,项目名称:pidgin,代码行数:13,代码来源:gntnotify.c

示例15: iln_cmd

static void
iln_cmd(MsnCmdProc *cmdproc, MsnCommand *cmd)
{
    MsnSession *session;
    PurpleAccount *account;
    PurpleConnection *gc;
    PecanContact *user;
#if defined(PECAN_CVR)
    MsnObject *msnobj;
#endif /* defined(PECAN_CVR) */
    const char *state, *passport;
    gchar *friendly;

    session = cmdproc->session;
    account = session->account;
    gc = purple_account_get_connection(account);

    state    = cmd->params[1];
    passport = cmd->params[2];
    friendly = pecan_url_decode(cmd->params[3]);

    user = pecan_contactlist_find_contact(session->contactlist, passport);

    pecan_contact_set_state(user, state);
    pecan_contact_set_friendly_name(user, friendly);

    if (cmd->param_count >= 5)
    {
        gulong client_id;
        client_id = atol (cmd->params[4]);
        pecan_contact_set_client_id (user, client_id);
    }

#if defined(PECAN_CVR)
    if (session->use_userdisplay)
    {
        if (cmd->param_count == 6)
        {
            gchar *tmp;
            tmp = pecan_url_decode (cmd->params[5]);
            msnobj = msn_object_new_from_string (tmp);
            pecan_contact_set_object(user, msnobj);
            g_free (tmp);
        }
    }
#endif /* defined(PECAN_CVR) */

    pecan_contact_update(user);

    g_free (friendly);
}
开发者ID:deadcow,项目名称:msn-pecan,代码行数:51,代码来源:notification.c


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