Changeset 16ea00d


Ignore:
Timestamp:
2018-02-11T21:27:17Z (6 years ago)
Author:
dequis <dx@…>
Branches:
master
Children:
8167346
Parents:
1dcbd3e
Message:

root_commands: Improve 'chat add' error/success messages

This handles the most common error case with an obvious error message
(channel already exists, join it, etc), and the rarer ones with vague
but different wording. For those cases:

  • "Could not add chatroom." This wording is not present in this version anymore, likely means the channel already exists.
  • "Error creating channel for chatroom." irc_channel_new() failed but the channel doesn't exist already. This could be that some name validation failed, but this function already generates a suitable name.
  • "Error adding chatroom." irc_channel_new() succeeded, but one of the set_setstr() failed. There are account checks earlier, and the room setting is not normally validated at this point.

Can't really imagine situations where these vague errors would still
show up, but at least now you only get those for unknown cases.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • root_commands.c

    r1dcbd3e r16ea00d  
    13421342                    set_setstr(&ic->set, "account", cmd[2]) &&
    13431343                    set_setstr(&ic->set, "room", room)) {
    1344                         irc_rootmsg(irc, "Chatroom successfully added.");
     1344                        irc_rootmsg(irc, "Chatroom successfully added, join with \002/join %s\002", channel);
    13451345                } else {
    13461346                        if (ic) {
    13471347                                irc_channel_free(ic);
    1348                         }
    1349 
    1350                         irc_rootmsg(irc, "Could not add chatroom.");
     1348
     1349                                irc_rootmsg(irc, "Error adding chatroom.");
     1350                        } else if (irc_channel_by_name(irc, channel)) {
     1351                                irc_rootmsg(irc, "A channel named `%s' already exists. "
     1352                                            "Join with \002/join %s\002 or see \002help channel\002 to modify it",
     1353                                            channel, channel);
     1354                        } else {
     1355                                irc_rootmsg(irc, "Error creating channel for chatroom.");
     1356                        }
    13511357                }
    13521358                g_free(channel);
Note: See TracChangeset for help on using the changeset viewer.