Mercurial > pidgin
comparison libpurple/protocols/qq/group_im.c @ 24146:ce94189f15ad
Flos Lonicerae <lonicerae(at)gmail.com>
* Merge lonicerae and ccpaging into trunk
author | SHiNE CsyFeK <csyfek@gmail.com> |
---|---|
date | Wed, 22 Oct 2008 14:52:26 +0000 |
parents | ec3f7d3e0445 |
children | 1bdf7b602684 |
comparison
equal
deleted
inserted
replaced
24145:ec3f7d3e0445 | 24146:ce94189f15ad |
---|---|
105 bytes += qq_get8(&type8, data + bytes); | 105 bytes += qq_get8(&type8, data + bytes); |
106 bytes += qq_get32(&user_uid, data + bytes); | 106 bytes += qq_get32(&user_uid, data + bytes); |
107 | 107 |
108 g_return_if_fail(ext_id > 0 && user_uid > 0); | 108 g_return_if_fail(ext_id > 0 && user_uid > 0); |
109 | 109 |
110 bytes += convert_as_pascal_string(data + bytes, &reason_utf8, QQ_CHARSET_DEFAULT); | 110 bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes); |
111 | 111 |
112 msg = g_strdup_printf(_("%d request to join Qun %d"), user_uid, ext_id); | 112 msg = g_strdup_printf(_("%d request to join Qun %d"), user_uid, ext_id); |
113 reason = g_strdup_printf(_("Message: %s"), reason_utf8); | 113 reason = g_strdup_printf(_("Message: %s"), reason_utf8); |
114 | 114 |
115 g = g_new0(group_member_opt, 1); | 115 g = g_new0(group_member_opt, 1); |
159 } | 159 } |
160 | 160 |
161 if (uid_from != 0) { | 161 if (uid_from != 0) { |
162 buddy = qq_group_find_member_by_uid(group, uid_from); | 162 buddy = qq_group_find_member_by_uid(group, uid_from); |
163 if (buddy == NULL || buddy->nickname == NULL) | 163 if (buddy == NULL || buddy->nickname == NULL) |
164 from = uid_to_purple_name(uid_from); | 164 from = g_strdup_printf("%d", uid_from); |
165 else | 165 else |
166 from = g_strdup(buddy->nickname); | 166 from = g_strdup(buddy->nickname); |
167 } else { | 167 } else { |
168 from = g_strdup(""); | 168 from = g_strdup(""); |
169 } | 169 } |
190 bytes += qq_get8(&type8, data + bytes); | 190 bytes += qq_get8(&type8, data + bytes); |
191 bytes += qq_get32(&admin_uid, data + bytes); | 191 bytes += qq_get32(&admin_uid, data + bytes); |
192 | 192 |
193 g_return_if_fail(ext_id > 0 && admin_uid > 0); | 193 g_return_if_fail(ext_id > 0 && admin_uid > 0); |
194 | 194 |
195 bytes += convert_as_pascal_string(data + bytes, &reason_utf8, QQ_CHARSET_DEFAULT); | 195 bytes += qq_get_vstr(&reason_utf8, QQ_CHARSET_DEFAULT, data + bytes); |
196 | 196 |
197 msg = g_strdup_printf | 197 msg = g_strdup_printf |
198 (_("Failed to join Qun %d, operated by admin %d"), ext_id, admin_uid); | 198 (_("Failed to join Qun %d, operated by admin %d"), ext_id, admin_uid); |
199 reason = g_strdup_printf(_("Message: %s"), reason_utf8); | 199 reason = g_strdup_printf(_("Message: %s"), reason_utf8); |
200 | 200 |
229 bytes += qq_get8(&type8, data + bytes); | 229 bytes += qq_get8(&type8, data + bytes); |
230 bytes += qq_get32(&admin_uid, data + bytes); | 230 bytes += qq_get32(&admin_uid, data + bytes); |
231 | 231 |
232 g_return_if_fail(ext_id > 0 && admin_uid > 0); | 232 g_return_if_fail(ext_id > 0 && admin_uid > 0); |
233 /* it is also a "无" here, so do not display */ | 233 /* it is also a "无" here, so do not display */ |
234 bytes += convert_as_pascal_string(data + bytes, &reason, QQ_CHARSET_DEFAULT); | 234 bytes += qq_get_vstr(&reason, QQ_CHARSET_DEFAULT, data + bytes); |
235 | 235 |
236 group = qq_room_search_id(gc, id); | 236 group = qq_room_search_id(gc, id); |
237 if (group != NULL) { | 237 if (group != NULL) { |
238 group->my_role = QQ_ROOM_ROLE_YES; | 238 group->my_role = QQ_ROOM_ROLE_YES; |
239 qq_group_refresh(gc, group); | 239 qq_group_refresh(gc, group); |
315 qq_room_got_chat_in(gc, group, 0, msg, now); | 315 qq_room_got_chat_in(gc, group, 0, msg, now); |
316 g_free(msg); | 316 g_free(msg); |
317 } | 317 } |
318 | 318 |
319 /* recv an IM from a group chat */ | 319 /* recv an IM from a group chat */ |
320 void qq_process_room_msg_normal(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 im_type) | 320 void qq_process_room_msg_normal(guint8 *data, gint data_len, guint32 id, PurpleConnection *gc, guint16 msg_type) |
321 { | 321 { |
322 gchar *msg_with_purple_smiley, *msg_utf8_encoded; | 322 gchar *msg_with_purple_smiley, *msg_utf8_encoded; |
323 qq_data *qd; | 323 qq_data *qd; |
324 qq_group *group; | 324 qq_group *group; |
325 gint skip_len; | 325 gint skip_len; |
351 memset(&packet, 0, sizeof(packet)); | 351 memset(&packet, 0, sizeof(packet)); |
352 bytes = 0; | 352 bytes = 0; |
353 bytes += qq_get32(&(packet.ext_id), data + bytes); | 353 bytes += qq_get32(&(packet.ext_id), data + bytes); |
354 bytes += qq_get8(&(packet.type8), data + bytes); | 354 bytes += qq_get8(&(packet.type8), data + bytes); |
355 | 355 |
356 if(QQ_RECV_IM_TEMP_QUN_IM == im_type) { | 356 if(QQ_MSG_TEMP_QUN_IM == msg_type) { |
357 bytes += qq_get32(&(id), data + bytes); | 357 bytes += qq_get32(&(id), data + bytes); |
358 } | 358 } |
359 | 359 |
360 bytes += qq_get32(&(packet.member_uid), bytes + data); | 360 bytes += qq_get32(&(packet.member_uid), bytes + data); |
361 bytes += qq_get16(&packet.unknown, data + bytes); /* 0x0001? */ | 361 bytes += qq_get16(&packet.unknown, data + bytes); /* 0x0001? */ |
382 * fragmentSequence = buf.get() & 255; | 382 * fragmentSequence = buf.get() & 255; |
383 * messageId = buf.getChar(); | 383 * messageId = buf.getChar(); |
384 * buf.getInt(); | 384 * buf.getInt(); |
385 */ | 385 */ |
386 | 386 |
387 if(im_type != QQ_RECV_IM_UNKNOWN_QUN_IM) | 387 if(msg_type != QQ_MSG_UNKNOWN_QUN_IM) |
388 skip_len = 10; | 388 skip_len = 10; |
389 else | 389 else |
390 skip_len = 0; | 390 skip_len = 0; |
391 bytes += skip_len; | 391 bytes += skip_len; |
392 | 392 |