mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 19:55: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
77
src/XMPPThread/internal.h
Normal file
77
src/XMPPThread/internal.h
Normal file
|
|
@ -0,0 +1,77 @@
|
|||
#include <XMPPCommand.h>
|
||||
#include <Parsee.h>
|
||||
#include <XMPP.h>
|
||||
#include <XML.h>
|
||||
|
||||
#define IQ_ADVERT \
|
||||
AdvertiseSimple("http://jabber.org/protocol/chatstates") \
|
||||
AdvertiseSimple("http://jabber.org/protocol/commands") \
|
||||
AdvertiseSimple("http://jabber.org/protocol/caps") \
|
||||
AdvertiseSimple("urn:xmpp:avatar:metadata+notify") \
|
||||
AdvertiseSimple("urn:xmpp:avatar:data+notify") \
|
||||
AdvertiseSimple("urn:xmpp:avatar:metadata") \
|
||||
AdvertiseSimple("urn:xmpp:message-correct:0") \
|
||||
AdvertiseSimple("urn:xmpp:message-moderate:0") \
|
||||
AdvertiseSimple("urn:xmpp:message-moderate:1") \
|
||||
AdvertiseSimple("urn:xmpp:message-retract:0") \
|
||||
AdvertiseSimple("urn:xmpp:message-retract:1") \
|
||||
AdvertiseSimple("urn:xmpp:avatar:data") \
|
||||
AdvertiseSimple("urn:xmpp:chat-markers:0") \
|
||||
AdvertiseSimple("urn:xmpp:reactions:0") \
|
||||
AdvertiseSimple("urn:xmpp:styling:0") \
|
||||
AdvertiseSimple("urn:xmpp:receipts") \
|
||||
AdvertiseSimple("urn:xmpp:reply:0") \
|
||||
AdvertiseSimple("jabber:x:oob") \
|
||||
AdvertiseSimple("vcard-temp") \
|
||||
AdvertiseSimple("jabber:iq:version") \
|
||||
AdvertiseSimple("urn:parsee:x-parsee:0") \
|
||||
AdvertiseSimple("urn:parsee:jealousy:0")
|
||||
|
||||
#define IQ_IDENTITY \
|
||||
IdentitySimple("gateway", "matrix", "Parsee Matrix Gateway") \
|
||||
IdentitySimple("client", "pc", NAME " v" VERSION " bridge") \
|
||||
IdentitySimple("component", "generic", "Parsee's component")
|
||||
|
||||
typedef struct XMPPIdentity {
|
||||
char *category, *type, *lang, *name;
|
||||
} XMPPIdentity;
|
||||
|
||||
typedef struct XMPPThread XMPPThread;
|
||||
typedef struct XMPPThreadInfo {
|
||||
/* A FIFO of stanzas inbound, to be read by dispatcher
|
||||
* threads. */
|
||||
Array *stanzas;
|
||||
pthread_mutex_t lock;
|
||||
|
||||
ParseeData *args;
|
||||
XMPPComponent *jabber;
|
||||
XMPPCommandManager *m;
|
||||
|
||||
struct XMPPThread *dispatchers;
|
||||
size_t available_dispatchers;
|
||||
|
||||
bool running;
|
||||
pthread_mutex_t chk_lock;
|
||||
} XMPPThreadInfo;
|
||||
struct XMPPThread {
|
||||
pthread_t thr;
|
||||
XMPPThreadInfo *info;
|
||||
};
|
||||
|
||||
extern int ICollate(unsigned char *cata, unsigned char *catb);
|
||||
extern int IdentitySort(void *idap, void *idbp);
|
||||
|
||||
extern char * ParseeGetBridgedRoom(ParseeData *data, XMLElement *stanza);
|
||||
extern char * ParseeGetEventFromID(ParseeData *data, XMLElement *stanza, char *id);
|
||||
extern char * ParseeGetReactedEvent(ParseeData *data, XMLElement *stanza);
|
||||
extern void ParseePushAllStanza(ParseeData *args, XMLElement *stanza, char *event);
|
||||
extern bool ParseeVerifyAllStanza(ParseeData *args, XMLElement *stanza);
|
||||
|
||||
extern HashMap * ShoveStanza(HashMap *content, XMLElement *stanza);
|
||||
extern void ManageProfileItem(ParseeData *args, XMLElement *item, XMLElement *stanza, XMPPThread *thr);
|
||||
extern XMLElement * CreatePubsubRequest(char *from, char *to, char *node);
|
||||
|
||||
|
||||
extern bool MessageStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr);
|
||||
extern void IQStanza(ParseeData *args, XMLElement *stanza, XMPPThread *thr);
|
||||
extern void PresenceStanza(ParseeData *args, XMLElement *stanza);
|
||||
Loading…
Add table
Add a link
Reference in a new issue