From 732061027ec0d83db224e81df0fd1b3905a3cdec Mon Sep 17 00:00:00 2001 From: dequis Date: Sat, 7 Mar 2015 01:10:59 -0300 Subject: Various user experience/error reporting improvements - Show version as part of the initial message of &bitlbee - Use g_strerror() to show actual errors when saving xml configs - Only show "The nick is (probably) not registered" for ENOENT, use g_strerror() for the rest of OS errors when loading xml configs - Show "Protocol not found: " when find_protocol() returns null, useful when the user uninstalls a plugin accidentally. - Suggest the user to check the system clock when getting error 401 from the twitter stream (other REST endpoints show a better error message) --- irc.c | 4 +++- protocols/twitter/twitter_lib.c | 3 +++ storage_xml.c | 15 +++++++++++---- 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/irc.c b/irc.c index 429e1ad2..6b3fa737 100644 --- a/irc.c +++ b/irc.c @@ -763,11 +763,13 @@ int irc_check_login(irc_t *irc) irc_rootmsg(irc, "Welcome to the BitlBee gateway!\n\n" + "Running %s %s\n\n" "If you've never used BitlBee before, please do read the help " "information using the \x02help\x02 command. Lots of FAQs are " "answered there.\n" "If you already have an account on this server, just use the " - "\x02identify\x02 command to identify yourself."); + "\x02identify\x02 command to identify yourself.", + PACKAGE, BITLBEE_VERSION); /* This is for bug #209 (use PASS to identify to NickServ). */ if (irc->password != NULL) { diff --git a/protocols/twitter/twitter_lib.c b/protocols/twitter/twitter_lib.c index 05932bef..2da38337 100644 --- a/protocols/twitter/twitter_lib.c +++ b/protocols/twitter/twitter_lib.c @@ -861,6 +861,9 @@ static void twitter_http_stream(struct http_request *req) } imcb_error(ic, "Stream closed (%s)", req->status_string); + if (req->status_code == 401) { + imcb_error(ic, "Check your system clock."); + } imc_logout(ic, TRUE); return; } diff --git a/storage_xml.c b/storage_xml.c index 0dd4ec53..38a73d87 100644 --- a/storage_xml.c +++ b/storage_xml.c @@ -102,6 +102,10 @@ static xt_status handle_account(struct xt_node *node, gpointer data) protocol = xt_find_attr(node, "protocol"); if (protocol) { prpl = find_protocol(protocol); + if (!prpl) { + irc_rootmsg(xd->irc, "Error loading user config: Protocol not found: `%s'", protocol); + return XT_ABORT; + } local = protocol_account_islocal(protocol); } @@ -196,7 +200,11 @@ static storage_status_t xml_load_real(irc_t *irc, const char *my_nick, const cha fn = g_strconcat(global.conf->configdir, xd->given_nick, ".xml", NULL); if ((fd = open(fn, O_RDONLY)) < 0) { - ret = STORAGE_NO_SUCH_USER; + if (errno == ENOENT) { + ret = STORAGE_NO_SUCH_USER; + } else { + irc_rootmsg(irc, "Error loading user config: %s", g_strerror(errno)); + } goto error; } @@ -376,8 +384,7 @@ static storage_status_t xml_save(irc_t *irc, int overwrite) strcat(path, ".XXXXXX"); if ((fd = mkstemp(path)) < 0) { - irc_rootmsg(irc, "Error while opening configuration file."); - return STORAGE_OTHER_ERROR; + goto error; } tree = xml_generate(irc); @@ -399,7 +406,7 @@ static storage_status_t xml_save(irc_t *irc, int overwrite) goto finish; error: - irc_rootmsg(irc, "Write error. Disk full?"); + irc_rootmsg(irc, "Write error: %s", g_strerror(errno)); ret = STORAGE_OTHER_ERROR; finish: -- cgit v1.2.3