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
 
315
 
316
 These are the modes which can be set on you when you're connected.
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
 ### +i - Invisible
318
 ### +i - Invisible
323
 
319
 
324
 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).
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
 	tnick := invitee.Nick()
1166
 	tnick := invitee.Nick()
1167
 	rb.Add(nil, inviter.server.name, RPL_INVITING, cnick, tnick, chname)
1167
 	rb.Add(nil, inviter.server.name, RPL_INVITING, cnick, tnick, chname)
1168
 	invitee.Send(nil, inviter.NickMaskString(), "INVITE", tnick, chname)
1168
 	invitee.Send(nil, inviter.NickMaskString(), "INVITE", tnick, chname)
1169
-	if invitee.HasMode(modes.Away) {
1169
+	if invitee.Away() {
1170
 		rb.Add(nil, inviter.server.name, RPL_AWAY, cnick, tnick, invitee.AwayMessage())
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
 	account            string
49
 	account            string
50
 	accountName        string // display name of the account: uncasefolded, '*' if not logged in
50
 	accountName        string // display name of the account: uncasefolded, '*' if not logged in
51
 	atime              time.Time
51
 	atime              time.Time
52
+	away               bool
52
 	awayMessage        string
53
 	awayMessage        string
53
 	certfp             string
54
 	certfp             string
54
 	channels           ChannelSet
55
 	channels           ChannelSet

+ 16
- 0
irc/getters.go View File

141
 	return client.realname
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
 // uniqueIdentifiers returns the strings for which the server enforces per-client
160
 // uniqueIdentifiers returns the strings for which the server enforces per-client
145
 // uniqueness/ownership; no two clients can have colliding casefolded nicks or
161
 // uniqueness/ownership; no two clients can have colliding casefolded nicks or
146
 // skeletons.
162
 // skeletons.

+ 3
- 4
irc/handlers.go View File

466
 		}
466
 		}
467
 	}
467
 	}
468
 
468
 
469
-	client.SetMode(modes.Away, isAway)
470
-	client.SetAwayMessage(awayMessage)
469
+	client.SetAway(isAway, awayMessage)
471
 
470
 
472
 	if isAway {
471
 	if isAway {
473
 		rb.Add(nil, server.name, RPL_NOWAWAY, client.nick, client.t("You have been marked as being away"))
472
 		rb.Add(nil, server.name, RPL_NOWAWAY, client.nick, client.t("You have been marked as being away"))
2030
 					session.sendSplitMsgFromClientInternal(false, now, nickMaskString, accountName, clientOnlyTags, msg.Command, tnick, splitMsg)
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
 				//TODO(dan): possibly implement cooldown of away notifications to users
2033
 				//TODO(dan): possibly implement cooldown of away notifications to users
2035
 				rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
2034
 				rb.Add(nil, server.name, RPL_AWAY, cnick, tnick, user.AwayMessage())
2036
 			}
2035
 			}
2499
 		if target.HasMode(modes.Operator) {
2498
 		if target.HasMode(modes.Operator) {
2500
 			isOper = "*"
2499
 			isOper = "*"
2501
 		}
2500
 		}
2502
-		if target.HasMode(modes.Away) {
2501
+		if target.Away() {
2503
 			isAway = "-"
2502
 			isAway = "-"
2504
 		} else {
2503
 		} else {
2505
 			isAway = "+"
2504
 			isAway = "+"

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

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

+ 1
- 1
irc/roleplay.go View File

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

+ 1
- 1
irc/server.go View File

548
 	channelName := "*"
548
 	channelName := "*"
549
 	flags := ""
549
 	flags := ""
550
 
550
 
551
-	if client.HasMode(modes.Away) {
551
+	if client.Away() {
552
 		flags = "G"
552
 		flags = "G"
553
 	} else {
553
 	} else {
554
 		flags = "H"
554
 		flags = "H"

Loading…
Cancel
Save