12 Commits

Author SHA1 Message Date
.
a609996484 readme
--HG--
branch : nmdc-ircfrontend
2016-08-27 17:42:24 +12:00
.
0ec1c20d7e whois: better output format
--HG--
branch : nmdc-ircfrontend
2016-08-27 15:27:50 +12:00
.
3cffacaa45 fixes for 3d8672ff5b9c
--HG--
branch : nmdc-ircfrontend
2016-08-27 14:32:16 +12:00
.
e0e5c742e3 add -version option to display version and quit
--HG--
branch : nmdc-ircfrontend
2016-08-27 14:20:27 +12:00
.
7494823b07 implant version number at build time
--HG--
branch : nmdc-ircfrontend
2016-08-27 14:18:20 +12:00
.
7b2ab6642b WHOIS support (needs testing)
--HG--
branch : nmdc-ircfrontend
2016-08-27 14:07:02 +12:00
.
f1051fbfc2 doc: update todo
--HG--
branch : nmdc-ircfrontend
2016-08-27 14:06:27 +12:00
.
73a4134b18 readme: demote liteirc to with-bugs section
--HG--
branch : nmdc-ircfrontend
2016-08-27 13:21:24 +12:00
.
962cc8dea0 reuse const
--HG--
branch : nmdc-ircfrontend
2016-08-27 12:38:21 +12:00
.
9bde052d9d todo
--HG--
branch : nmdc-ircfrontend
2016-05-10 19:45:28 +12:00
.
eabae2ce9b readme
--HG--
branch : nmdc-ircfrontend
2016-05-10 19:21:28 +12:00
.
10f4db39cc Added tag release-1.1.0 for changeset 34892054c343
--HG--
branch : nmdc-ircfrontend
2016-05-10 19:18:21 +12:00
7 changed files with 61 additions and 8 deletions

View File

@@ -1 +1,2 @@
da295cede46d95848348292e04e54fa5a5713ae3 release-1.0.0
34892054c34384edeafa2b04a483697d7d8a73a3 release-1.1.0

View File

@@ -4,6 +4,8 @@ BUGS
- /wrong/ password message shows up, but not if no password was given for a passworded nick
- tags not showing up in ncdc
WISHLIST
@@ -13,10 +15,6 @@ WISHLIST
- automatic markdown bold/italic formatting
- support WHOIS
- respond to CTCP VERSION with the clienttag on behalf of other users
- support USERIP/KILL/KICK for ops
- use CTCP chat to support irc-special characters in chat messages (colon, newline)

View File

