• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ PURPLE_CONV_CHAT函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: member_update

/*------------------------------------------------------------------------
 * Update the full GroupChat member list.
 *
 *  @param session		The MXit session object
 *  @param multimx		The MultiMX room object
 *  @param data			The nicknames of the users in the room (separated by \n)
 */
static void member_update(struct MXitSession* session, struct multimx* multimx, char* data)
{
	PurpleConversation *convo;
	gchar** userlist;
	int i = 0;

	purple_debug_info(MXIT_PLUGIN_ID, "member_update: '%s'\n", data);

	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, multimx->roomname, session->acc);
	if (convo == NULL) {
		purple_debug_error(MXIT_PLUGIN_ID, "Conversation '%s' not found\n", multimx->roomname);
		return;
	}

	/* Clear list */
	purple_conv_chat_clear_users(PURPLE_CONV_CHAT(convo));

	/* Add each member */
	data = g_strstrip(data);				/* string leading & trailing whitespace */
	userlist = g_strsplit(data, "\n", 0);	/* tokenize string */
	while (userlist[i] != NULL) {
		purple_debug_info(MXIT_PLUGIN_ID, "member_update - adding: '%s'\n", userlist[i]);
		purple_conv_chat_add_user(PURPLE_CONV_CHAT(convo), userlist[i], NULL, PURPLE_CBFLAGS_NONE, FALSE);
		i++;
	}
	g_strfreev(userlist);
}
开发者ID:crodjer,项目名称:pidgin_whiteboard,代码行数:34,代码来源:multimx.c


示例2: yahoo_c_send

int yahoo_c_send(PurpleConnection *gc, int id, const char *what, PurpleMessageFlags flags)
{
	PurpleConversation *c;
	int ret;
	YahooData *yd;

	yd = (YahooData *) gc->proto_data;
	if (!yd)
		return -1;

	c = purple_find_chat(gc, id);
	if (!c)
		return -1;

	if (id != YAHOO_CHAT_ID) {
		ret = yahoo_conf_send(gc, purple_connection_get_display_name(gc),
				purple_conversation_get_name(c), purple_conv_chat_get_users(PURPLE_CONV_CHAT(c)), what);
	} else {
		ret = yahoo_chat_send(gc, purple_connection_get_display_name(gc),
						purple_conversation_get_name(c), what, flags);
		if (!ret)
			serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(c)),
					purple_connection_get_display_name(gc), flags, what, time(NULL));
	}
	return ret;
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:26,代码来源:yahoochat.c


示例3: yahoo_process_conference_logon

void yahoo_process_conference_logon(PurpleConnection *gc, struct yahoo_packet *pkt)
{
	GSList *l;
	char *room = NULL;
	char *who = NULL;
	PurpleConversation *c;

	for (l = pkt->hash; l; l = l->next) {
		struct yahoo_pair *pair = l->data;

		switch (pair->key) {
		case 57:
			g_free(room);
			room = yahoo_string_decode(gc, pair->value, FALSE);
			break;
		case 53:
			who = pair->value;
			break;
		}
	}

	if (who && room) {
		c = yahoo_find_conference(gc, room);
		if (c)
		{	/* Prevent duplicate users in the chat */
			if( !purple_conv_chat_find_user(PURPLE_CONV_CHAT(c), who) )
				yahoo_chat_add_user(PURPLE_CONV_CHAT(c), who, NULL);
		}
		g_free(room);
	}
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:31,代码来源:yahoochat.c


示例4: hon_parse_channel_auth_list

void hon_parse_channel_auth_list(PurpleConnection *gc,gchar* buffer)
{
    PurpleConversation* chat;
    guint32 count,chatid = read_guint32(buffer);
    count = read_guint32(buffer);
    chat = purple_find_chat(gc,chatid);
    if (!chat)
        return;
    purple_conv_chat_write(PURPLE_CONV_CHAT(chat), "", 
        _("Listing Authorized Users..."),
        PURPLE_MESSAGE_SYSTEM, time(NULL));
    if (count == 0)
    {
        purple_conv_chat_write(PURPLE_CONV_CHAT(chat), "", 
            _("There are no authorized users for this channel."),
            PURPLE_MESSAGE_SYSTEM, time(NULL));
    } 
    else
    {
        while (count--)
        {
            purple_conv_chat_write(PURPLE_CONV_CHAT(chat), "", 
                buffer,
                PURPLE_MESSAGE_SYSTEM, time(NULL));
            read_string(buffer);
        }
    }
    
}
开发者ID:theli-ua,项目名称:honpurple,代码行数:29,代码来源:hon.c


示例5: irc_msg_kick

void irc_msg_kick(struct irc_conn *irc, const char *name, const char *from, char **args)
{
	PurpleConnection *gc = purple_account_get_connection(irc->account);
	PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, args[0], irc->account);
	char *nick = irc_mask_nick(from), *buf;

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

	if (!convo) {
		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Recieved a KICK for unknown channel %s\n", args[0]);
		g_free(nick);
		return;
	}

	if (!purple_utf8_strcasecmp(purple_connection_get_display_name(gc), args[1])) {
		buf = g_strdup_printf(_("You have been kicked by %s: (%s)"), nick, args[2]);
		purple_conv_chat_write(PURPLE_CONV_CHAT(convo), args[0], buf, PURPLE_MESSAGE_SYSTEM, time(NULL));
		g_free(buf);
		serv_got_chat_left(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)));
	} else {
		buf = g_strdup_printf(_("Kicked by %s (%s)"), nick, args[2]);
		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), args[1], buf);
		g_free(buf);
	}

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


