[ADD/WIP] Baisic VCards, worst XEP-0393 parser

Blocks coming soon. Took me a day to get a system I remotely liked, and
now I feel ashamed of that a bit. It's truly over...
This commit is contained in:
LDA 2024-07-12 19:24:59 +02:00
commit 4007232716
6 changed files with 409 additions and 12 deletions

43
src/include/XEP393.h Normal file
View file

@ -0,0 +1,43 @@
#ifndef PARSEE_XEP393_H
#define PARSEE_XEP393_H
#include <Cytoplasm/Array.h>
typedef enum XEP393Type {
XEP393_ROOT,
XEP393_ITALIC,
XEP393_EMPH,
XEP393_MONO,
XEP393_TEXT
} XEP393Type;
typedef struct XEP393Element {
struct XEP393Element *parent;
XEP393Type type;
char *text_data;
Array *children;
} XEP393Element;
/** Tries to decode a XEP-393 message into a formatted structure.
* --------
* Returns: A root XEP393Element[LA:HEAP] | NULL
* Modifies: NOTHING
* See-Also: https://xmpp.org/extensions/xep-0393.html, XEP393FreeElement */
extern XEP393Element * XEP393(char *message);
/** Frees an XEP-0393 {element}, alongside all it's children
* --------
* Returns: NOTHING
* Modifies: {element}
* See-Also: https://xmpp.org/extensions/xep-0393.html, XEP393 */
extern void XEP393FreeElement(XEP393Element *element);
/** Converts a XEP-0393 element to a XMLd string
* --------
* Returns: A string representing a XML'ified version of {xepd}[LA:HEAP]
* Modifies: NOTHING
* See-Also: https://xmpp.org/extensions/xep-0393.html, XEP393FreeElement, XEP393 */
extern char * XEP393ToXMLString(XEP393Element *xepd);
#endif