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


C++ PURPLE_CONV_CHAT函数代码示例

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


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


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