Mercurial > pidgin
changeset 9437:d9f8658b305d
[gaim-migrate @ 10258]
" As wing had mentioned on #gaim, zephyr.c had
declarations after statements, causing problems with
pre-C99 compilers.
I've moved the declarations around to fix this, and
also properly un-indented code to improve readability.
Oh, and my previous slash commands patch had mixed up
the descriptions of /inst and /instance . This fixes it." --Arun A Tharuvai
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Thu, 01 Jul 2004 22:21:31 +0000 |
parents | 1ddcc9caa538 |
children | 7837b2c8fb8c |
files | src/protocols/zephyr/zephyr.c |
diffstat | 1 files changed, 46 insertions(+), 49 deletions(-) [+] |
line wrap: on
line diff
--- a/src/protocols/zephyr/zephyr.c Thu Jul 01 15:58:24 2004 +0000 +++ b/src/protocols/zephyr/zephyr.c Thu Jul 01 22:21:31 2004 +0000 @@ -649,7 +649,10 @@ g_free(stripped_sender); } else { zephyr_triple *zt1, *zt2; - + GList *gltmp; + int found = 0; + gchar *send_inst_utf8; + zt1 = new_triple(notice.z_class, notice.z_class_inst, notice.z_recipient); zt2 = find_sub_by_triple(zt1); if (!zt2) { @@ -657,53 +660,47 @@ subscrips = g_slist_append(subscrips, zt1); zt2 = find_sub_by_triple(zt1); } - /*else { */ - GList *gltmp; - int found = 0; - gchar *send_inst_utf8; - /* GError *err; */ - if (!zt2->open) { - zt2->open = TRUE; - serv_got_joined_chat(zgc, zt2->id, zt2->name); - zephyr_chat_set_topic(zgc,zt2->id,notice.z_class_inst); - } - g_free(sendertmp); /* fix memory leak? */ - /* If the person is in the default Realm, then strip the - Realm from the sender field */ - sendertmp = zephyr_strip_foreign_realm(notice.z_sender); - send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); - send_inst_utf8 = zephyr_recv_convert(send_inst, strlen(send_inst)); - if (!send_inst_utf8) { - fprintf(stderr, "zephyr: send_inst %s became null\n",send_inst); - gaim_debug(GAIM_DEBUG_ERROR, "zephyr","send_inst %s became null\n", send_inst); - send_inst_utf8 = "malformed instance"; - } - - serv_got_chat_in(zgc, zt2->id, send_inst_utf8, FALSE, buf3, time(NULL)); - g_free(send_inst); - gconv1 = gaim_find_conversation_with_account(zt2->name, zgc->account); - gcc = gaim_conversation_get_chat_data(gconv1); - - for (gltmp = gaim_conv_chat_get_users(gcc); gltmp; gltmp = gltmp->next) { - if (!g_ascii_strcasecmp(gltmp->data, sendertmp)) - found = 1; - } - if (!found) { - /* 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]); - - gaim_conv_chat_add_user(gcc, sendertmp, ipaddr); - g_free(ipaddr); /* fix memory leak? */ - - } - g_free(sendertmp); - g_free(send_inst_utf8); - - /* } */ + if (!zt2->open) { + zt2->open = TRUE; + serv_got_joined_chat(zgc, zt2->id, zt2->name); + zephyr_chat_set_topic(zgc,zt2->id,notice.z_class_inst); + } + g_free(sendertmp); /* fix memory leak? */ + /* If the person is in the default Realm, then strip the + Realm from the sender field */ + sendertmp = zephyr_strip_foreign_realm(notice.z_sender); + send_inst = g_strdup_printf("%s %s",sendertmp,notice.z_class_inst); + send_inst_utf8 = zephyr_recv_convert(send_inst, strlen(send_inst)); + if (!send_inst_utf8) { + fprintf(stderr, "zephyr: send_inst %s became null\n",send_inst); + gaim_debug(GAIM_DEBUG_ERROR, "zephyr","send_inst %s became null\n", send_inst); + send_inst_utf8 = "malformed instance"; + } + + serv_got_chat_in(zgc, zt2->id, send_inst_utf8, FALSE, buf3, time(NULL)); + g_free(send_inst); + gconv1 = gaim_find_conversation_with_account(zt2->name, zgc->account); + gcc = gaim_conversation_get_chat_data(gconv1); + + for (gltmp = gaim_conv_chat_get_users(gcc); gltmp; gltmp = gltmp->next) { + if (!g_ascii_strcasecmp(gltmp->data, sendertmp)) + found = 1; + } + if (!found) { + /* 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]); + + gaim_conv_chat_add_user(gcc, sendertmp, ipaddr); + g_free(ipaddr); /* fix memory leak? */ + + } + g_free(sendertmp); + g_free(send_inst_utf8); + free_triple(zt1); } g_free(buf3); @@ -1476,12 +1473,12 @@ gaim_cmd_register("instance","s", GAIM_CMD_P_PRPL, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, "prpl-zephyr", - zephyr_gaim_cmd_instance, _("inst <instance>: Set the instance to be used on this class")); + zephyr_gaim_cmd_instance, _("instance <instance>: Set the instance to be used on this class")); gaim_cmd_register("inst","s", GAIM_CMD_P_PRPL, GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY, "prpl-zephyr", - zephyr_gaim_cmd_instance, _("instance <instance>: Set the instance to be used on this class")); + zephyr_gaim_cmd_instance, _("inst <instance>: Set the instance to be used on this class")); gaim_cmd_register("sub", "www", GAIM_CMD_P_PRPL, GAIM_CMD_FLAG_IM | GAIM_CMD_FLAG_CHAT | GAIM_CMD_FLAG_PRPL_ONLY,