# HG changeset patch # User Matti Hamalainen # Date 1307757000 -10800 # Node ID 859578ec3275213b4143a4fa6a9f2975c62c6ad5 # Parent a3170f477ae24e223c1bbffe4549fe3d8c15e7da Fix encoding of usernames in /query and /close. diff -r a3170f477ae2 -r 859578ec3275 nnchat.c --- a/nnchat.c Sat Jun 11 04:32:37 2011 +0300 +++ b/nnchat.c Sat Jun 11 04:50:00 2011 +0300 @@ -873,25 +873,29 @@ else if (!strncasecmp(buf, "/query", 6)) { char *name = trimLeft(buf + 6); if (strlen(name) > 0) { - nn_user_t *user = nn_user_find(nnUsers, name); + nn_user_t *user = nn_user_find(nnUsers, nn_username_encode(name)); if (user != NULL) { - printMsg(currWin, "Opening PRV query for '%s'.\n", user->name); - if (openWindow(user->name, TRUE)) - printMsg(currWin, "In PRV query with '%s'.\n", user->name); + name = nn_username_decode(th_strdup(user->name)); + printMsg(currWin, "Opening PRV query for '%s'.\n", name); + if (openWindow(name, TRUE)) + printMsg(currWin, "In PRV query with '%s'.\n", name); + th_free(name); } } else { printMsg(currWin, "Usage: /query username\n"); printMsg(currWin, "To close a PRV query, use /close [username]\n"); - printMsg(currWin, "/close without username will close the current PRV window (if any).\n"); + printMsg(currWin, "/close without username will close the current PRV window.\n"); } return 0; } else if (!strncasecmp(buf, "/close", 6)) { char *name = trimLeft(buf + 6); if (strlen(name) > 0) { - nn_window_t *win = nn_find_window(name); + nn_window_t *win; + win = nn_find_window(name); if (win != NULL) { closeWindow(win); + printMsg(currWin, "Closed PRV query to '%s'.\n", name); } else { printMsg(currWin, "No PRV query by name '%s'.\n", name); }