Mercurial > hg > nnchat
comparison nnchat.c @ 303:859578ec3275
Fix encoding of usernames in /query and /close.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Sat, 11 Jun 2011 04:50:00 +0300 |
parents | 388c22d6ab44 |
children | e2da8c812f56 |
comparison
equal
deleted
inserted
replaced
302:a3170f477ae2 | 303:859578ec3275 |
---|---|
871 return 0; | 871 return 0; |
872 } | 872 } |
873 else if (!strncasecmp(buf, "/query", 6)) { | 873 else if (!strncasecmp(buf, "/query", 6)) { |
874 char *name = trimLeft(buf + 6); | 874 char *name = trimLeft(buf + 6); |
875 if (strlen(name) > 0) { | 875 if (strlen(name) > 0) { |
876 nn_user_t *user = nn_user_find(nnUsers, name); | 876 nn_user_t *user = nn_user_find(nnUsers, nn_username_encode(name)); |
877 if (user != NULL) { | 877 if (user != NULL) { |
878 printMsg(currWin, "Opening PRV query for '%s'.\n", user->name); | 878 name = nn_username_decode(th_strdup(user->name)); |
879 if (openWindow(user->name, TRUE)) | 879 printMsg(currWin, "Opening PRV query for '%s'.\n", name); |
880 printMsg(currWin, "In PRV query with '%s'.\n", user->name); | 880 if (openWindow(name, TRUE)) |
881 printMsg(currWin, "In PRV query with '%s'.\n", name); | |
882 th_free(name); | |
881 } | 883 } |
882 } else { | 884 } else { |
883 printMsg(currWin, "Usage: /query username\n"); | 885 printMsg(currWin, "Usage: /query username\n"); |
884 printMsg(currWin, "To close a PRV query, use /close [username]\n"); | 886 printMsg(currWin, "To close a PRV query, use /close [username]\n"); |
885 printMsg(currWin, "/close without username will close the current PRV window (if any).\n"); | 887 printMsg(currWin, "/close without username will close the current PRV window.\n"); |
886 } | 888 } |
887 return 0; | 889 return 0; |
888 } | 890 } |
889 else if (!strncasecmp(buf, "/close", 6)) { | 891 else if (!strncasecmp(buf, "/close", 6)) { |
890 char *name = trimLeft(buf + 6); | 892 char *name = trimLeft(buf + 6); |
891 if (strlen(name) > 0) { | 893 if (strlen(name) > 0) { |
892 nn_window_t *win = nn_find_window(name); | 894 nn_window_t *win; |
895 win = nn_find_window(name); | |
893 if (win != NULL) { | 896 if (win != NULL) { |
894 closeWindow(win); | 897 closeWindow(win); |
898 printMsg(currWin, "Closed PRV query to '%s'.\n", name); | |
895 } else { | 899 } else { |
896 printMsg(currWin, "No PRV query by name '%s'.\n", name); | 900 printMsg(currWin, "No PRV query by name '%s'.\n", name); |
897 } | 901 } |
898 } else { | 902 } else { |
899 if (currWin != chatWindows[0]) { | 903 if (currWin != chatWindows[0]) { |