Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • irc_im.c

    r1aacef41 r5535a47  
    5050
    5151        memset(nick, 0, MAX_NICK_LENGTH + 1);
    52         strcpy(nick, nick_get(bu));
     52        strncpy(nick, nick_get(bu), MAX_NICK_LENGTH);
    5353
    5454        bu->ui_data = iu = irc_user_new(irc, nick);
     
    576576        ic->data = c;
    577577
    578         if (ic->topic == NULL) {
    579                 /* New channel with no preset topic - make up a generic one */
    580                 topic = g_strdup_printf(
    581                         "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!",
    582                         c->title);
    583                 irc_channel_set_topic(ic, topic, irc->root);
    584         } else {
    585                 /* Preset topic from the channel we picked */
    586                 topic = g_strdup(ic->topic);
    587         }
    588 
    589         g_free(c->topic);
    590         c->topic = topic;         /* Let groupchat borrow this pointer */
     578        topic = g_strdup_printf(
     579                "BitlBee groupchat: \"%s\". Please keep in mind that root-commands won't work here. Have fun!",
     580                c->title);
     581        irc_channel_set_topic(ic, topic, irc->root);
     582        g_free(topic);
    591583
    592584        return TRUE;
     
    608600        c->ui_data = NULL;
    609601        irc_channel_del_user(ic, ic->irc->user, IRC_CDU_KICK, "Chatroom closed by server");
    610 
    611         return TRUE;
    612 }
    613 
    614 static gboolean bee_irc_chat_placeholder_new(bee_t *bee, struct im_connection *ic, const char *handle,
    615                                              const char *name, const char *topic)
    616 {
    617         irc_t *irc = bee->ui_data;
    618         irc_channel_t *ircc;
    619         char *full_name = irc_channel_name_gen(irc, name);
    620 
    621         ircc = irc_channel_new(irc, full_name);
    622 
    623         set_setstr(&ircc->set, "type", "chat");
    624         set_setstr(&ircc->set, "chat_type", "placeholder");
    625         set_setstr(&ircc->set, "account", ic->acc->tag);
    626         set_setstr(&ircc->set, "room", (char *) handle);
    627 
    628         irc_channel_set_topic(ircc, topic, NULL);
    629 
    630         g_free(full_name);
    631602
    632603        return TRUE;
     
    752723                        g_free(channel);
    753724                        channel = s;
     725                } else {
     726                        g_free(s);
    754727                }
    755728        }
     
    853826static gboolean bee_irc_channel_chat_join(irc_channel_t *ic)
    854827{
    855         char *acc_s, *room, *chat_type;
     828        char *acc_s, *room;
    856829        account_t *acc;
    857830
    858         chat_type = set_getstr(&ic->set, "chat_type");
    859 
    860         if (strcmp(chat_type, "room") != 0 && strcmp(chat_type, "placeholder") != 0) {
     831        if (strcmp(set_getstr(&ic->set, "chat_type"), "room") != 0) {
    861832                return TRUE;
    862833        }
     
    1014985        struct irc_channel *ic = set->data;
    1015986
    1016         ic->flags &= ~(IRC_CHANNEL_TEMP | IRC_CHANNEL_KEEP_PLACEHOLDER);
    1017 
    1018987        if (strcmp(value, "groupchat") == 0) {
    1019988                ic->flags |= IRC_CHANNEL_TEMP;
    1020989        } else if (strcmp(value, "room") == 0) {
    1021                 // beep boop
    1022         } else if (strcmp(value, "placeholder") == 0) {
    1023                 ic->flags |= IRC_CHANNEL_TEMP | IRC_CHANNEL_KEEP_PLACEHOLDER;
     990                ic->flags &= ~IRC_CHANNEL_TEMP;
    1024991        } else {
    1025992                return NULL;
     
    11051072        bee_irc_chat_new,
    11061073        bee_irc_chat_free,
    1107         bee_irc_chat_placeholder_new,
    11081074        bee_irc_chat_log,
    11091075        bee_irc_chat_msg,
Note: See TracChangeset for help on using the changeset viewer.