mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:05:10 +00:00
[MOD/FIX] Separate XMPP thread, fix EINVAL issue
threading is good actually. please hmu if you ever trigger the achievement.
This commit is contained in:
parent
299f473a81
commit
143bdf0a5a
21 changed files with 2314 additions and 1764 deletions
|
|
@ -281,14 +281,15 @@ XMPPLeaveMUC(XMPPComponent *comp, char *fr, char *muc, char *reason)
|
|||
|
||||
pthread_mutex_unlock(&comp->write_lock);
|
||||
}
|
||||
void
|
||||
|
||||
bool
|
||||
XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
|
||||
{
|
||||
XMLElement *presence, *x;
|
||||
XMLElement *presence, *x, *reply;
|
||||
char *from, *id;
|
||||
if (!comp || !fr || !muc)
|
||||
{
|
||||
return;
|
||||
return false;
|
||||
}
|
||||
|
||||
pthread_mutex_lock(&comp->write_lock);
|
||||
|
|
@ -308,9 +309,25 @@ XMPPJoinMUC(XMPPComponent *comp, char *fr, char *muc)
|
|||
|
||||
XMLFreeElement(presence);
|
||||
Free(from);
|
||||
Free(id);
|
||||
|
||||
pthread_mutex_unlock(&comp->write_lock);
|
||||
|
||||
if ((reply = ParseeAwaitStanza(id, 500)))
|
||||
{
|
||||
bool exit_code = true;
|
||||
|
||||
if (XMPPHasError(reply, "conflict"))
|
||||
{
|
||||
Log(LOG_WARNING, "UNIMPLEMENTED NAMING CONFLICT.");
|
||||
exit_code = false;
|
||||
}
|
||||
|
||||
XMLFreeElement(reply);
|
||||
Free(id);
|
||||
return exit_code;
|
||||
}
|
||||
Free(id);
|
||||
return true;
|
||||
}
|
||||
bool
|
||||
XMPPIsParseeStanza(XMLElement *stanza)
|
||||
|
|
@ -432,7 +449,6 @@ XMPPGetModeration(XMLElement *stanza)
|
|||
moderate = XMLookForTKV(stanza, "moderate", "xmlns", MOD_BASE ":1");
|
||||
if (moderate)
|
||||
{
|
||||
Log(LOG_WARNING, "0.3.0 moderation");
|
||||
return HashMapGet(moderate->attrs, "id");
|
||||
}
|
||||
|
||||
|
|
@ -452,3 +468,20 @@ XMPPGetModeration(XMLElement *stanza)
|
|||
return NULL;
|
||||
#undef MOD_BASE
|
||||
}
|
||||
|
||||
bool
|
||||
XMPPHasError(XMLElement *stanza, char *type)
|
||||
{
|
||||
XMLElement *err;
|
||||
if (!stanza || !type)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
err = XMLookForUnique(stanza, "error");
|
||||
if (!err)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
return XMLookForUnique(err, type);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue