|
@@ -2142,15 +2142,15 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
2142
|
2142
|
rb.Add(nil, server.name, ERR_NEEDREGGEDNICK, client.Nick(), tnick, client.t("Direct messages from unregistered users are temporarily restricted"))
|
2143
|
2143
|
return
|
2144
|
2144
|
}
|
|
2145
|
+ // restrict messages appropriately when +R is set
|
|
2146
|
+ if details.account == "" && user.HasMode(modes.RegisteredOnly) {
|
|
2147
|
+ rb.Add(nil, server.name, ERR_NEEDREGGEDNICK, client.Nick(), tnick, client.t("You must be registered to send a direct message to this user"))
|
|
2148
|
+ return
|
|
2149
|
+ }
|
2145
|
2150
|
nickMaskString := details.nickMask
|
2146
|
2151
|
accountName := details.accountName
|
2147
|
2152
|
var deliverySessions []*Session
|
2148
|
|
- // restrict messages appropriately when +R is set
|
2149
|
|
- // intentionally make the sending user think the message went through fine
|
2150
|
|
- allowedPlusR := details.account != "" || !user.HasMode(modes.RegisteredOnly)
|
2151
|
|
- if allowedPlusR {
|
2152
|
|
- deliverySessions = append(deliverySessions, user.Sessions()...)
|
2153
|
|
- }
|
|
2153
|
+ deliverySessions = append(deliverySessions, user.Sessions()...)
|
2154
|
2154
|
// all sessions of the sender, except the originating session, get a copy as well:
|
2155
|
2155
|
if client != user {
|
2156
|
2156
|
for _, session := range client.Sessions() {
|
|
@@ -2183,10 +2183,6 @@ func dispatchMessageToTarget(client *Client, tags map[string]string, histType hi
|
2183
|
2183
|
}
|
2184
|
2184
|
}
|
2185
|
2185
|
|
2186
|
|
- if !allowedPlusR {
|
2187
|
|
- return
|
2188
|
|
- }
|
2189
|
|
-
|
2190
|
2186
|
config := server.Config()
|
2191
|
2187
|
if !config.History.Enabled {
|
2192
|
2188
|
return
|