mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 21:25:11 +00:00
[ADD/WIP] Start making a simple SAX parser, ASwerk
This commit is contained in:
parent
0fa95c2d14
commit
79217d3608
14 changed files with 1066 additions and 26 deletions
|
|
@ -15,4 +15,19 @@ extern HashMap * ASVerifyRequest(ParseeHttpArg *);
|
|||
* It does not send the request, however. */
|
||||
extern void ASAuthenticateRequest(ParseeConfig *, HttpClientContext *);
|
||||
|
||||
/* Registers an user through the Application Service API. Returns
|
||||
* true if the user was created. */
|
||||
extern bool ASRegisterUser(ParseeConfig *, char *);
|
||||
|
||||
/* Pings the homeserver to get attention. */
|
||||
extern void ASPing(ParseeConfig *);
|
||||
|
||||
/* Joins a room from an ID and a given user we want to masquerade
|
||||
* as. */
|
||||
extern void ASJoin(ParseeConfig *, char *, char *);
|
||||
|
||||
/* Sends a message event with a specific type and body.
|
||||
* Said body is freed during the function's execution. */
|
||||
extern void ASSend(ParseeConfig *, char *, char *, char *, HashMap *);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -5,4 +5,7 @@
|
|||
|
||||
/* Creates an error message JSON, with the specified code and message. */
|
||||
extern HashMap * MatrixCreateError(char *err, char *msg);
|
||||
|
||||
/* Creates the content for a notice message. */
|
||||
extern HashMap * MatrixCreateNotice(char *body);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -52,4 +52,10 @@ extern HttpClientContext * ParseeCreateRequest(ParseeConfig *, HttpRequestMethod
|
|||
|
||||
/* Sends headers, and writes the JSON object. */
|
||||
extern HttpStatus ParseeSetRequestJSON(HttpClientContext *, HashMap *);
|
||||
|
||||
/* This function is called on every event received, and routes/manages it. */
|
||||
extern void ParseeEventHandler(const ParseeConfig *, HashMap *);
|
||||
|
||||
/* Verifies if a user is a Parsee puppet user. */
|
||||
extern bool ParseeIsPuppet(const ParseeConfig *, char *);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -10,7 +10,8 @@ typedef struct ParseeHttpArg {
|
|||
|
||||
/* A list of all routes. */
|
||||
#define ROUTES X_ROUTE("/", RouteRoot) \
|
||||
X_ROUTE("/_matrix/app/v1/transactions/(.*)", RouteTxns)
|
||||
X_ROUTE("/_matrix/app/v1/transactions/(.*)", RouteTxns) \
|
||||
X_ROUTE("/_matrix/app/v1/ping", RoutePing)
|
||||
|
||||
#define X_ROUTE(path, name) extern void * name(Array *, void *);
|
||||
ROUTES
|
||||
|
|
|
|||
36
src/include/XML.h
Normal file
36
src/include/XML.h
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#ifndef PARSEE_XML_H
|
||||
#define PARSEE_XML_H
|
||||
|
||||
#include <Cytoplasm/HashMap.h>
|
||||
#include <Cytoplasm/Stream.h>
|
||||
|
||||
typedef struct XMLexer XMLexer;
|
||||
typedef struct XMLEvent {
|
||||
enum {
|
||||
XML_LEXER_UNKNOWN = 0,
|
||||
XML_LEXER_STARTELEM,
|
||||
XML_LEXER_ELEM, /* Empty attr */
|
||||
XML_LEXER_DATA,
|
||||
XML_LEXER_ENDELEM,
|
||||
|
||||
XML_RELAX
|
||||
} type;
|
||||
|
||||
int line, col;
|
||||
size_t offset;
|
||||
|
||||
/* The element name */
|
||||
char *element;
|
||||
|
||||
/* Attributes hashmap */
|
||||
HashMap *attrs;
|
||||
|
||||
/* The decoded data */
|
||||
char *data;
|
||||
} XMLEvent;
|
||||
|
||||
extern XMLexer * XMLCreateLexer(Stream *, bool);
|
||||
extern XMLEvent * XMLCrank(XMLexer *);
|
||||
extern void XMLFreeEvent(XMLEvent *);
|
||||
extern void XMLFreeLexer(XMLexer *);
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue