Fix godless heathen bugs
This commit is contained in:
parent
4b2a66d6e2
commit
e38e0d7575
22
src/irc.c
22
src/irc.c
@ -143,18 +143,16 @@ event_channel(irc_session_t * lsession,
|
||||
(void) origin;
|
||||
(void) message;
|
||||
(void) count;
|
||||
/* parses the command */
|
||||
if (*message == PREFIX_COMMAND_CHAR)
|
||||
{ current_username = get_username(origin); }
|
||||
if (!current_username ||
|
||||
message[1] == '\0')
|
||||
/* fetches username and logs message */
|
||||
if (!(current_username = get_username(origin)))
|
||||
{ return; }
|
||||
/* Logs the message */
|
||||
printf("<%s> %s\n", current_username, message);
|
||||
/* Detects any re specified names */
|
||||
/* Detects any respecified names */
|
||||
/* message += parse_secondary_username(message); */
|
||||
/* Parse any commands */
|
||||
parse_command(message+1);
|
||||
/* Parse commands */
|
||||
if (*message == PREFIX_COMMAND_CHAR &&
|
||||
message[1] != '\0')
|
||||
{ parse_command(message+1); }
|
||||
free(current_username);
|
||||
current_username = NULL;
|
||||
}
|
||||
@ -250,10 +248,12 @@ parse_command(char const * cmd)
|
||||
#endif /* 0 */
|
||||
if (strncmp(cmd, "magic", 5) == 0)
|
||||
{ ircmsg(creds.channel, "%s: " IRC_YELLOW "%d" IRC_STOP, current_username, (rand() % atoi(arg)) + 1); }
|
||||
else if (strncmp(cmd, "echo", 3) == 0)
|
||||
{ ircmsg(creds.channel, "%s", arg); }
|
||||
else if (strncmp(cmd, "poll", 4) == 0)
|
||||
{
|
||||
yes = no = 0;
|
||||
vote_count = atoi(arg) + 1;
|
||||
vote_count = atoi(arg);
|
||||
if (!vote_count)
|
||||
{ ircmsg(creds.channel, "!poll NUMBER_OF_VOTES What your voting on ..."); }
|
||||
else
|
||||
@ -271,7 +271,7 @@ parse_command(char const * cmd)
|
||||
default: ircmsg(creds.channel, "Unknown: '%c', use y/n", *arg); goto stop;
|
||||
}
|
||||
if (--vote_count)
|
||||
{ ircmsg(creds.channel, "Votes remaining: %d", vote_count - 1); }
|
||||
{ ircmsg(creds.channel, "Votes remaining: %d", vote_count); }
|
||||
else
|
||||
{ ircmsg(creds.channel, "poll: %s", MAX(yes,no) ? "PASSED" : "REJECTED"); }
|
||||
}
|
||||
|
Reference in New Issue
Block a user