Exemple #1
0
/* this should be called upon signin, even when we did not open group chat window */
void qq_group_init(GaimConnection *gc)
{
	gint i;
	GaimAccount *account;
	GaimChat *chat;
	GaimGroup *gaim_group;
	GaimBlistNode *node;
	qq_group *group;

	account = gaim_connection_get_account(gc);

	gaim_group = gaim_find_group(GAIM_GROUP_QQ_QUN);
	if (gaim_group == NULL) {
		gaim_debug(GAIM_DEBUG_INFO, "QQ", "We have no QQ Qun\n");
		return;
	}

	i = 0;
	for (node = ((GaimBlistNode *) gaim_group)->child; node != NULL; node = node->next)
		if (GAIM_BLIST_NODE_IS_CHAT(node)) {	/* got one */
			chat = (GaimChat *) node;
			if (account != chat->account)
				continue;	/* very important here ! */
			group = qq_group_from_hashtable(gc, chat->components);
			if (group != NULL) {
				i++;
				qq_send_cmd_group_get_group_info(gc, group);	/* get group info and members */
			}
		}

	gaim_debug(GAIM_DEBUG_INFO, "QQ", "Load %d QQ Qun configurations\n", i);
}
Exemple #2
0
static GaimChat *gaym_find_blist_chat(GaimAccount * account,
                                      const char *name)
{
    char *chat_name;
    GaimChat *chat;
    GaimPlugin *prpl;
    GaimPluginProtocolInfo *prpl_info = NULL;
    struct proto_chat_entry *pce;
    GaimBlistNode *node, *group;
    GList *parts;

    GaimBuddyList *gaimbuddylist = gaim_get_blist();

    g_return_val_if_fail(gaimbuddylist != NULL, NULL);
    g_return_val_if_fail((name != NULL) && (*name != '\0'), NULL);

    if (!gaim_account_is_connected(account))
        return NULL;

    prpl = gaim_find_prpl(gaim_account_get_protocol_id(account));
    prpl_info = GAIM_PLUGIN_PROTOCOL_INFO(prpl);

    for (group = gaimbuddylist->root; group != NULL; group = group->next) {
        for (node = group->child; node != NULL; node = node->next) {
            if (GAIM_BLIST_NODE_IS_CHAT(node)) {

                chat = (GaimChat *) node;

                if (account != chat->account)
                    continue;

                parts =
                    prpl_info->
                    chat_info(gaim_account_get_connection(chat->account));

                pce = parts->data;
                chat_name = g_hash_table_lookup(chat->components,
                                                pce->identifier);

                if (chat->account == account && chat_name != NULL &&
                    name != NULL
                    && g_pattern_match_simple(chat_name, name)) {

                    return chat;
                }
            }
        }
    }

    return NULL;
}
static void
blist_node_extended_menu_cb(GaimBlistNode *node, void *data)
{
	GaimContact *p = (GaimContact *)node;
	GaimBuddy *b = (GaimBuddy *)node;
	GaimChat *c = (GaimChat *)node;
	GaimGroup *g = (GaimGroup *)node;

	if (GAIM_BLIST_NODE_IS_CONTACT(node))
		gaim_debug_misc("signals test", "blist-node-extended-menu (Contact: %s)\n", p->alias);
	else if (GAIM_BLIST_NODE_IS_BUDDY(node))
		gaim_debug_misc("signals test", "blist-node-extended-menu (Buddy: %s)\n", b->name);
	else if (GAIM_BLIST_NODE_IS_CHAT(node))
		gaim_debug_misc("signals test", "blist-node-extended-menu (Chat: %s)\n", c->alias);
	else if (GAIM_BLIST_NODE_IS_GROUP(node))
		gaim_debug_misc("signals test", "blist-node-extended-menu (Group: %s)\n", g->name);
	else
		gaim_debug_misc("signals test", "blist-node-extended-menu (UNKNOWN: %d)\n", node->type);

}