Skip to content

Commit 3f20981

Browse files
committed
cleaner logout
1 parent f8368e4 commit 3f20981

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"gitlab.com/tslocum/cbind"
1717
)
1818

19-
var VERSION string = "v0.9.8"
19+
var VERSION string = "v0.9.9"
2020

2121
var sndTxt string = ""
2222
var currentReceiver messages.Chat = messages.Chat{}

messages/session_manager.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,12 @@ func (sm *SessionManager) setCurrentReceiver(id string) {
181181
func (sm *SessionManager) getConnection() *whatsapp.Conn {
182182
var wac *whatsapp.Conn
183183
if sm.connection == nil {
184-
wacc, err := whatsapp.NewConn(5 * time.Second)
184+
options := &whatsapp.Options{
185+
Timeout: 5 * time.Second,
186+
LongClientName: "WhatsCLI Client",
187+
ShortClientName: "whatscli",
188+
}
189+
wacc, err := whatsapp.NewConnWithOptions(options)
185190
if err != nil {
186191
return nil
187192
}
@@ -253,7 +258,9 @@ func (sm *SessionManager) disconnect() error {
253258

254259
// logout logs out the user, deletes session file
255260
func (ub *SessionManager) logout() error {
256-
ub.getConnection().Disconnect()
261+
err := ub.getConnection().Logout()
262+
ub.StatusChannel <- StatusMsg{false, err}
263+
ub.uiHandler.PrintText("removing login data..")
257264
return removeSession()
258265
}
259266

0 commit comments

Comments
 (0)