libpurple/protocols/zephyr/zephyr.c

branch
soc.2013.gobjectification
changeset 34670
9bd5bd903dc7
parent 34653
88ae47a7d595
child 34696
6e0d13978666
equal deleted inserted replaced
34669:250f77369396 34670:9bd5bd903dc7
860 && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) { 860 && !g_ascii_strcasecmp(notice.z_recipient,zephyr->username)) {
861 if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:")) 861 if (!g_ascii_strcasecmp(notice.z_message, "Automated reply:"))
862 flags |= PURPLE_MESSAGE_AUTO_RESP; 862 flags |= PURPLE_MESSAGE_AUTO_RESP;
863 863
864 if (!g_ascii_strcasecmp(notice.z_opcode,"PING")) 864 if (!g_ascii_strcasecmp(notice.z_opcode,"PING"))
865 serv_got_typing(gc,stripped_sender,ZEPHYR_TYPING_RECV_TIMEOUT, PURPLE_IM_CONVERSATION_TYPING); 865 serv_got_typing(gc,stripped_sender,ZEPHYR_TYPING_RECV_TIMEOUT, PURPLE_IM_TYPING);
866 else 866 else
867 serv_got_im(gc, stripped_sender, buf3, flags, time(NULL)); 867 serv_got_im(gc, stripped_sender, buf3, flags, time(NULL));
868 868
869 } else { 869 } else {
870 zephyr_triple *zt1, *zt2; 870 zephyr_triple *zt1, *zt2;
906 #ifdef HAVE_INET_NTOP 906 #ifdef HAVE_INET_NTOP
907 inet_ntop(AF_INET, &notice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr)); 907 inet_ntop(AF_INET, &notice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr));
908 #else 908 #else
909 memcpy(ipaddr,inet_ntoa(notice.z_sender_addr),sizeof(ipaddr)); 909 memcpy(ipaddr,inet_ntoa(notice.z_sender_addr),sizeof(ipaddr));
910 #endif 910 #endif
911 purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, PURPLE_CHAT_CONVERSATION_BUDDY_NONE, TRUE); 911 purple_chat_conversation_add_user(gcc, stripped_sender, ipaddr, PURPLE_CHAT_USER_NONE, TRUE);
912 } 912 }
913 serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); 913 serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL));
914 g_free(send_inst_utf8); 914 g_free(send_inst_utf8);
915 915
916 free_triple(zt1); 916 free_triple(zt1);
2529 static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b) 2529 static const char *zephyr_list_icon(PurpleAccount * a, PurpleBuddy * b)
2530 { 2530 {
2531 return "zephyr"; 2531 return "zephyr";
2532 } 2532 }
2533 2533
2534 static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleIMConversationTypingState state) { 2534 static unsigned int zephyr_send_typing(PurpleConnection *gc, const char *who, PurpleIMTypingState state) {
2535 gchar *recipient; 2535 gchar *recipient;
2536 zephyr_account *zephyr = purple_connection_get_protocol_data(gc); 2536 zephyr_account *zephyr = purple_connection_get_protocol_data(gc);
2537 if (use_tzc(zephyr)) 2537 if (use_tzc(zephyr))
2538 return 0; 2538 return 0;
2539 2539
2540 if (state == PURPLE_IM_CONVERSATION_NOT_TYPING) 2540 if (state == PURPLE_IM_NOT_TYPING)
2541 return 0; 2541 return 0;
2542 2542
2543 /* XXX We probably should care if this fails. Or maybe we don't want to */ 2543 /* XXX We probably should care if this fails. Or maybe we don't want to */
2544 if (!who) { 2544 if (!who) {
2545 purple_debug_info("zephyr", "who is null\n"); 2545 purple_debug_info("zephyr", "who is null\n");
2559 zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING"); 2559 zephyr_send_message(zephyr,"MESSAGE","PERSONAL",recipient,"","","PING");
2560 purple_debug_info("zephyr","sent typing notification\n"); 2560 purple_debug_info("zephyr","sent typing notification\n");
2561 2561
2562 /* 2562 /*
2563 * TODO: Is this correct? It means we will call 2563 * TODO: Is this correct? It means we will call
2564 * serv_send_typing(gc, who, PURPLE_IM_CONVERSATION_TYPING) once every 15 seconds 2564 * serv_send_typing(gc, who, PURPLE_IM_TYPING) once every 15 seconds
2565 * until the Purple user stops typing. 2565 * until the Purple user stops typing.
2566 */ 2566 */
2567 return ZEPHYR_TYPING_SEND_TIMEOUT; 2567 return ZEPHYR_TYPING_SEND_TIMEOUT;
2568 } 2568 }
2569 2569

mercurial