示例6: jabber_chat_change_topic

/* merge this with the function below when we get everyone on the same page wrt /commands */
void jabber_chat_change_topic(JabberChat *chat, const char *topic)
{
	if(topic && *topic) {
		JabberMessage *jm;
		jm = g_new0(JabberMessage, 1);
		jm->js = chat->js;
		jm->type = JABBER_MESSAGE_GROUPCHAT;
		jm->subject = purple_markup_strip_html(topic);
		jm->to = g_strdup_printf("%[email protected]%s", chat->room, chat->server);
		jabber_message_send(jm);
		jabber_message_free(jm);
	} else {
		const char *cur = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(chat->conv));
		char *buf, *tmp, *tmp2;

		if(cur) {
			tmp = g_markup_escape_text(cur, -1);
			tmp2 = purple_markup_linkify(tmp);
			buf = g_strdup_printf(_("current topic is: %s"), tmp2);
			g_free(tmp);
			g_free(tmp2);
		} else
			buf = g_strdup(_("No topic is set"));
		purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "", buf,
				PURPLE_MESSAGE_SYSTEM | PURPLE_MESSAGE_NO_LOG, time(NULL));
		g_free(buf);
	}

}
开发者ID:arminius2,项目名称:apolloim,代码行数:30,代码来源:chat.c


示例7: 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);
  
  PurpleBlistNode* node = purple_blist_get_root();
  GHashTable* hasht = NULL;
  while (node != 0) {
    if (PURPLE_BLIST_NODE_IS_CHAT(node)) {
      PurpleChat * ch = PURPLE_CHAT(node);
      if (purple_chat_get_account(ch) == account) {
        hasht = purple_chat_get_components(ch);
        if (chatid_to_convo(g_hash_table_lookup(hasht, "id")) == id) {
          break;
        }
      }
    }
    node = purple_blist_node_next(node,FALSE);
  }

  char * chat_id = g_hash_table_lookup(hasht, "id");
  waAPI_sendchat(wconn->waAPI,chat_id,message);
  waprpl_check_output(gc);

  serv_got_chat_in(gc, purple_conv_chat_get_id(PURPLE_CONV_CHAT(convo)), purple_connection_get_display_name(gc), PURPLE_MESSAGE_SEND, message, time(NULL));
  purple_conv_im_write(PURPLE_CONV_CHAT(convo), purple_connection_get_display_name(gc), message, PURPLE_MESSAGE_SEND, time(NULL));

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


示例8: irc_msg_topic

