mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[MOD/WIP] Threading, and bot "API".
Sloppy code!
This commit is contained in:
parent
5f2c3a9cb8
commit
b81e267141
8 changed files with 259 additions and 124 deletions
|
|
@ -2,7 +2,49 @@
|
|||
#define PARSEE_BOT_H
|
||||
|
||||
#include <Cytoplasm/HashMap.h>
|
||||
#include <Cytoplasm/Memory.h>
|
||||
#include <Cytoplasm/Log.h>
|
||||
|
||||
#define BotInitialise() profile =
|
||||
#include <stdio.h>
|
||||
|
||||
#include <Parsee.h>
|
||||
|
||||
#define BotInitialise() char *profile = StrConcat(4, \
|
||||
"@", data->config->sender_localpart, \
|
||||
":", data->config->homeserver_host \
|
||||
); \
|
||||
char *id = GrabString(event, 1, "room_id")
|
||||
|
||||
#define BotDestroy() Free(profile)
|
||||
|
||||
#define ReplyBasic(rep) do \
|
||||
{ \
|
||||
Free(ASSend( \
|
||||
data->config, id, profile, \
|
||||
"m.room.message", \
|
||||
MatrixCreateNotice(rep) \
|
||||
)); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#define ReplySprintf(fp,...) do \
|
||||
{ \
|
||||
char *formatted = NULL; \
|
||||
size_t fmt_len = 0; \
|
||||
fmt_len = snprintf( \
|
||||
NULL, 0, fp, __VA_ARGS__ \
|
||||
); \
|
||||
formatted = Malloc(fmt_len + 2); \
|
||||
snprintf( \
|
||||
formatted, fmt_len + 1, fp, __VA_ARGS__ \
|
||||
); \
|
||||
Free(ASSend( \
|
||||
data->config, id, profile, \
|
||||
"m.room.message", \
|
||||
MatrixCreateNotice(formatted) \
|
||||
)); \
|
||||
Free(formatted); \
|
||||
} \
|
||||
while(0)
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue