mirror of https://github.com/nealey/irc-bot
Fix a few bugs
This commit is contained in:
parent
878830d39f
commit
959e88211e
|
@ -1,6 +1,4 @@
|
||||||
*.cmi
|
|
||||||
*.cmo
|
|
||||||
*~
|
*~
|
||||||
bot
|
*.o
|
||||||
.omake*
|
dispatch
|
||||||
.depend
|
irc
|
||||||
|
|
|
@ -21,7 +21,9 @@ join () {
|
||||||
|
|
||||||
case $command in
|
case $command in
|
||||||
001)
|
001)
|
||||||
join "#cobalt"
|
for chan in ${CHANNELS:-#cobalt}; do
|
||||||
|
join $chan
|
||||||
|
done
|
||||||
;;
|
;;
|
||||||
433)
|
433)
|
||||||
raw "NICK bottimus"
|
raw "NICK bottimus"
|
||||||
|
|
|
@ -173,10 +173,8 @@ call_with_lines(char *buf,
|
||||||
|
|
||||||
while ((p = memchr(b, '\n', l))) {
|
while ((p = memchr(b, '\n', l))) {
|
||||||
size_t n = p - b + 1;
|
size_t n = p - b + 1;
|
||||||
size_t buflen = n;
|
|
||||||
|
|
||||||
if ('\r' == *(p-1)) buflen -= 1;
|
func(b, n);
|
||||||
func(b, buflen);
|
|
||||||
l -= n;
|
l -= n;
|
||||||
b += n;
|
b += n;
|
||||||
}
|
}
|
||||||
|
|
2
firebot
2
firebot
|
@ -1,5 +1,7 @@
|
||||||
#! /bin/sh
|
#! /bin/sh
|
||||||
|
|
||||||
|
exec 2>&1
|
||||||
|
|
||||||
cmd=${1%% *}
|
cmd=${1%% *}
|
||||||
[ "$cmd" = "$1" ] || args=${1#* }
|
[ "$cmd" = "$1" ] || args=${1#* }
|
||||||
case $cmd in
|
case $cmd in
|
||||||
|
|
7
irc.c
7
irc.c
|
@ -65,6 +65,10 @@ main(int argc, char *argv[])
|
||||||
line += 1;
|
line += 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Strip trailing carriage return */
|
||||||
|
while (*line) line += 1;
|
||||||
|
if ('\r' == *(line-1)) *(line-1) = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set command, converting to upper case */
|
/* Set command, converting to upper case */
|
||||||
|
@ -108,7 +112,8 @@ main(int argc, char *argv[])
|
||||||
sender = parts[1];
|
sender = parts[1];
|
||||||
forum = sender;
|
forum = sender;
|
||||||
} else if (0 == strcmp(cmd, "PING")) {
|
} else if (0 == strcmp(cmd, "PING")) {
|
||||||
dprintf(1, "PONG :%s\r\n", text);
|
printf("PONG :%s\r\n", text);
|
||||||
|
fflush(stdout);
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue