comparison libpurple/protocols/qq/group_conv.c @ 15374:5fe8042783c1

Rename gtk/ and libgaim/ to pidgin/ and libpurple/
author Sean Egan <seanegan@gmail.com>
date Sat, 20 Jan 2007 02:32:10 +0000
parents
children 32c366eeeb99
comparison
equal deleted inserted replaced
15373:f79e0f4df793 15374:5fe8042783c1
1 /**
2 * @file group_conv.c
3 *
4 * gaim
5 *
6 * Gaim is the legal property of its developers, whose names are too numerous
7 * to list here. Please refer to the COPYRIGHT file distributed with this
8 * source distribution.
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25 #include <glib.h>
26 #include "conversation.h"
27
28 #include "buddy_status.h"
29 #include "group_conv.h"
30 #include "qq.h"
31 #include "utils.h"
32
33 /* show group conversation window */
34 void qq_group_conv_show_window(GaimConnection *gc, qq_group *group)
35 {
36 GaimConversation *conv;
37 qq_data *qd;
38
39 g_return_if_fail(group != NULL);
40 qd = (qq_data *) gc->proto_data;
41
42 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
43 group->group_name_utf8, gaim_connection_get_account(gc));
44 if (conv == NULL) /* show only one window per group */
45 serv_got_joined_chat(gc, qd->channel++, group->group_name_utf8);
46 }
47
48 /* refresh online member in group conversation window */
49 void qq_group_conv_refresh_online_member(GaimConnection *gc, qq_group *group)
50 {
51 GList *names, *list, *flags;
52 qq_buddy *member;
53 gchar *member_name;
54 GaimConversation *conv;
55 gint flag;
56 g_return_if_fail(group != NULL);
57
58 names = NULL;
59 flags = NULL;
60 conv = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT,
61 group->group_name_utf8, gaim_connection_get_account(gc));
62 if (conv != NULL && group->members != NULL) {
63 list = group->members;
64 while (list != NULL) {
65 member = (qq_buddy *) list->data;
66 /* always put it even offline */
67 names = g_list_append(names,
68 /* we need unique identifiers for everyone in the chat or else we'll
69 * run into problems with functions like get_cb_real_name from qq.c */
70 (member->nickname != NULL && *(member->nickname) != '\0') ?
71 g_strdup_printf("%s (qq-%u)", member->nickname, member->uid) :
72 g_strdup_printf("(qq-%u)", member->uid));
73 flag = 0;
74 /* TYPING to put online above OP and FOUNDER */
75 if (is_online(member->status)) flag |= (GAIM_CBFLAGS_TYPING | GAIM_CBFLAGS_VOICE);
76 if(1 == (member->role & 1)) flag |= GAIM_CBFLAGS_OP;
77 if(member->uid == group->creator_uid) flag |= GAIM_CBFLAGS_FOUNDER;
78 flags = g_list_append(flags, GINT_TO_POINTER(flag));
79 list = list->next;
80 }
81
82 gaim_conv_chat_clear_users(GAIM_CONV_CHAT(conv));
83 gaim_conv_chat_add_users(GAIM_CONV_CHAT(conv), names, NULL, flags, FALSE);
84 }
85 /* clean up names */
86 while (names != NULL) {
87 member_name = (gchar *) names->data;
88 names = g_list_remove(names, member_name);
89 g_free(member_name);
90 }
91 g_list_free(flags);
92 }