diff --git a/TODO.txt b/TODO.txt index 11436f6..4d4d241 100644 --- a/TODO.txt +++ b/TODO.txt @@ -2,18 +2,16 @@ PRE-RELEASE =========== -- detect our own /me messages + don't echo back - - client descriptions (CTCP USERINFO) -- expose upstream op status - - remove color code escape sequences WISHLIST ======== +- "implying" colours + - send client keepalives (PING) /and/ ensure we get a reply (PONG) - client version sync (CTCP VERSION) @@ -56,3 +54,7 @@ https://en.wikipedia.org/wiki/Client-to-client_protocol https://wiki.mibbit.com/index.php/Ctcp_(version) +https://github.com/eXeC64/Rosella AGPLv3 license + +https://github.com/edmund-huber/ergonomadic MIT license + diff --git a/server.go b/server.go index 69825e8..896843c 100644 --- a/server.go +++ b/server.go @@ -143,6 +143,7 @@ func (s *Server) RunWorker() { func (s *Server) upstreamWorker() { + // FIXME blank names work well in hexchat, but not in yaaic var BLANK_NICK = "" // "!@" + s.name // "PtokaX" // "\xC2\xA0" // Read loop @@ -180,20 +181,39 @@ func (s *Server) upstreamWorker() { s.sendChannelTopic(hubEvent.Nick) case libnmdc.EVENT_PRIVATE: - //s.reply(rplMsg, hubEvent.Nick, s.upstreamLauncher.Self.Nick, hubEvent.Message) s.reply(rplMsg, hubEvent.Nick+"!"+hubEvent.Nick+"@"+hubEvent.Nick, s.upstreamLauncher.Self.Nick, hubEvent.Message) case libnmdc.EVENT_PUBLIC: if hubEvent.Nick == s.upstreamLauncher.Self.Nick { // irc doesn't echo our own pubchat } else { - // s.reply(rplMsg, hubEvent.Nick, BLESSED_CHANNEL, hubEvent.Message) + // nick!username@userhost, but for us all three of those are always identical s.reply(rplMsg, hubEvent.Nick+"!"+hubEvent.Nick+"@"+hubEvent.Nick, BLESSED_CHANNEL, hubEvent.Message) } case libnmdc.EVENT_SYSTEM_MESSAGE_FROM_CONN, libnmdc.EVENT_SYSTEM_MESSAGE_FROM_HUB: - // FIXME blank names work well in hexchat, but not in yaaic - s.reply(rplMsg, BLANK_NICK, BLESSED_CHANNEL, hubEvent.Message) + words := strings.Split(hubEvent.Message, " ") + firstWord := words[0] + remainder := strings.Join(words[1:], " ") + if firstWord == "*" { + firstWord = words[1] + remainder = strings.Join(words[2:], " ") + } + + if s.upstream.UserExists(firstWord) { + // it's a /me in disguise - convert back to a CTCP ACTION + // If it's **our own** action, skip it + if firstWord != s.upstreamLauncher.Self.Nick { + s.reply( + rplMsg, firstWord+"!"+firstWord+"@"+firstWord, BLESSED_CHANNEL, + "\x01ACTION "+remainder+"\x01", + ) + } + + } else { + // genuine system message + s.reply(rplMsg, BLANK_NICK, BLESSED_CHANNEL, hubEvent.Message) + } } }