Skip to content
GitLab
Explore
Sign in
Commits on Source (2)
minor logging fixes
· d6a8ac8f
eta
authored
Jan 30, 2021
d6a8ac8f
send presence when we get XMPP presence; periodically poll presence
· 0c0f2feb
eta
authored
Feb 07, 2021
0c0f2feb
Hide whitespace changes
Inline
Side-by-side
message.lisp
View file @
0c0f2feb
...
...
@@ -74,7 +74,7 @@ FIXME: the above behaviour is a bit meh."
;; whee fallback go brrr
participant-localpart
)))
(
values
wx-localpart
from-resource
))
(
error
"Couldn't find or create group chat for ~A"
chat-id
)))))))
(
error
"Couldn't find or create group chat for ~A"
wx-localpart
)))))))
(
defmacro
with-new-xmpp-message-context
((
comp
jid
msg
&optional
conn
)
&body
body
)
"Evaluate FORMS, binding NEW-XMPP-MESSAGE (lambda-list (BODY &KEY OOB-URL SYSTEM-GENERATED)) to a function that returns an instance of the XMPP-MESSAGE class, using information contained in the message MSG received for the bridge user JID."
...
...
stuff.lisp
View file @
0c0f2feb
...
...
@@ -11,6 +11,9 @@
((
whatsapps
:initform
(
make-hash-table
:test
'equal
)
:accessor
component-whatsapps
)
(
presence-timers
:initform
(
make-hash-table
:test
'equal
)
:accessor
component-presence-timers
)
(
reconnect-timer
:initform
nil
:accessor
component-reconnect-timer
)
...
...
@@ -139,6 +142,14 @@ Commands:
(
loop
for
jid
being
the
hash-keys
in
(
component-whatsapps
comp
)
using
(
hash-value
conn
)
do
(
when
conn
(
symbol-macrolet
((
ticks
(
gethash
jid
(
component-presence-timers
comp
))))
(
unless
ticks
(
setf
ticks
0
))
(
when
(
>
(
incf
ticks
)
#.
(
/
(
*
60
60
)
5
))
(
format
*debug-io*
"~&periodic presence available for ~A~%"
jid
)
(
whatscl::send-presence
conn
:available
))))
append
(
unless
conn
(
list
jid
))))
(
num-users
(
length
users-to-reconnect
)))
...
...
@@ -596,7 +607,7 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
(
handle-wa-contact-presence-subscriptions
comp
jid
wx-localpart
))
(
return-from
add-wa-chat
))
(
unless
(
uiop:string-prefix-p
"g"
wx-localpart
)
(
warn
"Interesting localpart pased to ADD-WA-CHAT: ~A"
wx-localpart
)
(
warn
"Interesting localpart pas
s
ed to ADD-WA-CHAT: ~A"
wx-localpart
)
(
return-from
add-wa-chat
))
(
assert
uid
()
"No user ID for ~A!"
jid
)
(
unless
(
get-user-chat-id
uid
wx-localpart
)
...
...
@@ -1219,6 +1230,11 @@ Returns three values: avatar data (as two values), and a generalized boolean spe
:stanza-type
"presence"
:id
id
:to
from
:from
to
:e
e
))))
((
and
uid
(
string-equal
type
"available"
))
(
let
((
conn
(
gethash
stripped
(
component-whatsapps
comp
))))
(
when
conn
(
format
*debug-io*
"~&sending available presence for ~A~%"
stripped
)
(
whatscl::send-presence
conn
:available
))))
(
t
nil
))))))
(
defun
whatsxmpp-presence-probe-handler
(
comp
&key
from
to
id
&allow-other-keys
)
...
...