mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:05:10 +00:00
[ADD/FIX/WIP] "Fix" concurrency, prepare XEP-0421
I'll need to break down my commits more...
This commit is contained in:
parent
a686449a4d
commit
63c1bc819e
14 changed files with 356 additions and 162 deletions
|
|
@ -312,7 +312,7 @@ XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
|
|||
|
||||
pthread_mutex_unlock(&comp->write_lock);
|
||||
|
||||
if ((reply = ParseeAwaitStanza(id, 500)))
|
||||
/*if ((reply = ParseeAwaitStanza(id, 500)))
|
||||
{
|
||||
bool exit_code = true;
|
||||
|
||||
|
|
@ -325,7 +325,8 @@ XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
|
|||
XMLFreeElement(reply);
|
||||
Free(id);
|
||||
return exit_code;
|
||||
}
|
||||
}*/
|
||||
(void) reply;
|
||||
Free(id);
|
||||
return true;
|
||||
}
|
||||
|
|
@ -485,3 +486,57 @@ XMPPHasError(XMLElement *stanza, char *type)
|
|||
}
|
||||
return XMLookForUnique(err, type);
|
||||
}
|
||||
|
||||
XMLElement *
|
||||
XMPPSendDisco(XMPPComponent *jabber, char *from, char *to)
|
||||
{
|
||||
XMLElement *ret, *iq;
|
||||
char *identifier;
|
||||
|
||||
if (!jabber || !from || !to)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
iq = XMLCreateTag("iq");
|
||||
XMLAddAttr(iq, "type", "get");
|
||||
XMLAddAttr(iq, "from", from);
|
||||
XMLAddAttr(iq, "to", to);
|
||||
XMLAddAttr(iq, "id", (identifier = StrRandom(69)));
|
||||
{
|
||||
XMLElement *query = XMLCreateTag("query");
|
||||
XMLAddAttr(query, "xmlns", "http://jabber.org/protocol/disco#info");
|
||||
XMLAddChild(iq, query);
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&jabber->write_lock);
|
||||
XMLEncode(jabber->stream, iq);
|
||||
StreamFlush(jabber->stream);
|
||||
pthread_mutex_unlock(&jabber->write_lock);
|
||||
XMLFreeElement(iq);
|
||||
|
||||
ret = ParseeAwaitStanza(identifier, 250);
|
||||
Free(identifier);
|
||||
return ret;
|
||||
}
|
||||
bool
|
||||
XMPPDiscoAdvertises(XMLElement *disco, char *var)
|
||||
{
|
||||
XMLElement *query;
|
||||
if (!disco || !var)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
query = XMLookForTKV(
|
||||
disco,
|
||||
"query", "xmlns",
|
||||
"http://jabber.org/protocol/disco#info"
|
||||
);
|
||||
if (!query)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return !!XMLookForTKV(query, "feature", "var", var);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue