Browse Source

Merge pull request #470 from slingamn/issue468_followup

strip out the +a away mode
tags/v1.1.0-rc1
Shivaram Lingamneni 5 years ago
parent
commit
29fad23e5a
No account linked to committer's email address
8 changed files with 24 additions and 13 deletions
  1. 0
    4
      docs/MANUAL.md
  2. 1
    1
      irc/channel.go
  3. 1
    0
      irc/client.go
  4. 16
    0
      irc/getters.go
  5. 3
    4
      irc/handlers.go
  6. 1
    2
      irc/modes/modes.go
  7. 1
    1
      irc/roleplay.go
  8. 1
    1
      irc/server.go

+ 0
- 4
docs/MANUAL.md View File

@@ -315,10 +315,6 @@ In this section, we give an overview of the modes Oragono supports.
315 315
 
316 316
 These are the modes which can be set on you when you're connected.
317 317
 
318
-### +a - Away
319
-
320
-If this mode is set, you're marked as 'away'. To set and unset this mode, you use the `/AWAY` command.
321
-
322 318
 ### +i - Invisible
323 319
 
324 320
 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).

+ 1
- 1
irc/channel.go View File

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

+ 1
- 0
irc/client.go View File

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

+ 16
- 0
irc/getters.go View File

@@ -141,6 +141,22 @@ func (client *Client) Realname() string {
141 141
 	return client.realname
142 142
 }
143 143
 
144
+func (client *Client) Away() (result bool) {
145
+	client.stateMutex.Lock()
146
+	result = client.away
147
+	client.stateMutex.Unlock()
148
+	return
149
+}
150
+
151
+func (client *Client) SetAway(away bool, awayMessage string) (changed bool) {
152
+	client.stateMutex.Lock()
153
+	changed = away != client.away
154
+	client.away = away
155
+	client.awayMessage = awayMessage
156
+	client.stateMutex.Unlock()
157
+	return
158
+}
159
+
144 160
 // uniqueIdentifiers returns the strings for which the server enforces per-client
145 161
 // uniqueness/ownership; no two clients can have colliding casefolded nicks or
146 162
 // skeletons.

+ 3
- 4
irc/handlers.go View File

@@ -466,8 +466,7 @@ func awayHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *Resp
466 466
 		}
467 467
 	}
468 468
 
469
-	client.SetMode(modes.Away, isAway)
470
-	client.SetAwayMessage(awayMessage)
469
+	client.SetAway(isAway, awayMessage)
471 470
 
472 471
 	if isAway {
473 472
 		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
2030 2029
 					session.sendSplitMsgFromClientInternal(false, now, nickMaskString, accountName, clientOnlyTags, msg.Command, tnick, splitMsg)
2031 2030
 				}
2032 2031
 			}
2033
-			if histType != history.Notice && user.HasMode(modes.Away) {
2032
+			if histType != history.Notice && user.Away() {
2034 2033
 				//TODO(dan): possibly implement cooldown of away notifications to users
2035 2034
 				rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
2036 2035
 			}
@@ -2499,7 +2498,7 @@ func userhostHandler(server *Server, client *Client, msg ircmsg.IrcMessage, rb *
2499 2498
 		if target.HasMode(modes.Operator) {
2500 2499
 			isOper = "*"
2501 2500
 		}
2502
-		if target.HasMode(modes.Away) {
2501
+		if target.Away() {
2503 2502
 			isAway = "-"
2504 2503
 		} else {
2505 2504
 			isAway = "+"

+ 1
- 2
irc/modes/modes.go View File

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

+ 1
- 1
irc/roleplay.go View File

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

+ 1
- 1
irc/server.go View File

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

Loading…
Cancel
Save