comparison main.c @ 416:8bb69e749d97

Rename some functions.
author Matti Hamalainen <ccr@tnsp.org>
date Thu, 24 May 2012 07:02:30 +0300
parents 8263cb88556a
children ccee77fe4525
comparison
equal deleted inserted replaced
415:8263cb88556a 416:8bb69e749d97
636 } 636 }
637 return FALSE; 637 return FALSE;
638 } 638 }
639 639
640 640
641 int nnproto_handle_user(nn_conn_t *conn) 641 int nnproto_parse_user(nn_conn_t *conn)
642 { 642 {
643 static const char *msg = "</USER><MESSAGE>"; 643 static const char *msg = "</USER><MESSAGE>";
644 char *p = conn->ptr; 644 char *p = conn->ptr;
645 BOOL isMine, isIgnored = FALSE; 645 BOOL isMine, isIgnored = FALSE;
646 char *s, *t, *userName; 646 char *s, *t, *userName;
752 th_free(userName); 752 th_free(userName);
753 return 0; 753 return 0;
754 } 754 }
755 755
756 756
757 int nnproto_handle_login(nn_conn_t *conn) 757 int nnproto_parse_login(nn_conn_t *conn)
758 { 758 {
759 char tmpStr[256]; 759 char tmpStr[256];
760 str_get_timestamp(tmpStr, sizeof(tmpStr), "%c"); 760 str_get_timestamp(tmpStr, sizeof(tmpStr), "%c");
761 761
762 if (!nn_conn_buf_strcmp(conn, "FAILURE>")) 762 if (!nn_conn_buf_strcmp(conn, "FAILURE>"))
773 else 773 else
774 return 1; 774 return 1;
775 } 775 }
776 776
777 777
778 int nnproto_handle_add_user(nn_conn_t *conn) 778 int nnproto_parse_add_user(nn_conn_t *conn)
779 { 779 {
780 char *p, *s, *str = conn->ptr; 780 char *p, *s, *str = conn->ptr;
781 nn_window_t *win; 781 nn_window_t *win;
782 782
783 s = nn_conn_buf_strstr(conn, "</ADD_USER>"); 783 s = nn_conn_buf_strstr(conn, "</ADD_USER>");
797 th_free(p); 797 th_free(p);
798 return 0; 798 return 0;
799 } 799 }
800 800
801 801
802 int nnproto_handle_delete_user(nn_conn_t *conn) 802 int nnproto_parse_delete_user(nn_conn_t *conn)
803 { 803 {
804 char *p, *s, *str = conn->ptr; 804 char *p, *s, *str = conn->ptr;
805 nn_window_t *win; 805 nn_window_t *win;
806 806
807 s = nn_conn_buf_strstr(conn, "</DELETE_USER>"); 807 s = nn_conn_buf_strstr(conn, "</DELETE_USER>");
821 th_free(p); 821 th_free(p);
822 return 0; 822 return 0;
823 } 823 }
824 824
825 825
826 int nnproto_handle_num_clients(nn_conn_t *conn) 826 int nnproto_parse_num_clients(nn_conn_t *conn)
827 { 827 {
828 nn_conn_buf_strstr(conn, "</NUMCLIENTS>"); 828 nn_conn_buf_strstr(conn, "</NUMCLIENTS>");
829 return 0; 829 return 0;
830 } 830 }
831 831
832 832
833 int nnproto_handle_boot(nn_conn_t *conn) 833 int nnproto_parse_boot(nn_conn_t *conn)
834 { 834 {
835 (void) conn; 835 (void) conn;
836 errorMsg("Booted by server.\n"); 836 errorMsg("Booted by server.\n");
837 return -1; 837 return -1;
838 } 838 }
846 } nn_protocolcmd_t; 846 } nn_protocolcmd_t;
847 847
848 848
849 static nn_protocolcmd_t protoCmds[] = 849 static nn_protocolcmd_t protoCmds[] =
850 { 850 {
851 { "<USER>", -1, nnproto_handle_user }, 851 { "<USER>", -1, nnproto_parse_user },
852 { "<LOGIN_", -1, nnproto_handle_login }, 852 { "<LOGIN_", -1, nnproto_parse_login },
853 { "<DELETE_USER>", -1, nnproto_handle_delete_user }, 853 { "<DELETE_USER>", -1, nnproto_parse_delete_user },
854 { "<ADD_USER>", -1, nnproto_handle_add_user }, 854 { "<ADD_USER>", -1, nnproto_parse_add_user },
855 { "<NUMCLIENTS>", -1, nnproto_handle_num_clients }, 855 { "<NUMCLIENTS>", -1, nnproto_parse_num_clients },
856 { "<BOOT />", -1, nnproto_handle_boot }, 856 { "<BOOT />", -1, nnproto_parse_boot },
857 }; 857 };
858 858
859 static const int nprotoCmds = sizeof(protoCmds) / sizeof(protoCmds[0]); 859 static const int nprotoCmds = sizeof(protoCmds) / sizeof(protoCmds[0]);
860 860
861 861