void irc_msg_topic(struct irc_conn *irc, const char *name, const char *from, char **args)
{
	char *chan, *topic, *msg, *nick, *tmp, *tmp2;
	PurpleConversation *convo;

	if (!strcmp(name, "topic")) {
		chan = args[0];
		topic = irc_mirc2txt (args[1]);
	} else {
		chan = args[1];
		topic = irc_mirc2txt (args[2]);
	}

	convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, chan, irc->account);
	if (!convo) {
		purple_debug(PURPLE_DEBUG_ERROR, "irc", "Got a topic for %s, which doesn't exist\n", chan);
		g_free(topic);
		return;
	}

	/* If this is an interactive update, print it out */
	tmp = g_markup_escape_text(topic, -1);
	tmp2 = purple_markup_linkify(tmp);
	g_free(tmp);
	if (!strcmp(name, "topic")) {
		const char *current_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(convo));
		if (!(current_topic != NULL && strcmp(tmp2, current_topic) == 0))
		{
			char *nick_esc;
			nick = irc_mask_nick(from);
			nick_esc = g_markup_escape_text(nick, -1);
			purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), nick, topic);
			if (*tmp2)
				msg = g_strdup_printf(_("%s has changed the topic to: %s"), nick_esc, tmp2);
			else
				msg = g_strdup_printf(_("%s has cleared the topic."), nick_esc);
			g_free(nick_esc);
			g_free(nick);
			purple_conv_chat_write(PURPLE_CONV_CHAT(convo), from, msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
			g_free(msg);
		}
	} else {
		char *chan_esc = g_markup_escape_text(chan, -1);
		msg = g_strdup_printf(_("The topic for %s is: %s"), chan_esc, tmp2);
		g_free(chan_esc);
		purple_conv_chat_set_topic(PURPLE_CONV_CHAT(convo), NULL, topic);
		purple_conv_chat_write(PURPLE_CONV_CHAT(convo), "", msg, PURPLE_MESSAGE_SYSTEM, time(NULL));
		g_free(msg);
	}
	g_free(tmp2);
	g_free(topic);
}
开发者ID:bf4,项目名称:pidgin-mac,代码行数:52,代码来源:msgs.c


示例9: irc_chat_remove_buddy

static void irc_chat_remove_buddy(PurpleConversation *convo, char *data[2])
{
	char *message, *stripped;

	stripped = data[1] ? irc_mirc2txt(data[1]) : NULL;
	message = g_strdup_printf("quit: %s", stripped);
	g_free(stripped);

	if (purple_conv_chat_find_user(PURPLE_CONV_CHAT(convo), data[0]))
		purple_conv_chat_remove_user(PURPLE_CONV_CHAT(convo), data[0], message);

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


示例10: PURPLE_CONV_CHAT

void QuetzalChat::update(PurpleConvUpdateType type)
{
	PurpleConvChat *chat = PURPLE_CONV_CHAT(m_conv);
	if (type == PURPLE_CONV_UPDATE_CHATLEFT)
		setJoined(chat->left);
	else if (type == PURPLE_CONV_UPDATE_TOPIC) {
		QString oldTopic = m_topic;
		m_topic = purple_conv_chat_get_topic(PURPLE_CONV_CHAT(m_conv));
		emit topicChanged(m_topic, oldTopic);
	} else if (type == PURPLE_CONV_UPDATE_TITLE) {
//		QString oldTitle = m_title;
//		m_title = purple_PURPLE_CONV_CHAT(m_conv));
//		emit topicChanged(m_topic, oldTopic);
	}
}
开发者ID:AlexeyProkhin,项目名称:qutim,代码行数:15,代码来源:quetzalchat.cpp


示例11: translate_sending_chat_message_cb

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);
}
开发者ID:Javran,项目名称:purple-plugin-pack,代码行数:25,代码来源:translate.c


示例12: pop

gboolean
pop(gpointer p) {
	char *reply = "";
	queue_t *q = (queue_t*)p;
	queue_item_t *item;

	if (q->len > 0) {
		item = q->q[0];

		q->len--;
		if (q->len > 0) {
			memmove(q->q, &(q->q[1]), q->len * sizeof(queue_item_t*));
	//		q->q = realloc(q->q, q->len * sizeof(queue_item_t*));
		}

		if (purple_conversation_get_type(item->conv) == PURPLE_CONV_TYPE_IM) {
//			reply = alice(item->name, item->msg, item->conv);
			purple_conv_im_send(PURPLE_CONV_IM(item->conv), item->msg);

		} else if (purple_conversation_get_type(item->conv) == PURPLE_CONV_TYPE_CHAT) {
//			reply = alice(item->name, item->msg, item->conv);
			purple_conv_chat_send(PURPLE_CONV_CHAT(item->conv), item->msg);

		}

		printf (NAME ": %s\n", reply);

		free(item->name);
		free(item->msg);
		free(item);
	}

	return 1;
}
开发者ID:echoline,项目名称:rs,代码行数:34,代码来源:purple.c


示例13: yahoo_conf_invite

