# HG changeset patch # User Evan Schoenberg # Date 1168398833 0 # Node ID 745f090c1549a0196c4902b10e1ab580b23b39f0 # Parent e9db26a103eb61c198f9e001d4dbad220f99e54f [gaim-migrate @ 18098] Patch 1609805 from Anders Kaseorg, who writes: This patch fixes two bugs when a user "enters" a Zephyr "chat room": - The IP address was displayed incorrectly. - The "entered the room" message was displayed after the message. Without patch: (11:20:42 PM) andersk test: First message. (11:20:42 PM) Anders Kaseorg [18.-13.2.92] entered the room. (11:20:47 PM) andersk test: Second message. With patch: (11:20:42 PM) Anders Kaseorg [18.243.2.92] entered the room. (11:20:42 PM) andersk test: First message. (11:20:47 PM) andersk test: Second message. committer: Tailor Script diff -r e9db26a103eb -r 745f090c1549 libgaim/protocols/zephyr/zephyr.c --- a/libgaim/protocols/zephyr/zephyr.c Tue Jan 09 21:16:58 2007 +0000 +++ b/libgaim/protocols/zephyr/zephyr.c Wed Jan 10 03:13:53 2007 +0000 @@ -931,24 +931,19 @@ send_inst_utf8 = "malformed instance"; } - serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); - g_free(send_inst); gconv1 = gaim_find_conversation_with_account(GAIM_CONV_TYPE_CHAT, zt2->name, gc->account); gcc = gaim_conversation_get_chat_data(gconv1); if (!gaim_conv_chat_find_user(gcc, sendertmp)) { - /* force interpretation in network byte order */ - unsigned char *addrs = (unsigned char *)&(notice.z_sender_addr.s_addr); - gchar* ipaddr = g_strdup_printf("%hhd.%hhd.%hhd.%hhd", (unsigned char)addrs[0], - (unsigned char)addrs[1], (unsigned char)addrs[2], - (unsigned char) addrs[3]); - + gchar ipaddr[INET_ADDRSTRLEN]; + inet_ntop(AF_INET, ¬ice.z_sender_addr.s_addr, ipaddr, sizeof(ipaddr)); + gaim_conv_chat_add_user(gcc, sendertmp, ipaddr, GAIM_CBFLAGS_NONE, TRUE); - g_free(ipaddr); /* fix memory leak? */ - } g_free(sendertmp); + serv_got_chat_in(gc, zt2->id, send_inst_utf8, 0, buf3, time(NULL)); + g_free(send_inst); g_free(send_inst_utf8); free_triple(zt1);