diff options
author | James Booth <boothj5@gmail.com> | 2012-10-21 11:37:11 -0700 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2012-10-21 11:37:11 -0700 |
commit | 382e961563eb9e4d31d3ad111a41569b7fa78fa6 (patch) | |
tree | afdbde8745e87f17c6525203a28010bf6f52d466 /src/profanity.c | |
parent | 4e05e919b257906c2fef824c9a1745c259d4af20 (diff) | |
parent | 46b8a21cfb49d64dbb190b38192934df25de0fb8 (diff) | |
download | profani-tty-382e961563eb9e4d31d3ad111a41569b7fa78fa6.tar.gz |
Merge pull request #46 from pasis/master
Improved error handling. Handles when user does not exist at server, and when the server cannot be contacted (for example if the server name is typed incorrectly in the JID).
Diffstat (limited to 'src/profanity.c')
-rw-r--r-- | src/profanity.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/profanity.c b/src/profanity.c index 0b909935..7795389d 100644 --- a/src/profanity.c +++ b/src/profanity.c @@ -115,6 +115,24 @@ prof_handle_incoming_message(char *from, char *message) } void +prof_handle_error_message(const char *from, const char *err_msg) +{ + char *msg, *fmt; + + if (err_msg != NULL) { + fmt = "Error received from server: %s"; + msg = (char *)malloc(strlen(err_msg) + strlen(fmt) - 1); + if (msg == NULL) + goto loop_out; + sprintf(msg, fmt, err_msg); + cons_bad_show(msg); + free(msg); + } +loop_out: + win_show_error_msg(from, err_msg); +} + +void prof_handle_login_success(const char *jid) { const char *msg = " logged in successfully."; |