Changeset 220 in code for trunk/service.go


Ignore:
Timestamp:
Apr 4, 2020, 3:34:30 PM (5 years ago)
Author:
delthas
Message:

Fill all fields of the service user prefix

On some IRC clients, NOTICE messages from a user which does not have a
user or host in its prefix (and therefore only have a Name, and look
like prefixes of servers), are treated as server notices rather than
user notices, and are treated differently. (For that matter, soju also
considers NOTICE messages from users with only a Name in their prefix as
special server messages). On most of these clients, NOTICE messages from
a user are formatted differently and stand out from the large flow of
incoming misceallenous server messages.

This fills the service user with fake User and Host values so that
NOTICE messages from it correctly appear as coming from a user. This
is particularly useful in the context of connection and disconnect
errors NOTICE messages that are broadcast from the service user to all
relevant downstreams.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/service.go

    r219 r220  
    1313const serviceNick = "BouncerServ"
    1414
     15var servicePrefix = &irc.Prefix{
     16        Name: serviceNick,
     17        User: serviceNick,
     18        Host: serviceNick,
     19}
     20
    1521type serviceCommandSet map[string]*serviceCommand
    1622
     
    2430func sendServiceNOTICE(dc *downstreamConn, text string) {
    2531        dc.SendMessage(&irc.Message{
    26                 Prefix:  &irc.Prefix{Name: serviceNick},
     32                Prefix:  servicePrefix,
    2733                Command: "NOTICE",
    2834                Params:  []string{dc.nick, text},
     
    3238func sendServicePRIVMSG(dc *downstreamConn, text string) {
    3339        dc.SendMessage(&irc.Message{
    34                 Prefix:  &irc.Prefix{Name: serviceNick},
     40                Prefix:  servicePrefix,
    3541                Command: "PRIVMSG",
    3642                Params:  []string{dc.nick, text},
Note: See TracChangeset for help on using the changeset viewer.