refactor: contact store use object

This commit is contained in:
Anthony Laibe 2021-09-28 10:17:37 +02:00 committed by Iuri Matias
parent 1cea69b331
commit d519843e52
2 changed files with 8 additions and 8 deletions

View File

@ -196,8 +196,8 @@ QtObject:
)
self.contactToAddChanged()
proc addContact*(self: ContactsView, publicKey: string): string {.slot.} =
result = self.status.contacts.addContact(publicKey, self.accountKeyUID)
proc addContact*(self: ContactsView, publicKey: string) {.slot.} =
self.status.contacts.addContact(publicKey, self.accountKeyUID)
self.status.chat.join(status_utils.getTimelineChatId(publicKey), ChatType.Profile, "", publicKey)
proc rejectContactRequest*(self: ContactsView, publicKey: string) {.slot.} =
@ -211,24 +211,24 @@ QtObject:
proc acceptContactRequests*(self: ContactsView, publicKeysJSON: string) {.slot.} =
let publicKeys = publicKeysJSON.parseJson
for pubkey in publicKeys:
discard self.addContact(pubkey.getStr)
self.addContact(pubkey.getStr)
proc changeContactNickname*(self: ContactsView, publicKey: string, nickname: string) {.slot.} =
var nicknameToSet = nickname
if (nicknameToSet == ""):
nicknameToSet = DELETE_CONTACT
discard self.status.contacts.setNickName(publicKey, nicknameToSet, self.accountKeyUID)
self.status.contacts.setNickName(publicKey, nicknameToSet, self.accountKeyUID)
proc unblockContact*(self: ContactsView, publicKey: string) {.slot.} =
self.contactListChanged()
discard self.status.contacts.unblockContact(publicKey)
self.status.contacts.unblockContact(publicKey)
proc contactBlocked*(self: ContactsView, publicKey: string) {.signal.}
proc blockContact*(self: ContactsView, publicKey: string): string {.slot.} =
proc blockContact*(self: ContactsView, publicKey: string) {.slot.} =
self.contactListChanged()
self.contactBlocked(publicKey)
return self.status.contacts.blockContact(publicKey)
self.status.contacts.blockContact(publicKey)
proc removeContact*(self: ContactsView, publicKey: string) {.slot.} =
self.status.contacts.removeContact(publicKey)

2
vendor/status-lib vendored

@ -1 +1 @@
Subproject commit fe7e74459ed3cb7601087db3e16931f06ed36ad0
Subproject commit 06a6408269eb47f3d812bd259c759b247a024d08