150 snprintf (msg, 512, "PRIVMSG %s :%s\r\n", message->channel, COMMAND_LIST[0]); |
150 snprintf (msg, 512, "PRIVMSG %s :%s\r\n", message->channel, COMMAND_LIST[0]); |
151 return msg; |
151 return msg; |
152 |
152 |
153 case JOIN: |
153 case JOIN: |
154 if ((token = strtok (NULL, "\r\n"))) |
154 if ((token = strtok (NULL, "\r\n"))) |
155 snprintf (msg, 512, "JOIN %s\r\n", token); |
155 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
|
156 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
157 snprintf (msg, 512, "JOIN %s\r\n", token); |
|
158 } |
156 return msg; |
159 return msg; |
157 |
160 |
158 case LEAVE: |
161 case LEAVE: |
159 if (*message->channel != '#') |
162 if (*message->channel != '#') |
160 return NULL; |
163 return NULL; |
161 snprintf (msg, 512, "PART %s :Leaving.\r\n", message->channel); |
164 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
|
165 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
166 snprintf (msg, 512, "PART %s :Leaving.\r\n", message->channel); |
|
167 } |
162 return msg; |
168 return msg; |
163 |
169 |
164 case ADD: |
170 case ADD: |
165 if ((token = strtok (NULL, " "))) { |
171 if ((token = strtok (NULL, " "))) { |
166 if ((parameters = strtok (NULL, "\r\n"))) { |
172 if ((parameters = strtok (NULL, "\r\n"))) { |
286 } |
292 } |
287 return msg; |
293 return msg; |
288 |
294 |
289 case OP: |
295 case OP: |
290 if ((token = strtok (NULL, "\r\n")) != NULL) { |
296 if ((token = strtok (NULL, "\r\n")) != NULL) { |
291 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
297 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
292 snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token); |
298 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
299 snprintf (msg, 512, "MODE %s +o %s\r\n", message->channel, token); |
|
300 } |
293 } |
301 } |
294 return msg; |
302 return msg; |
295 |
303 |
296 case DEOP: |
304 case DEOP: |
297 if ((token = strtok (NULL, "\r\n")) != NULL) { |
305 if ((token = strtok (NULL, "\r\n")) != NULL) { |
298 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
306 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
299 snprintf (msg, 512, "MODE %s -o %s\r\n", message->channel, token); |
307 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
308 snprintf (msg, 512, "MODE %s -o %s\r\n", message->channel, token); |
|
309 } |
300 } |
310 } |
301 return msg; |
311 return msg; |
302 |
312 |
303 case KICK: |
313 case KICK: |
304 if ((token = strtok (NULL, "\r\n")) != NULL) { |
314 if ((token = strtok (NULL, "\r\n")) != NULL) { |
305 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
315 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
306 snprintf (msg, 512, "KICK %s %s\r\n", message->channel, token); |
316 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
317 snprintf (msg, 512, "KICK %s %s\r\n", message->channel, token); |
|
318 } |
307 } |
319 } |
308 return msg; |
320 return msg; |
309 |
321 |
310 case BAN: |
322 case BAN: |
311 if ((token = strtok (NULL, "\r\n")) != NULL) { |
323 if ((token = strtok (NULL, "\r\n")) != NULL) { |
312 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
324 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
313 snprintf (msg, 512, "MODE %s +b %s\r\n", message->channel, token); |
325 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
326 snprintf (msg, 512, "MODE %s +b %s\r\n", message->channel, token); |
|
327 } |
314 } |
328 } |
315 return msg; |
329 return msg; |
316 |
330 |
317 case UNBAN: |
331 case UNBAN: |
318 if ((token = strtok (NULL, "\r\n")) != NULL) { |
332 if ((token = strtok (NULL, "\r\n")) != NULL) { |
319 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
333 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
320 snprintf (msg, 512, "MODE %s -b %s\r\n", message->channel, token); |
334 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
|
335 snprintf (msg, 512, "MODE %s -b %s\r\n", message->channel, token); |
|
336 } |
321 } |
337 } |
322 return msg; |
338 return msg; |
323 |
339 |
324 case KICKBAN: |
340 case KICKBAN: |
325 if ((token = strtok (NULL, "\r\n")) != NULL) { |
341 if ((token = strtok (NULL, "\r\n")) != NULL) { |
326 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
342 if (strstr (message->user, db_lookup (DATABASE_FILE, "mcbot.user"))) { |
327 snprintf (msg, 512, "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token, |
343 if (strstr (message->email, db_lookup (DATABASE_FILE, "mcbot.email"))) |
328 message->channel, token); |
344 snprintf (msg, 512, "MODE %s +b %s\r\nKICK %s %s\r\n", message->channel, token, |
|
345 message->channel, token); |
|
346 } |
329 } |
347 } |
330 return msg; |
348 return msg; |
331 } |
349 } |
332 } |
350 } |
333 i++; |
351 i++; |