Mercurial > hg > nnchat
changeset 430:aaadf6cea6be
Better handling of some messages.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 24 May 2012 14:10:47 +0300 |
parents | 2ac24f1e241b |
children | a9b20b31cae1 |
files | main.c |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/main.c Thu May 24 13:05:31 2012 +0300 +++ b/main.c Thu May 24 14:10:47 2012 +0300 @@ -646,12 +646,15 @@ // Find start of the message name = conn->ptr; - t = nn_conn_buf_strstr(conn, "</USER><MESSAGE>"); + t = nn_conn_buf_strstr(conn, "</USER>"); if (!t) return 1; *t = 0; - msg = conn->ptr; // Find end of the message + t = nn_conn_buf_strstr(conn, "<MESSAGE>"); + if (!t) return 2; + msg = conn->ptr; + t = nn_conn_buf_strstr(conn, "</MESSAGE>"); if (!t) return 3; *t = 0; @@ -756,11 +759,13 @@ if (!nn_conn_buf_strcmp(conn, "FAILURE>")) { + nn_conn_buf_strstr(conn, "</LOGIN_FAILURE>"); printMsg(NULL, "½1½Login failure½0½ - ½3½%s½0½\n", tmpStr); return -2; } else if (!nn_conn_buf_strcmp(conn, "SUCCESS>")) { + nn_conn_buf_strstr(conn, "</LOGIN_SUCCESS>"); printMsg(NULL, "½2½Login success½0½ - ½3½%s½0½\n", tmpStr); nn_conn_send_msg(conn, optUserNameEnc, "%2FRequestUserList"); return 0;