comparison libpurple/protocols/gg/gg.c @ 31449:7db33b356d4a

This patch from kkszysiu and tomkiewicz implements full typing notification support for Gadu-Gadu. Fixes #13590.
author John Bailey <rekkanoryo@rekkanoryo.org>
date Thu, 07 Apr 2011 01:29:17 +0000
parents bcaa76a01b42
children 66b30e47caec
comparison
equal deleted inserted replaced
31448:1ae16c9b2164 31449:7db33b356d4a
1608 1608
1609 from = g_strdup_printf("%u", uin); 1609 from = g_strdup_printf("%u", uin);
1610 if (length) 1610 if (length)
1611 serv_got_typing(gc, from, 0, PURPLE_TYPING); 1611 serv_got_typing(gc, from, 0, PURPLE_TYPING);
1612 else 1612 else
1613 serv_got_typing(gc, from, 0, PURPLE_NOT_TYPING); 1613 serv_got_typing_stopped(gc, from);
1614 g_free(from); 1614 g_free(from);
1615 } 1615 }
1616 1616
1617 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond) 1617 static void ggp_callback_recv(gpointer _gc, gint fd, PurpleInputCondition cond)
1618 { 1618 {
2237 2237
2238 g_free(plain); 2238 g_free(plain);
2239 g_free(tmp); 2239 g_free(tmp);
2240 2240
2241 return ret; 2241 return ret;
2242 }
2243
2244 static unsigned int ggp_send_typing(PurpleConnection *gc, const char *name, PurpleTypingState state)
2245 {
2246 int dummy_length; // we don't send real length of typed message
2247
2248 if (state == PURPLE_TYPED) // not supported
2249 return 1;
2250
2251 if (state == PURPLE_TYPING)
2252 dummy_length = (int)g_random_int();
2253 else // PURPLE_NOT_TYPING
2254 dummy_length = 0;
2255
2256 gg_typing_notification(
2257 ((GGPInfo*)gc->proto_data)->session,
2258 ggp_str_to_uin(name),
2259 dummy_length);
2260
2261 return 1; // wait 1 second before another notification
2242 } 2262 }
2243 2263
2244 static void ggp_get_info(PurpleConnection *gc, const char *name) 2264 static void ggp_get_info(PurpleConnection *gc, const char *name)
2245 { 2265 {
2246 GGPInfo *info = gc->proto_data; 2266 GGPInfo *info = gc->proto_data;
2544 NULL, /* chat_info_defaults */ 2564 NULL, /* chat_info_defaults */
2545 ggp_login, /* login */ 2565 ggp_login, /* login */
2546 ggp_close, /* close */ 2566 ggp_close, /* close */
2547 ggp_send_im, /* send_im */ 2567 ggp_send_im, /* send_im */
2548 NULL, /* set_info */ 2568 NULL, /* set_info */
2549 NULL, /* send_typing */ 2569 ggp_send_typing, /* send_typing */
2550 ggp_get_info, /* get_info */ 2570 ggp_get_info, /* get_info */
2551 ggp_set_status, /* set_away */ 2571 ggp_set_status, /* set_away */
2552 NULL, /* set_idle */ 2572 NULL, /* set_idle */
2553 NULL, /* change_passwd */ 2573 NULL, /* change_passwd */
2554 ggp_add_buddy, /* add_buddy */ 2574 ggp_add_buddy, /* add_buddy */