Mercurial > pidgin
comparison libpurple/protocols/qq/group_im.c @ 24154:237e5a94e11c
2008.10.08 - ccpaging <ccpaging(at)gmail.com>
* Update group part
* Delete some meaningless functions and data
* Added 'change my icon'
2008.10.08 - lonicerae <lonicerae(at)gmail.com>
* Merge 20081008 patch into trunk
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 15:08:30 +0000 |
parents | 818ab62006f5 |
children | 3c52353b83ae |
comparison
equal
deleted
inserted
replaced
24153:340fc40fe4ef | 24154:237e5a94e11c |
---|---|
43 #include "qq_network.h" | 43 #include "qq_network.h" |
44 #include "qq_process.h" | 44 #include "qq_process.h" |
45 #include "utils.h" | 45 #include "utils.h" |
46 | 46 |
47 /* show group conversation window */ | 47 /* show group conversation window */ |
48 PurpleConversation *qq_room_conv_new(PurpleConnection *gc, qq_group *group) | 48 PurpleConversation *qq_room_conv_open(PurpleConnection *gc, qq_group *group) |
49 { | 49 { |
50 PurpleConversation *conv; | 50 PurpleConversation *conv; |
51 qq_data *qd; | 51 qq_data *qd; |
52 gchar *topic_utf8; | 52 gchar *topic_utf8; |
53 | 53 |
59 if (conv != NULL) { | 59 if (conv != NULL) { |
60 /* show only one conversation per group */ | 60 /* show only one conversation per group */ |
61 return conv; | 61 return conv; |
62 } | 62 } |
63 | 63 |
64 serv_got_joined_chat(gc, qd->channel++, group->title_utf8); | 64 serv_got_joined_chat(gc, group->id, group->title_utf8); |
65 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, group->title_utf8, purple_connection_get_account(gc)); | 65 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, group->title_utf8, purple_connection_get_account(gc)); |
66 if (conv != NULL) { | 66 if (conv != NULL) { |
67 topic_utf8 = g_strdup_printf("%d %s", group->ext_id, group->notice_utf8); | 67 topic_utf8 = g_strdup_printf("%d %s", group->ext_id, group->notice_utf8); |
68 purple_debug_info("QQ", "Set chat topic to %s\n", topic_utf8); | 68 purple_debug_info("QQ", "Set chat topic to %s\n", topic_utf8); |
69 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); | 69 purple_conv_chat_set_topic(PURPLE_CONV_CHAT(conv), NULL, topic_utf8); |
70 g_free(topic_utf8); | 70 g_free(topic_utf8); |
71 | 71 |
72 if (group->is_got_info) | 72 if (group->is_got_buddies) |
73 qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, group->id); | 73 qq_send_room_cmd_only(gc, QQ_ROOM_CMD_GET_ONLINES, group->id); |
74 else | 74 else |
75 qq_update_room(gc, 0, group->id); | 75 qq_update_room(gc, 0, group->id); |
76 return conv; | 76 return conv; |
77 } | 77 } |
85 qq_buddy_data *bd; | 85 qq_buddy_data *bd; |
86 gchar *member_name, *member_uid; | 86 gchar *member_name, *member_uid; |
87 PurpleConversation *conv; | 87 PurpleConversation *conv; |
88 gint flag; | 88 gint flag; |
89 gboolean is_find; | 89 gboolean is_find; |
90 | |
90 g_return_if_fail(group != NULL); | 91 g_return_if_fail(group != NULL); |
91 | 92 |
92 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, | 93 conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_CHAT, |
93 group->title_utf8, purple_connection_get_account(gc)); | 94 group->title_utf8, purple_connection_get_account(gc)); |
94 if (conv == NULL) { | 95 if (conv == NULL) { |
155 } | 156 } |
156 g_list_free(flags); | 157 g_list_free(flags); |
157 } | 158 } |
158 | 159 |
159 /* send IM to a group */ | 160 /* send IM to a group */ |
160 void qq_send_packet_group_im(PurpleConnection *gc, qq_group *group, const gchar *msg) | 161 void qq_send_packet_group_im(PurpleConnection *gc, guint32 room_id, const gchar *msg) |
161 { | 162 { |
162 gint data_len, bytes; | 163 gint data_len, bytes; |
163 guint8 *raw_data, *send_im_tail; | 164 guint8 *raw_data, *send_im_tail; |
164 guint16 msg_len; | 165 guint16 msg_len; |
165 gchar *msg_filtered; | 166 gchar *msg_filtered; |
166 | 167 |
167 g_return_if_fail(group != NULL && msg != NULL); | 168 g_return_if_fail(room_id != 0 && msg != NULL); |
168 | 169 |
169 msg_filtered = purple_markup_strip_html(msg); | 170 msg_filtered = purple_markup_strip_html(msg); |
170 purple_debug_info("QQ_MESG", "Send qun mesg filterd: %s\n", msg_filtered); | 171 purple_debug_info("QQ_MESG", "Send qun mesg filterd: %s\n", msg_filtered); |
171 msg_len = strlen(msg_filtered); | 172 msg_len = strlen(msg_filtered); |
172 | 173 |
182 bytes += qq_putdata(raw_data + bytes, send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN); | 183 bytes += qq_putdata(raw_data + bytes, send_im_tail, QQ_SEND_IM_AFTER_MSG_LEN); |
183 g_free(send_im_tail); | 184 g_free(send_im_tail); |
184 g_free(msg_filtered); | 185 g_free(msg_filtered); |
185 | 186 |
186 if (bytes == data_len) /* create OK */ | 187 if (bytes == data_len) /* create OK */ |
187 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_MSG, group->id, raw_data, data_len); | 188 qq_send_room_cmd(gc, QQ_ROOM_CMD_SEND_MSG, room_id, raw_data, data_len); |
188 else | 189 else |
189 purple_debug_error("QQ", | 190 purple_debug_error("QQ", |
190 "Fail creating group_im packet, expect %d bytes, build %d bytes\n", data_len, bytes); | 191 "Fail creating group_im packet, expect %d bytes, build %d bytes\n", data_len, bytes); |
191 } | 192 } |
192 | 193 |
260 g_return_if_fail(group != NULL); | 261 g_return_if_fail(group != NULL); |
261 | 262 |
262 conv = purple_find_conversation_with_account( | 263 conv = purple_find_conversation_with_account( |
263 PURPLE_CONV_TYPE_CHAT, group->title_utf8, account); | 264 PURPLE_CONV_TYPE_CHAT, group->title_utf8, account); |
264 if (conv == NULL && purple_prefs_get_bool("/plugins/prpl/qq/show_room_when_newin")) { | 265 if (conv == NULL && purple_prefs_get_bool("/plugins/prpl/qq/show_room_when_newin")) { |
265 conv = qq_room_conv_new(gc, group); | 266 conv = qq_room_conv_open(gc, group); |
266 } | 267 } |
267 | 268 |
268 if (conv == NULL) { | 269 if (conv == NULL) { |
269 return; | 270 return; |
270 } | 271 } |