aboutsummaryrefslogtreecommitdiff
path: root/telegram/utils.go
diff options
context:
space:
mode:
Diffstat (limited to 'telegram/utils.go')
-rw-r--r--telegram/utils.go27
1 files changed, 23 insertions, 4 deletions
diff --git a/telegram/utils.go b/telegram/utils.go
index 3f15488..6aab03a 100644
--- a/telegram/utils.go
+++ b/telegram/utils.go
@@ -1472,6 +1472,27 @@ func (c *Client) UpdateChatNicknames() {
}
}
+// AddToEditOutbox temporarily store the resource from which a replace message with given ID was sent
+func (c *Client) AddToEditOutbox(xmppId, resource string) {
+ c.locks.editOutboxLock.Lock()
+ defer c.locks.editOutboxLock.Unlock()
+
+ c.editOutbox[xmppId] = resource
+}
+
+func (c *Client) popFromEditOutbox(xmppId string) string {
+ c.locks.editOutboxLock.Lock()
+ defer c.locks.editOutboxLock.Unlock()
+
+ resource, ok := c.editOutbox[xmppId]
+ if ok {
+ delete(c.editOutbox, xmppId)
+ } else {
+ log.Warnf("No %v xmppId in edit outbox", xmppId)
+ }
+ return resource
+}
+
// AddToOutbox remembers the resource from which a message with given ID was sent
func (c *Client) AddToOutbox(xmppId, resource string) {
c.locks.outboxLock.Lock()
@@ -1480,14 +1501,12 @@ func (c *Client) AddToOutbox(xmppId, resource string) {
c.outbox[xmppId] = resource
}
-func (c *Client) popFromOutbox(xmppId string) string {
+func (c *Client) getFromOutbox(xmppId string) string {
c.locks.outboxLock.Lock()
defer c.locks.outboxLock.Unlock()
resource, ok := c.outbox[xmppId]
- if ok {
- delete(c.outbox, xmppId)
- } else {
+ if !ok {
log.Warnf("No %v xmppId in outbox", xmppId)
}
return resource