mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 18:35:11 +00:00
[FIX] Fix broken chatstates
This commit is contained in:
parent
74f3fbdccc
commit
88bd2d27ad
3 changed files with 7 additions and 14 deletions
3
src/AS.c
3
src/AS.c
|
|
@ -807,7 +807,8 @@ ASType(const ParseeConfig *c, char *user, char *room, bool status)
|
||||||
|
|
||||||
json = HashMapCreate();
|
json = HashMapCreate();
|
||||||
HashMapSet(json, "typing", JsonValueBoolean(status));
|
HashMapSet(json, "typing", JsonValueBoolean(status));
|
||||||
HashMapSet(json, "timeout", JsonValueBoolean(1 MINUTES));
|
/* If someone types for 10 minutes straight, they got something weird man. */
|
||||||
|
HashMapSet(json, "timeout", JsonValueBoolean(10 MINUTES));
|
||||||
ctx = ParseeCreateRequest(c, HTTP_PUT, path);
|
ctx = ParseeCreateRequest(c, HTTP_PUT, path);
|
||||||
Free(path);
|
Free(path);
|
||||||
ASAuthenticateRequest(c, ctx);
|
ASAuthenticateRequest(c, ctx);
|
||||||
|
|
|
||||||
|
|
@ -66,27 +66,24 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||||
|
|
||||||
PEPManagerHandle(thr->info->pep_manager, stanza);
|
PEPManagerHandle(thr->info->pep_manager, stanza);
|
||||||
|
|
||||||
|
/* TODO: Separate the chatstate processing code. */
|
||||||
#define CHAT_STATES "http://jabber.org/protocol/chatstates"
|
#define CHAT_STATES "http://jabber.org/protocol/chatstates"
|
||||||
if (XMLookForTKV(stanza, "composing", "xmlns", CHAT_STATES))
|
if (XMLookForTKV(stanza, "composing", "xmlns", CHAT_STATES))
|
||||||
{
|
{
|
||||||
decode_from = ParseeLookupJID(from);
|
from_matrix = ParseeGetBridgedUser(args, stanza);
|
||||||
from_matrix = ParseeEncodeJID(args->config, decode_from, true);
|
|
||||||
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
||||||
|
|
||||||
ASType(args->config, from_matrix, mroom_id, true);
|
ASType(args->config, from_matrix, mroom_id, true);
|
||||||
|
|
||||||
Free(decode_from);
|
|
||||||
Free(from_matrix);
|
Free(from_matrix);
|
||||||
Free(mroom_id);
|
Free(mroom_id);
|
||||||
mroom_id = NULL;
|
mroom_id = NULL;
|
||||||
decode_from = NULL;
|
|
||||||
from_matrix = NULL;
|
from_matrix = NULL;
|
||||||
}
|
}
|
||||||
if (XMLookForTKV(stanza, "active", "xmlns", CHAT_STATES))
|
if (XMLookForTKV(stanza, "active", "xmlns", CHAT_STATES))
|
||||||
{
|
{
|
||||||
char *latest = NULL;
|
char *latest = NULL;
|
||||||
decode_from = ParseeLookupJID(from);
|
from_matrix = ParseeGetBridgedUser(args, stanza);
|
||||||
from_matrix = ParseeEncodeJID(args->config, decode_from, true);
|
|
||||||
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
||||||
|
|
||||||
latest = ParseeLookupHead(mroom_id);
|
latest = ParseeLookupHead(mroom_id);
|
||||||
|
|
@ -94,12 +91,10 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||||
ASType(args->config, from_matrix, mroom_id, false);
|
ASType(args->config, from_matrix, mroom_id, false);
|
||||||
ASPresence(args->config, from_matrix, mroom_id, latest);
|
ASPresence(args->config, from_matrix, mroom_id, latest);
|
||||||
|
|
||||||
Free(decode_from);
|
|
||||||
Free(from_matrix);
|
Free(from_matrix);
|
||||||
Free(latest);
|
Free(latest);
|
||||||
Free(mroom_id);
|
Free(mroom_id);
|
||||||
mroom_id = NULL;
|
mroom_id = NULL;
|
||||||
decode_from = NULL;
|
|
||||||
from_matrix = NULL;
|
from_matrix = NULL;
|
||||||
}
|
}
|
||||||
if (XMLookForTKV(stanza, "paused", "xmlns", CHAT_STATES) ||
|
if (XMLookForTKV(stanza, "paused", "xmlns", CHAT_STATES) ||
|
||||||
|
|
@ -108,20 +103,17 @@ MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr)
|
||||||
{
|
{
|
||||||
/* TODO: Use stanza ID if possible */
|
/* TODO: Use stanza ID if possible */
|
||||||
char *latest = NULL;
|
char *latest = NULL;
|
||||||
decode_from = ParseeLookupJID(from);
|
from_matrix = ParseeGetBridgedUser(args, stanza);
|
||||||
from_matrix = ParseeEncodeJID(args->config, decode_from, true);
|
|
||||||
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
mroom_id = ParseeGetBridgedRoom(args, stanza);
|
||||||
|
|
||||||
latest = ParseeLookupHead(mroom_id);
|
latest = ParseeLookupHead(mroom_id);
|
||||||
|
|
||||||
ASPresence(args->config, from_matrix, mroom_id, latest);
|
ASPresence(args->config, from_matrix, mroom_id, latest);
|
||||||
|
|
||||||
Free(decode_from);
|
|
||||||
Free(from_matrix);
|
Free(from_matrix);
|
||||||
Free(latest);
|
Free(latest);
|
||||||
Free(mroom_id);
|
Free(mroom_id);
|
||||||
mroom_id = NULL;
|
mroom_id = NULL;
|
||||||
decode_from = NULL;
|
|
||||||
from_matrix = NULL;
|
from_matrix = NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ extern char * ASCreateRoom(const ParseeConfig *c, char *by, char *alias);
|
||||||
|
|
||||||
extern char * ASCreateDM(const ParseeConfig *c, char *by, char *with);
|
extern char * ASCreateDM(const ParseeConfig *c, char *by, char *with);
|
||||||
|
|
||||||
/** Sets the user's global display{name]
|
/** Sets the user's global display{name}
|
||||||
* --------
|
* --------
|
||||||
* Returns: NOTHING
|
* Returns: NOTHING
|
||||||
* Modifies: [EXT:User status]
|
* Modifies: [EXT:User status]
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue