3
0
mirror of https://github.com/ergochat/ergo.git synced 2024-11-26 22:09:24 +01:00

Merge pull request #470 from slingamn/issue468_followup

strip out the +a away mode
This commit is contained in:
Shivaram Lingamneni 2019-04-28 20:50:44 -04:00 committed by GitHub
commit 29fad23e5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 24 additions and 13 deletions

View File

@ -315,10 +315,6 @@ In this section, we give an overview of the modes Oragono supports.
These are the modes which can be set on you when you're connected. These are the modes which can be set on you when you're connected.
### +a - Away
If this mode is set, you're marked as 'away'. To set and unset this mode, you use the `/AWAY` command.
### +i - Invisible ### +i - Invisible
If this mode is set, you're marked as 'invisible'. This means that your channels won't be shown when users `/WHOIS` you (except for IRC operators, they can see all the channels you're in). If this mode is set, you're marked as 'invisible'. This means that your channels won't be shown when users `/WHOIS` you (except for IRC operators, they can see all the channels you're in).

View File

@ -1166,7 +1166,7 @@ func (channel *Channel) Invite(invitee *Client, inviter *Client, rb *ResponseBuf
tnick := invitee.Nick() tnick := invitee.Nick()
rb.Add(nil, inviter.server.name, RPL_INVITING, cnick, tnick, chname) rb.Add(nil, inviter.server.name, RPL_INVITING, cnick, tnick, chname)
invitee.Send(nil, inviter.NickMaskString(), "INVITE", tnick, chname) invitee.Send(nil, inviter.NickMaskString(), "INVITE", tnick, chname)
if invitee.HasMode(modes.Away) { if invitee.Away() {
rb.Add(nil, inviter.server.name, RPL_AWAY, cnick, tnick, invitee.AwayMessage()) rb.Add(nil, inviter.server.name, RPL_AWAY, cnick, tnick, invitee.AwayMessage())
} }
} }

View File

@ -49,6 +49,7 @@ type Client struct {
account string account string
accountName string // display name of the account: uncasefolded, '*' if not logged in accountName string // display name of the account: uncasefolded, '*' if not logged in
atime time.Time atime time.Time
away bool
awayMessage string awayMessage string
certfp string certfp string
channels ChannelSet channels ChannelSet

View File

@ -141,6 +141,22 @@ func (client *Client) Realname() string {
return client.realname return client.realname
} }
func (client *Client) Away() (result bool) {
client.stateMutex.Lock()
result = client.away
client.stateMutex.Unlock()
return
}
func (client *Client) SetAway(away bool, awayMessage string) (changed bool) {
client.stateMutex.Lock()
changed = away != client.away
client.away = away
client.awayMessage = awayMessage
client.stateMutex.Unlock()
return
}
// uniqueIdentifiers returns the strings for which the server enforces per-client // uniqueIdentifiers returns the strings for which the server enforces per-client
// uniqueness/ownership; no two clients can have colliding casefolded nicks or // uniqueness/ownership; no two clients can have colliding casefolded nicks or
// skeletons. // skeletons.

View File

@ -466,8 +466,7 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
} }
} }
client.SetMode(modes.Away, isAway) client.SetAway(isAway, awayMessage)
client.SetAwayMessage(awayMessage)
if isAway { if isAway {
rb.Add(nil, server.name, RPL_NOWAWAY, client.nick, client.t("You have been marked as being away")) rb.Add(nil, server.name, RPL_NOWAWAY, client.nick, client.t("You have been marked as being away"))
@ -2030,7 +2029,7 @@ func messageHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *R
session.sendSplitMsgFromClientInternal(false, now, nickMaskString, accountName, clientOnlyTags, msg.Command, tnick, splitMsg) session.sendSplitMsgFromClientInternal(false, now, nickMaskString, accountName, clientOnlyTags, msg.Command, tnick, splitMsg)
} }
} }
if histType != history.Notice && user.HasMode(modes.Away) { if histType != history.Notice && user.Away() {
//TODO(dan): possibly implement cooldown of away notifications to users //TODO(dan): possibly implement cooldown of away notifications to users
rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage()) rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
} }
@ -2499,7 +2498,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *
if target.HasMode(modes.Operator) { if target.HasMode(modes.Operator) {
isOper = "*" isOper = "*"
} }
if target.HasMode(modes.Away) { if target.Away() {
isAway = "-" isAway = "-"
} else { } else {
isAway = "+" isAway = "+"

View File

@ -15,7 +15,7 @@ import (
var ( var (
// SupportedUserModes are the user modes that we actually support (modifying). // SupportedUserModes are the user modes that we actually support (modifying).
SupportedUserModes = Modes{ SupportedUserModes = Modes{
Away, Bot, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying, Bot, Invisible, Operator, RegisteredOnly, ServerNotice, UserRoleplaying,
} }
// SupportedChannelModes are the channel modes that we support. // SupportedChannelModes are the channel modes that we support.
@ -107,7 +107,6 @@ func (modes Modes) String() string {
// User Modes // User Modes
const ( const (
Away Mode = 'a'
Bot Mode = 'B' Bot Mode = 'B'
Invisible Mode = 'i' Invisible Mode = 'i'
LocalOperator Mode = 'O' LocalOperator Mode = 'O'

View File

@ -75,7 +75,7 @@ func sendRoleplayMessage(server *Server, client *Client, source string, targetSt
if rb.session.capabilities.Has(caps.EchoMessage) { if rb.session.capabilities.Has(caps.EchoMessage) {
rb.Add(nil, source, "PRIVMSG", tnick, message) rb.Add(nil, source, "PRIVMSG", tnick, message)
} }
if user.HasMode(modes.Away) { if user.Away() {
//TODO(dan): possibly implement cooldown of away notifications to users //TODO(dan): possibly implement cooldown of away notifications to users
rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage()) rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
} }

View File

@ -548,7 +548,7 @@ func (target *Client) rplWhoReply(channel *Channel, client *Client, rb *Response
channelName := "*" channelName := "*"
flags := "" flags := ""
if client.HasMode(modes.Away) { if client.Away() {
flags = "G" flags = "G"
} else { } else {
flags = "H" flags = "H"