summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2019-10-17 19:44:46 -0700
committerOri Bernstein <ori@eigenstate.org>2019-10-17 19:45:34 -0700
commit2f4b821ef292c55b9296e65308e9e95cdf610a06 (patch)
treecb8f15cb1ece84ff35c017ed9760373f1c2307ba
parent777033348977a2350f2a9d051f33711acabfc79e (diff)
downloadirc.myr-2f4b821ef292c55b9296e65308e9e95cdf610a06.tar.gz
Fix leave.
-rw-r--r--irc.myr25
1 files changed, 14 insertions, 11 deletions
diff --git a/irc.myr b/irc.myr
index 15a5d7f..03faef9 100644
--- a/irc.myr
+++ b/irc.myr
@@ -40,6 +40,7 @@ const io = {irc, fd
| `std.None: -> void
;;
+ status(irc, irc.self, "server said: {}\n", ln)
(src, cmd, args) = parse(ln)
a0 = args.len > 0 ? args[0] : ""
uppercase(cmd)
@@ -195,20 +196,22 @@ const deluser = {irc, srv, user
}
const delchanuser = {irc, srv, user, args
- var c
-
if args.len == 0
-> void
;;
- c = name2chan(irc, srv, args[0])
- user = displayname(user)
- match std.lsearch(c.users, user, std.strcmp)
- | `std.None: /* ignore */
- | `std.Some i:
- std.slfree(c.users[i])
- std.sldel(&c.users, i)
- puthist(irc, c, (std.now(), `Part std.sldup(user)))
+ for c : srv.chan
+ if std.strcasecmp(c.name, args[0]) == `std.Equal
+ user = displayname(user)
+ match std.lsearch(c.users, user, std.strcmp)
+ | `std.None: /* ignore */
+ | `std.Some i:
+ std.slfree(c.users[i])
+ std.sldel(&c.users, i)
+ puthist(irc, c, (std.now(), `Part std.sldup(user)))
+ ;;
+ ;;
;;
+
}
const fd2srv = {irc, fd
@@ -516,7 +519,7 @@ const leave = {irc, args
srv = irc.srv[irc.focus]
for var i = 0; i < srv.chan.len; i++
c = srv.chan[i]
- if std.strcasecmp(name, c.name) != `std.Equal
+ if std.strcasecmp(name, c.name) == `std.Equal
send(irc, srv, "PART {}\r\n", name)
std.sldel(&srv.chan, i)
if i == srv.focus