6
* Purple 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
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.
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.
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., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
31
#include "group_internal.h"
32
#include "group_info.h"
33
#include "group_join.h"
35
#include "qq_network.h"
36
#include "qq_define.h"
38
static void _qq_group_search_callback(PurpleConnection *gc, const gchar *input)
42
g_return_if_fail(input != NULL);
43
ext_id = strtoul(input, NULL, 10);
44
/* 0x00000000 means search for demo group */
45
qq_request_room_search(gc, ext_id, QQ_ROOM_SEARCH_ONLY);
48
static void _qq_group_search_cancel_callback(PurpleConnection *gc, const gchar *input)
52
qd = (qq_data *) gc->proto_data;
53
purple_roomlist_set_in_progress(qd->roomlist, FALSE);
56
/* This is needed for PurpleChat node to be valid */
57
GList *qq_chat_info(PurpleConnection *gc)
60
struct proto_chat_entry *pce;
64
pce = g_new0(struct proto_chat_entry, 1);
65
pce->label = _("ID: ");
66
pce->identifier = QQ_ROOM_KEY_EXTERNAL_ID;
67
m = g_list_append(m, pce);
72
GHashTable *qq_chat_info_defaults(PurpleConnection *gc, const gchar *chat_name)
76
defaults = g_hash_table_new_full(g_str_hash, g_str_equal, NULL, g_free);
78
if (chat_name != NULL)
79
g_hash_table_insert(defaults, QQ_ROOM_KEY_EXTERNAL_ID, g_strdup(chat_name));
84
/* get a list of qq groups */
85
PurpleRoomlist *qq_roomlist_get_list(PurpleConnection *gc)
90
PurpleRoomlistField *f;
92
qd = (qq_data *) gc->proto_data;
95
rl = purple_roomlist_new(purple_connection_get_account(gc));
98
f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, _("Group ID"), QQ_ROOM_KEY_EXTERNAL_ID, FALSE);
99
fields = g_list_append(fields, f);
100
f = purple_roomlist_field_new(PURPLE_ROOMLIST_FIELD_STRING, "", QQ_ROOM_KEY_INTERNAL_ID, TRUE);
101
fields = g_list_append(fields, f);
103
fields = g_list_append(fields, f);
104
purple_roomlist_set_fields(rl, fields);
105
purple_roomlist_set_in_progress(qd->roomlist, TRUE);
107
purple_request_input(gc, _("QQ Qun"),
108
_("Please enter Qun number"),
109
_("You can only search for permanent Qun\n"),
110
NULL, FALSE, FALSE, NULL,
111
_("Search"), G_CALLBACK(_qq_group_search_callback),
112
_("Cancel"), G_CALLBACK(_qq_group_search_cancel_callback),
113
purple_connection_get_account(gc), NULL, NULL,
119
/* free roomlist space, I have no idea when this one is called... */
120
void qq_roomlist_cancel(PurpleRoomlist *list)
122
PurpleConnection *gc;
124
g_return_if_fail(list != NULL);
125
gc = purple_account_get_connection(list->account);
127
purple_roomlist_set_in_progress(list, FALSE);
128
purple_roomlist_unref(list);