@@ -8,6 +8,8 @@ TLS (SSL) support is not integrated. To host the IRC frontend over TLS, please u
This program uses some code from the AGPLv3 project https://github.com/eXeC64/Rosella , from which it inherits the Affero GPLv3 license. Anyone hosting a modified version of this software is required to release their changes under the terms of the AGPLv3.
Written in golang
Tags: nmdc, AGPLv3
=FEATURES=
@@ -47,13 +49,13 @@ Everything works:
- Hexchat
- Mango IRC
- AndroIRC
- Lite IRC
- Mutter
- Weechat
- mIRC 7
- HoloIRC (after version 4.1.0)
Usable, with bugs:
- Lite IRC - The username and nickname fields must be identical
- HoloIRC (4.1.0 and earlier) - Can't parse client tag, upstream bug https://github.com/tilal6991/HoloIRC/issues/140
- AndChat - Duplicate usernames appear, upstream bug https://github.com/znc/znc/issues/424
- Irssi - Ignorable warning "critical nicklist_set_host: assertion 'host != NULL' failed"
@@ -63,6 +65,13 @@ Unusable:
=CHANGELOG=
2016-08-27 1.2.0
- Feature: Support WHOIS (display NMDC user's description + client software)
- Feature: `-version` command-line option
- Compatibility: Demote 'Lite IRC' to 'Usable with bugs' section
- Update libnmdc to r9 (fix protocol issues)
- Update golang to 1.7 (smaller binary size)
2016-05-10 1.1.0
- Feature: Support renaming own client during connection (`/nick`)
- Enhancement: Option to set Hub-Security nick (needed for initial CTCP, upgraded after upstream connection)

View File

@@ -97,7 +97,7 @@ single_build() {
# Build.
# GOARCH/GOOS supplied in function env
go build -a -ldflags '-s -w' -o "$(pathfix "${tmpdir}/${local_bin_name}")"
go build -a -ldflags "-s -w -X main.APP_VERSION=${version}" -o "$(pathfix "${tmpdir}/${local_bin_name}")"
# Sanitise.
sanitise "${tmpdir}/${local_bin_name}"

View File

@@ -29,13 +29,19 @@ func main() {
ircAddress := flag.String("bind", ":6667", "The address:port to bind to and listen for clients on")
dcAddress := flag.String("upstream", "127.0.0.1:411", "Upstream NMDC server")
serverName := flag.String("servername", "nmdc-ircfrontend", "Server name displayed to clients")
serverName := flag.String("servername", APP_NAME, "Server name displayed to clients")
hubsec := flag.String("hubsecurity", "Hub-Security", "Nick used for administrative events")
verbose := flag.Bool("verbose", false, "Display debugging information")
autojoin := flag.Bool("autojoin", true, "Automatically join clients to the channel")
version := flag.Bool("version", false, "Display version and exit")
flag.Parse()
if *version {
log.Printf("%s version %s\n", APP_NAME, APP_VERSION)
return
}
log.Printf("Listening on '%s'...", *ircAddress)
if *autojoin {
log.Printf("Clients will be automatically joined to the channel.")

View File

@@ -657,6 +657,35 @@ func (s *Server) handleJoinedCommand(command string, args []string) {
return
case "WHOIS":
if len(args) < 1 {
s.reply(errMoreArgs)
return
}
// WHOIS [target] nick[,nick2[,nick...]]
nicklist := args[0] // Assume WHOIS ${nick} only,
if len(args) >= 2 {
nicklist = args[1] // It was WHOIS ${target} ${nick} instead
}
for _, targetnick := range strings.Split(nicklist, ",") {
// tell the client something about it
// The protocol does ostensibly support wildcard WHOIS, but we don't (yet)
s.upstream.Users(func(u *map[string]libnmdc.UserInfo) error {
for nick, nickinfo := range *u {
if nick == targetnick {
s.reply(rplWhoisUser, nick, nickinfo.Description+" <"+nickinfo.ClientTag+" V:"+nickinfo.ClientVersion+">")
if nickinfo.IsOperator {
s.reply(rplWhoisOperator, nick)
}
}
}
return nil
})
s.reply(rplEndOfWhois)
}
default:
s.reply(errUnknownCommand, command)
}
@@ -815,6 +844,13 @@ func (s *Server) reply(code replyCode, args ...string) {
case rplPong:
s.writeClient(fmt.Sprintf(":%s PONG %s %s", s.name, s.clientNick(), args[0]))
case rplWhoisUser:
s.writeClient(fmt.Sprintf(":%s 311 %s %s %s %s * :%s", s.name, args[0], args[0], args[0], s.name, args[1])) // caller should supply nick,description
case rplWhoisOperator:
s.writeClient(fmt.Sprintf(":%s 313 %s :is an IRC operator", s.name, args[0]))
case rplEndOfWhois:
s.writeClient(fmt.Sprintf(":%s 318 :End of WHOIS list", s.name))
case errMoreArgs:
s.writeClient(fmt.Sprintf(":%s 461 %s :Not enough params", s.name, s.clientNick()))
case errNoNick:

View File

@@ -19,7 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
const (
APP_VERSION = "1.1.0"
APP_VERSION = "1.x.x-dev" // override with build ldflags
APP_NAME = "nmdc-ircfrontend"
BLESSED_CHANNEL = "#chat" // must be lowercase
BLESSED_CHANNEL_MODE = "n" // means that you have to be in the channel to chat, but that's it
@@ -56,6 +56,9 @@ const (
rplMOTD
rplEndOfMOTD
rplPong
rplWhoisUser
rplWhoisOperator
rplEndOfWhois
errMoreArgs
errNoNick
errInvalidNick