static void yahoo_conf_invite(PurpleConnection *gc, PurpleConversation *c,
		const char *dn, const char *buddy, const char *room, const char *msg)
{
	YahooData *yd = gc->proto_data;
	struct yahoo_packet *pkt;
	GList *members;
	char *msg2 = NULL;

	if (msg)
		msg2 = yahoo_string_encode(gc, msg, NULL);

	members = purple_conv_chat_get_users(PURPLE_CONV_CHAT(c));

	pkt = yahoo_packet_new(YAHOO_SERVICE_CONFADDINVITE, YAHOO_STATUS_AVAILABLE, yd->session_id);

	yahoo_packet_hash(pkt, "sssss", 1, dn, 51, buddy, 57, room, 58, msg?msg2:"", 13, "0");
	for(; members; members = members->next) {
		const char *name = purple_conv_chat_cb_get_name(members->data);
		if (!strcmp(name, dn))
			continue;
		yahoo_packet_hash(pkt, "ss", 52, name, 53, name);
	}

	yahoo_packet_send_and_free(pkt, yd);
	g_free(msg2);
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:26,代码来源:yahoochat.c


示例14: yahoo_process_chat_exit

void yahoo_process_chat_exit(PurpleConnection *gc, struct yahoo_packet *pkt)
{
	char *who = NULL;
	char *room = NULL;
	GSList *l;

	for (l = pkt->hash; l; l = l->next) {
		struct yahoo_pair *pair = l->data;

		if (pair->key == 104) {
			g_free(room);
			room = yahoo_string_decode(gc, pair->value, TRUE);
		}
		if (pair->key == 109)
			who = pair->value;
	}

	if (who && room) {
		PurpleConversation *c = purple_find_chat(gc, YAHOO_CHAT_ID);
		if (c && !purple_utf8_strcasecmp(purple_conversation_get_name(c), room))
			purple_conv_chat_remove_user(PURPLE_CONV_CHAT(c), who, NULL);

	}
	g_free(room);
}
开发者ID:Lilitana,项目名称:Pidgin,代码行数:25,代码来源:yahoochat.c


示例15: irc_msg_nick

void irc_msg_nick(struct irc_conn *irc, const char *name, const char *from, char **args)
{
	PurpleConnection *gc = purple_account_get_connection(irc->account);
	PurpleConversation *conv;
	GSList *chats;
	char *nick = irc_mask_nick(from);

	irc->nickused = FALSE;

	if (!gc) {
		g_free(nick);
		return;
	}
	chats = gc->buddy_chats;

	if (!purple_utf8_strcasecmp(nick, purple_connection_get_display_name(gc))) {
		purple_connection_set_display_name(gc, args[0]);
	}

	while (chats) {
		PurpleConvChat *chat = PURPLE_CONV_CHAT(chats->data);
		/* This is ugly ... */
		if (purple_conv_chat_find_user(chat, nick))
			purple_conv_chat_rename_user(chat, nick, args[0]);
		chats = chats->next;
	}

	conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, nick,
						   irc->account);
	if (conv != NULL)
		purple_conversation_set_name(conv, args[0]);

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


示例16: 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);

	char msgid[128];
	waAPI_getmsgid(wconn->waAPI, msgid);

	purple_signal_emit(purple_connection_get_prpl(gc), "whatsapp-sending-message", gc, msgid, chat_id, message);

	waAPI_sendchat(wconn->waAPI, msgid, 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:jab15pm,项目名称:whatsapp-purple,代码行数:27,代码来源:wa_purple.c


示例17: notify_chat_nick

static void
notify_chat_nick (PurpleAccount *account,
				  const gchar *sender,
				  const gchar *message,
				  PurpleConversation *conv,
				  gpointer data)
{
	gchar *nick;

	nick = (gchar *)purple_conv_chat_get_nick (PURPLE_CONV_CHAT(conv));
#ifndef DEBUG /* in debug mode, always show notifications */
	if (nick && !strcmp (sender, nick))
		return;
#else
	purple_debug_info (PLUGIN_ID, "Message would be suppressed normally because you said it yourself");
#endif

	int triggermessagefound = 0;
	int i;
	for (i = 0; words[i]; i++  ) {
		if (g_strstr_len(message, strlen(message), words[i])) {
			triggermessagefound=1;
			purple_debug_info (PLUGIN_ID, "found triggermessage in chat");
			break;
		}
	}
	if (!triggermessagefound){
		purple_debug_info (PLUGIN_ID, "no triggermessage found in chat");
	}

	if (!triggermessagefound && !g_strstr_len(message, strlen(message), nick) && !purple_prefs_get_bool("/plugins/gtk/libnotify/othermsgs"))
		return;

	notify_msg_sent (account, conv, sender, message);
}
开发者ID:jauco,项目名称:pidgin-libnotify,代码行数:35,代码来源:pidgin-libnotify.c


示例18: should_hide_notice

static gboolean should_hide_notice(PurpleConversation *conv, const char *name,
                                   GHashTable *users)
{
	PurpleConvChat *chat;
	int threshold;
	struct joinpart_key key;
	time_t *last_said;

	g_return_val_if_fail(conv != NULL, FALSE);
	g_return_val_if_fail(purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT, FALSE);

	/* If the room is small, don't bother. */
	chat = PURPLE_CONV_CHAT(conv);
	threshold = purple_prefs_get_int(THRESHOLD_PREF);
	if (g_list_length(purple_conv_chat_get_users(chat)) < threshold)
		return FALSE;

	if (!purple_prefs_get_bool(HIDE_BUDDIES_PREF) &&
	    purple_find_buddy(purple_conversation_get_account(conv), name))
		return FALSE;

	/* Only show the notice if the user has spoken recently. */
	key.conv = conv;
	key.user = (gchar *)name;
	last_said = g_hash_table_lookup(users, &key);
	if (last_said != NULL)
	{
		int delay = purple_prefs_get_int(DELAY_PREF);
		if (delay > 0 && (*last_said + (delay * 60)) >= time(NULL))
			return FALSE;
	}

	return TRUE;
}
开发者ID:vorburger,项目名称:pidgin-ignore-nickchange,代码行数:34,代码来源:nickchange.c


示例19: jabber_chat_change_nick

void jabber_chat_change_nick(JabberChat *chat, const char *nick)
{
	xmlnode *presence;
	char *full_jid;
	PurplePresence *gpresence;
	PurpleStatus *status;
	JabberBuddyState state;
	char *msg;
	int priority;

	if(!chat->muc) {
		purple_conv_chat_write(PURPLE_CONV_CHAT(chat->conv), "",
				_("Nick changing not supported in non-MUC chatrooms"),
				PURPLE_MESSAGE_SYSTEM, time(NULL));
		return;
	}

	gpresence = purple_account_get_presence(chat->js->gc->account);
	status = purple_presence_get_active_status(gpresence);

	purple_status_to_jabber(status, &state, &msg, &priority);

	presence = jabber_presence_create(state, msg, priority);
	full_jid = g_strdup_printf("%[email protected]%s/%s", chat->room, chat->server, nick);
	xmlnode_set_attrib(presence, "to", full_jid);
	g_free(full_jid);
	g_free(msg);

	jabber_send(chat->js, presence);
	xmlnode_free(presence);
}
开发者ID:arminius2,项目名称:apolloim,代码行数:31,代码来源:chat.c


示例20: purple_connection_get_account

PurpleConversation *get_open_combo(const char *who, PurpleConnection * gc)
{
	PurpleAccount *acc = purple_connection_get_account(gc);
	if (isgroup(who)) {
		/* Search fot the combo */
		PurpleChat *ch = blist_find_chat_by_id(gc, who);
		GHashTable *hasht = purple_chat_get_components(ch);
		int convo_id = chatid_to_convo(who);
		const char *groupname = g_hash_table_lookup(hasht, "subject");
		PurpleConversation *convo = purple_find_chat(gc, convo_id);
		
		/* Create a window if it's not open yet */
		if (!convo) {
			waprpl_chat_join(gc, hasht);
			convo = purple_find_chat(gc, convo_id);
		}
		else if (purple_conv_chat_has_left(PURPLE_CONV_CHAT(convo))) {
			char *subject, *owner, *part;
			whatsapp_connection *wconn = purple_connection_get_protocol_data(gc);
			if (waAPI_getgroupinfo(wconn->waAPI, (char*)who, &subject, &owner, &part)) {
				convo = serv_got_joined_chat(gc, convo_id, groupname);
				purple_debug_info(WHATSAPP_ID, "group info ID(%s) SUBJECT(%s) OWNER(%s)\n", who, subject, owner);
				conv_add_participants(convo, part, owner);
			}
		}
		
		return convo;
	} else {
		/* Search for the combo */
		PurpleConversation *convo = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, who, acc);
		if (!convo)
			convo = purple_conversation_new(PURPLE_CONV_TYPE_IM, acc, who);
		return convo;
	}
}
开发者ID:magicalbanana,项目名称:whatsapp-purple,代码行数:35,代码来源:wa_purple.c



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ PUSH函数代码示例发布时间:2022-05-30
下一篇:
C++ PURPLE_CALLBACK函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap