Browse Source

Merge pull request #385 from slingamn/fixes.2

2 small fixes
tags/v1.0.0-rc1
Daniel Oaks 5 years ago
parent
commit
355491d4e1
No account linked to committer's email address
3 changed files with 12 additions and 5 deletions
  1. 8
    1
      irc/accounts.go
  2. 4
    0
      irc/hostserv.go
  3. 0
    4
      irc/nickserv.go

+ 8
- 1
irc/accounts.go View File

@@ -834,6 +834,7 @@ func (am *AccountManager) loadRawAccount(tx *buntdb.Tx, casefoldedAccount string
834 834
 }
835 835
 
836 836
 func (am *AccountManager) Unregister(account string) error {
837
+	config := am.server.Config()
837 838
 	casefoldedAccount, err := CasefoldName(account)
838 839
 	if err != nil {
839 840
 		return errAccountDoesNotExist
@@ -906,7 +907,13 @@ func (am *AccountManager) Unregister(account string) error {
906 907
 		delete(am.skeletonToAccount, additionalSkel)
907 908
 	}
908 909
 	for _, client := range clients {
909
-		am.logoutOfAccount(client)
910
+		if config.Accounts.RequireSasl.Enabled {
911
+			client.Quit(client.t("You are no longer authorized to be on this server"))
912
+			// destroy acquires a semaphore so we can't call it while holding a lock
913
+			go client.destroy(false)
914
+		} else {
915
+			am.logoutOfAccount(client)
916
+		}
910 917
 	}
911 918
 
912 919
 	if err != nil {

+ 4
- 0
irc/hostserv.go View File

@@ -206,6 +206,10 @@ func hsStatusHandler(server *Server, client *Client, command string, params []st
206 206
 		accountName = params[0]
207 207
 	} else {
208 208
 		accountName = client.Account()
209
+		if accountName == "" {
210
+			hsNotice(rb, client.t("You're not logged into an account"))
211
+			return
212
+		}
209 213
 	}
210 214
 
211 215
 	account, err := server.accounts.LoadAccount(accountName)

+ 0
- 4
irc/nickserv.go View File

@@ -452,10 +452,6 @@ func nsUnregisterHandler(server *Server, client *Client, command string, params
452 452
 		return
453 453
 	}
454 454
 
455
-	if cfname == client.Account() {
456
-		client.server.accounts.Logout(client)
457
-	}
458
-
459 455
 	err = server.accounts.Unregister(cfname)
460 456
 	if err == errAccountDoesNotExist {
461 457
 		nsNotice(rb, client.t(err.Error()))

Loading…
Cancel
Save