Changeset b1dc403 for irc_im.c


Ignore:
Timestamp:
2015-05-04T21:58:50Z (9 years ago)
Author:
Wilmer van der Gaast <wilmer@…>
Children:
5726a0d
Parents:
531eabd (diff), 5ca1416 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Catch up with master.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r531eabd rb1dc403  
    235235                        } else {
    236236                                /* Modules can swallow messages. */
    237                                 return TRUE;
     237                                goto cleanup;
    238238                        }
    239239                }
     
    250250        wrapped = word_wrap(msg, 425);
    251251        irc_send_msg(iu, "PRIVMSG", dst, wrapped, prefix);
    252 
    253252        g_free(wrapped);
     253
     254cleanup:
    254255        g_free(prefix);
    255256        g_free(msg);
     
    291292
    292293        irc_send_msg((irc_user_t *) bu->ui_data, "NOTICE", irc->user->nick, msg->str, NULL);
     294
     295        g_string_free(msg, TRUE);
    293296
    294297        return TRUE;
     
    693696static gboolean bee_irc_chat_name_hint(bee_t *bee, struct groupchat *c, const char *name)
    694697{
    695         irc_t *irc = bee->ui_data;
    696         irc_channel_t *ic = c->ui_data, *oic;
    697         char stripped[MAX_NICK_LENGTH + 1], *full_name;
    698 
    699         if (ic == NULL) {
    700                 return FALSE;
    701         }
    702 
    703         /* Don't rename a channel if the user's in it already. */
    704         if (ic->flags & IRC_CHANNEL_JOINED) {
    705                 return FALSE;
    706         }
    707 
    708         strncpy(stripped, name, MAX_NICK_LENGTH);
    709         stripped[MAX_NICK_LENGTH] = '\0';
    710         irc_channel_name_strip(stripped);
    711         if (set_getbool(&bee->set, "lcnicks")) {
    712                 nick_lc(irc, stripped);
    713         }
    714 
    715         if (stripped[0] == '\0') {
    716                 return FALSE;
    717         }
    718 
    719         full_name = g_strdup_printf("#%s", stripped);
    720         if ((oic = irc_channel_by_name(irc, full_name))) {
    721                 char *type, *chat_type;
    722 
    723                 type = set_getstr(&oic->set, "type");
    724                 chat_type = set_getstr(&oic->set, "chat_type");
    725 
    726                 if (type && chat_type && oic->data == FALSE &&
    727                     strcmp(type, "chat") == 0 &&
    728                     strcmp(chat_type, "groupchat") == 0) {
    729                         /* There's a channel with this name already, but it looks
    730                            like it's not in use yet. Most likely the IRC client
    731                            rejoined the channel after a reconnect. Remove it so
    732                            we can reuse its name. */
    733                         irc_channel_free(oic);
    734                 } else {
    735                         g_free(full_name);
    736                         return FALSE;
    737                 }
    738         }
    739 
    740         g_free(ic->name);
    741         ic->name = full_name;
    742 
    743         return TRUE;
     698        return irc_channel_name_hint(c->ui_data, name);
    744699}
    745700
Note: See TracChangeset for help on using the changeset viewer.