# HG changeset patch # User Matti Hamalainen # Date 1307753761 -10800 # Node ID d34910f1b1e1dbbad45163ea4bc673d74b89131e # Parent 786205414e34e47c4382d8df475630c2ced0a4af Print messages about user leaving or joining the chat in the specific buffer, too. Also, disable unhandled key warnings unless debug mode has been enabled. diff -r 786205414e34 -r d34910f1b1e1 nnchat.c --- a/nnchat.c Sat Jun 11 03:55:22 2011 +0300 +++ b/nnchat.c Sat Jun 11 03:56:01 2011 +0300 @@ -693,6 +693,7 @@ int handleAddUser(nn_conn_t *conn, const char *str) { char *p, *s = strstr(str, ""); + nn_window_t *win; (void) conn; @@ -702,9 +703,13 @@ p = nn_dbldecode_str(str); if (!p) return -1; + win = nn_find_window(p); nn_userhash_insert(nnUsers, nn_username_encode(p)); printMsg(NULL, "! ½3½%s½0½ ½2½ADDED.½0½\n", p); + if (win != NULL) + printMsg(win, "! ½3½%s½0½ ½2½joined the chat.½0½\n", p); + th_free(p); return 0; } @@ -713,6 +718,7 @@ int handleDeleteUser(nn_conn_t *conn, const char *str) { char *p, *s = strstr(str, ""); + nn_window_t *win; (void) conn; @@ -722,9 +728,13 @@ p = nn_dbldecode_str(str); if (!p) return -1; + win = nn_find_window(p); nn_userhash_delete(nnUsers, nn_username_encode(p)); printMsg(NULL, "! ½3½%s½0½ ½1½DELETED.½0½\n", p); + if (win != NULL) + printMsg(win, "! ½3½%s½0½ ½1½left the chat.½0½\n", p); + th_free(p); return 0; } @@ -1497,7 +1507,8 @@ case 'd': c = 0x204; break; case 'c': c = 0x206; break; default: - printMsg(currWin, "Unhandled ESC-O key sequence 0x%02x\n", c); + if (optDebug) + printMsg(currWin, "Unhandled ESC-O key sequence 0x%02x\n", c); break; } } else @@ -1522,7 +1533,8 @@ case 0x38: c = KEY_END; break; default: - printMsg(currWin, "Unhandled ESC-[*~ key sequence 0x%02x\n", c); + if (optDebug) + printMsg(currWin, "Unhandled ESC-[*~ key sequence 0x%02x\n", c); c = ERR; break; } @@ -1540,7 +1552,8 @@ c = ERR; } else { - printMsg(currWin, "Unhandled ESC key sequence 0x%02x\n", c); + if (optDebug) + printMsg(currWin, "Unhandled ESC key sequence 0x%02x\n", c); continue; } }