Changeset d45051e in code
- Timestamp:
- Jun 17, 2014, 11:31:02 AM (11 years ago)
- Branches:
- master
- Children:
- 9440414
- Parents:
- 383d37b
- git-author:
- Mike Belopuhov <mike@…> (06/17/14 11:30:10)
- git-committer:
- Mike Belopuhov <mike@…> (06/17/14 11:31:02)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
icb.c
r383d37b rd45051e 35 35 void icb_command(struct icb_session *, char *, char *); 36 36 void icb_groupmsg(struct icb_session *, char *); 37 voidicb_login(struct icb_session *, char *, char *, char *);37 int icb_login(struct icb_session *, char *, char *, char *); 38 38 int icb_dowho(struct icb_session *, struct icb_group *); 39 39 char *icb_nextfield(char **, int); … … 71 71 * icb_input: main input processing routine 72 72 */ 73 void 73 int 74 74 icb_input(struct icb_session *is) 75 75 { 76 76 char *msg = is->buffer; 77 77 unsigned char type; 78 int res = 0; 78 79 79 80 is->last = getmonotime(); … … 82 83 if (!ISSETF(is->flags, ICB_SF_LOGGEDIN) && type != ICB_M_LOGIN) { 83 84 icb_error(is, "Not logged in"); 84 return ;85 return (0); 85 86 } 86 87 switch (type) { … … 95 96 icb_error(is, "Command not implemented"); 96 97 icbd_drop(is, NULL); 97 return ;98 return (1); 98 99 } 99 100 if (strlen(cmd) == 0 || strcmp(cmd, "login") != 0) { 100 101 icb_error(is, "Malformed login packet"); 101 102 icbd_drop(is, NULL); 102 return ;103 } 104 icb_login(is, group, nick, client);103 return (1); 104 } 105 res = icb_login(is, group, nick, client); 105 106 break; 106 107 } … … 132 133 icb_error(is, "Undefined message type %u", type); 133 134 } 135 return (res); 134 136 } 135 137 … … 137 139 * icb_login: handles login ('a') packets 138 140 */ 139 void 141 int 140 142 icb_login(struct icb_session *is, char *grp, char *nick, char *client) 141 143 { … … 149 151 icb_error(is, "Invalid nick"); 150 152 icbd_drop(is, NULL); 151 return ;153 return (1); 152 154 } 153 155 if (!grp || strlen(grp) == 0) … … 163 165 icb_error(is, "Invalid group %s", group); 164 166 icbd_drop(is, NULL); 165 return ;167 return (1); 166 168 } else { 167 169 if ((ig = icb_addgroup(is, group, NULL)) == NULL) { 168 170 icb_error(is, "Can't create group %s", group); 169 return ;171 return (0); 170 172 } 171 173 icbd_log(NULL, LOG_DEBUG, "%s created group %s", … … 177 179 icb_error(is, "Nick is already in use"); 178 180 icbd_drop(is, NULL); 179 return ;181 return (1); 180 182 } 181 183 } … … 207 209 icb_status(is, STATUS_TOPIC, "Topic for %s is \"%s\"", 208 210 ig->name, ig->topic); 211 return (0); 209 212 } 210 213 -
icb.h
r383d37b rd45051e 125 125 void icb_error(struct icb_session *, const char *, ...); 126 126 void icb_init(void); 127 voidicb_input(struct icb_session *);127 int icb_input(struct icb_session *); 128 128 inline int icb_ismod(struct icb_group *, struct icb_session *); 129 129 int icb_modpermit(struct icb_session *, int); -
icbd.c
r383d37b rd45051e 386 386 is->buffer[MIN(is->rlen, ICB_MSGSIZE - 1)] = '\0'; 387 387 /* process the message in full */ 388 icb_input(is); 388 if (icb_input(is)) 389 return; 389 390 is->rlen = is->length = 0; 390 391 }
Note:
See TracChangeset
for help on using the changeset viewer.