mirror of
git://git.psyc.eu/libpsyc
synced 2024-08-15 03:19:02 +00:00
psyc_entity_type(), _action methods
This commit is contained in:
parent
c4d364a70b
commit
60fc690d81
3 changed files with 34 additions and 0 deletions
|
@ -78,7 +78,32 @@ typedef enum {
|
||||||
PSYC_ENTITY_SERVICE = '$',
|
PSYC_ENTITY_SERVICE = '$',
|
||||||
} PsycEntityType;
|
} PsycEntityType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse uniform.
|
||||||
|
*
|
||||||
|
* @return PsycScheme on success, PsycParseUniformRC on error.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
psyc_uniform_parse (PsycUniform *uni, const char *buffer, size_t length);
|
psyc_uniform_parse (PsycUniform *uni, const char *buffer, size_t length);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get entity type.
|
||||||
|
*
|
||||||
|
* @return PsycEntityType on success, PSYC_ERROR on error.
|
||||||
|
*/
|
||||||
|
static inline int
|
||||||
|
psyc_entity_type (char entity)
|
||||||
|
{
|
||||||
|
switch (entity) {
|
||||||
|
case PSYC_ENTITY_PERSON:
|
||||||
|
return PSYC_ENTITY_PERSON;
|
||||||
|
case PSYC_ENTITY_PLACE:
|
||||||
|
return PSYC_ENTITY_PLACE;
|
||||||
|
case PSYC_ENTITY_SERVICE:
|
||||||
|
return PSYC_ENTITY_SERVICE;
|
||||||
|
default:
|
||||||
|
return PSYC_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,6 +3,11 @@
|
||||||
#include "psyc/uniform.h"
|
#include "psyc/uniform.h"
|
||||||
#include "psyc/parse.h"
|
#include "psyc/parse.h"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parse uniform.
|
||||||
|
*
|
||||||
|
* @return PsycScheme on success, PsycParseUniformRC on error.
|
||||||
|
*/
|
||||||
int
|
int
|
||||||
psyc_uniform_parse (PsycUniform *uni, const char *buffer, size_t length)
|
psyc_uniform_parse (PsycUniform *uni, const char *buffer, size_t length)
|
||||||
{
|
{
|
||||||
|
|
|
@ -54,6 +54,8 @@ const PsycDictInt psyc_methods[] = {
|
||||||
{ PSYC_C2STRI("_echo"), PSYC_MC_ECHO },
|
{ PSYC_C2STRI("_echo"), PSYC_MC_ECHO },
|
||||||
{ PSYC_C2STRI("_failure"), PSYC_MC_FAILURE },
|
{ PSYC_C2STRI("_failure"), PSYC_MC_FAILURE },
|
||||||
{ PSYC_C2STRI("_info"), PSYC_MC_INFO },
|
{ PSYC_C2STRI("_info"), PSYC_MC_INFO },
|
||||||
|
{ PSYC_C2STRI("_message_action"), PSYC_MC_MESSAGE_ACTION },
|
||||||
|
{ PSYC_C2STRI("_message_echo_action"), PSYC_MC_MESSAGE_ECHO_ACTION },
|
||||||
{ PSYC_C2STRI("_message_echo"), PSYC_MC_MESSAGE_ECHO },
|
{ PSYC_C2STRI("_message_echo"), PSYC_MC_MESSAGE_ECHO },
|
||||||
{ PSYC_C2STRI("_message"), PSYC_MC_MESSAGE },
|
{ PSYC_C2STRI("_message"), PSYC_MC_MESSAGE },
|
||||||
{ PSYC_C2STRI("_notice_context_enter"), PSYC_MC_NOTICE_CONTEXT_ENTER },
|
{ PSYC_C2STRI("_notice_context_enter"), PSYC_MC_NOTICE_CONTEXT_ENTER },
|
||||||
|
@ -159,10 +161,12 @@ psyc_method (char *method, size_t methodlen, PsycMethod *family, unsigned int *f
|
||||||
| PSYC_METHOD_LOGGABLE;
|
| PSYC_METHOD_LOGGABLE;
|
||||||
break;
|
break;
|
||||||
case PSYC_MC_MESSAGE:
|
case PSYC_MC_MESSAGE:
|
||||||
|
case PSYC_MC_MESSAGE_ACTION:
|
||||||
*family = PSYC_MC_MESSAGE;
|
*family = PSYC_MC_MESSAGE;
|
||||||
*flag = PSYC_METHOD_VISIBLE | PSYC_METHOD_LOGGABLE | PSYC_METHOD_MANUAL;
|
*flag = PSYC_METHOD_VISIBLE | PSYC_METHOD_LOGGABLE | PSYC_METHOD_MANUAL;
|
||||||
break;
|
break;
|
||||||
case PSYC_MC_MESSAGE_ECHO:
|
case PSYC_MC_MESSAGE_ECHO:
|
||||||
|
case PSYC_MC_MESSAGE_ECHO_ACTION:
|
||||||
*family = PSYC_MC_MESSAGE_ECHO;
|
*family = PSYC_MC_MESSAGE_ECHO;
|
||||||
*flag = PSYC_METHOD_REPLY | PSYC_METHOD_VISIBLE | PSYC_METHOD_LOGGABLE
|
*flag = PSYC_METHOD_REPLY | PSYC_METHOD_VISIBLE | PSYC_METHOD_LOGGABLE
|
||||||
| PSYC_METHOD_MANUAL;
|
| PSYC_METHOD_MANUAL;
|
||||||
|
|
Loading…
Reference in a new issue