mirror of
https://forge.fsky.io/lda/Parsee.git
synced 2026-03-13 22:55:11 +00:00
[ADD/WIP] Create and use basic command parser
Still need to write the router.
This commit is contained in:
parent
f434f7aa87
commit
c4b7d1b92a
6 changed files with 220 additions and 12 deletions
21
src/include/Command.h
Normal file
21
src/include/Command.h
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
#ifndef PARSEE_COMMAND_H
|
||||
#define PARSEE_COMMAND_H
|
||||
|
||||
#include <Cytoplasm/HashMap.h>
|
||||
|
||||
typedef struct Command {
|
||||
char *command;
|
||||
HashMap *arguments;
|
||||
} Command;
|
||||
|
||||
typedef struct CommandRouter CommandRouter;
|
||||
typedef void (*CommandRoute)(Command *cmd, void *data);
|
||||
|
||||
extern CommandRouter * CommandCreateRouter(void);
|
||||
extern void CommandAddCommand(CommandRouter *rter, char *c, CommandRoute rte);
|
||||
extern void RouteCommand(CommandRouter *rter, Command *cmd, void *data);
|
||||
extern void CommandFreeRouter(CommandRouter *rter);
|
||||
|
||||
extern Command * CommandParse(char *cmd);
|
||||
extern void CommandFree(Command *command);
|
||||
#endif
|
||||
|
|
@ -9,6 +9,7 @@
|
|||
|
||||
#include <pthread.h>
|
||||
|
||||
#include <Command.h>
|
||||
#include <XMPP.h>
|
||||
|
||||
typedef struct ParseeConfig {
|
||||
|
|
@ -43,6 +44,7 @@ typedef struct ParseeConfig {
|
|||
typedef struct ParseeData {
|
||||
const ParseeConfig *config;
|
||||
HttpRouter *router;
|
||||
CommandRouter *handler;
|
||||
|
||||
XMPPComponent *jabber;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue