Parsee/src/include/Matrix.h

52 lines
1.6 KiB
C

#ifndef PARSEE_MATRIX_H
#define PARSEE_MATRIX_H
#include <Cytoplasm/Json.h>
#include "FileInfo.h"
/* A simple representation of everything. It is not as complex as
* Telodendria's CommonID parser, simply because Parsee does not
* need such complexity. */
typedef struct UserID {
/* We're being extra leinent. */
char localpart[256];
char server[256];
} UserID;
/** Parses a Matrix user ID, with no attention to detail.
* -----------
* Returns: a valid user ID[HEAP] | NULL
* Thrasher: Free */
extern UserID * MatrixParseID(char *user);
/* 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);
/* Creates the content for a normal message. */
extern HashMap * MatrixCreateMessage(char *body);
extern HashMap * MatrixCreateReact(char *event, char *body);
/* Creates the content for a replace message. */
extern HashMap * MatrixCreateReplace(char *event, char *body);
/* Creates the content for a media file. */
extern HashMap * MatrixCreateMedia(char *mxc, char *body, char *mime, FileInfo *info);
/* Creates the content for a m.room.name state event */
extern HashMap * MatrixCreateNameState(char *name);
/* Creates a join membership with a specific nickname */
extern HashMap * MatrixCreateNickChange(char *nick);
/* Modifies a hashmap to create a reply event */
extern void MatrixSetReply(HashMap *e, char *event);
/* Get the event ID of the reply if existent */
extern char * MatrixGetReply(HashMap *event);
extern char * MatrixGetEdit(HashMap *event);
#endif