hello methods

This commit is contained in:
Gabor Adam Toth 2011-12-27 17:50:25 +01:00
parent f7a16b8564
commit 946c56c100
4 changed files with 12 additions and 0 deletions

View File

@ -28,6 +28,7 @@
#define PSYC_C2STR(str) (PsycString) {sizeof(str)-1, str}
#define PSYC_C2STRI(str) {sizeof(str)-1, str}
#define PSYC_C2ARG(str) str, sizeof(str)-1
#define PSYC_C2ARG1(str) str, sizeof(str)
#define PSYC_C2ARG2(str) sizeof(str)-1, str
#define PSYC_S2ARG(str) (str).data, (str).length
#define PSYC_S2ARG2(str) (str).length, (str).data

View File

@ -31,6 +31,7 @@ typedef enum PsycMethod {
PSYC_MC_REQUEST_CONTEXT_LEAVE,
PSYC_MC_STATUS,
PSYC_MC_STATUS_CONTEXTS_ENTERED,
PSYC_MC_STATUS_HELLO,
PSYC_MC_WARNING,
PSYC_METHODS_NUM,
@ -44,11 +45,13 @@ typedef union PsycTemplates {
PsycString _echo;
PsycString _echo_context_enter;
PsycString _echo_context_leave;
PsycString _echo_hello_offer;
PsycString _error;
PsycString _failure;
PsycString _info;
PsycString _message;
PsycString _message_action;
PsycString _message_echo;
PsycString _message_echo_action;
PsycString _notice;
PsycString _notice_context_enter;
@ -58,6 +61,7 @@ typedef union PsycTemplates {
PsycString _request_context_leave;
PsycString _status;
PsycString _status_contexts_entered;
PsycString _status_hello;
PsycString _warning;
} s;
} PsycTemplates;

View File

@ -4,9 +4,13 @@
_("You enter [_nick_place]" ),
._echo_context_leave =
_("You leave [_nick_place]"),
._echo_hello_offer =
_("Received hello message"),
._notice_context_enter =
_("[_nick] enters [_nick_place]"),
._notice_context_leave =
_("[_nick] leaves [_nick_place]"),
._status_hello =
_("Your hello is [_hello]"),
._request_context_enter =
_("[_nick] asks for your permission to enter [_nick_place]"),

View File

@ -60,11 +60,13 @@ const PsycDictInt psyc_methods[] = {
{ PSYC_C2STRI("_message"), PSYC_MC_MESSAGE },
{ PSYC_C2STRI("_notice_context_enter"), PSYC_MC_NOTICE_CONTEXT_ENTER },
{ PSYC_C2STRI("_notice_context_leave"), PSYC_MC_NOTICE_CONTEXT_LEAVE },
{ PSYC_C2STRI("_notice_hello"), PSYC_MC_NOTICE_HELLO },
{ PSYC_C2STRI("_notice"), PSYC_MC_NOTICE },
{ PSYC_C2STRI("_request_context_enter"), PSYC_MC_REQUEST_CONTEXT_ENTER },
{ PSYC_C2STRI("_request_context_leave"), PSYC_MC_REQUEST_CONTEXT_LEAVE },
{ PSYC_C2STRI("_request"), PSYC_MC_REQUEST },
{ PSYC_C2STRI("_status_contexts_entered"), PSYC_MC_STATUS_CONTEXTS_ENTERED },
{ PSYC_C2STRI("_status_hello"), PSYC_MC_STATUS_HELLO },
{ PSYC_C2STRI("_status"), PSYC_MC_STATUS },
{ PSYC_C2STRI("_warning"), PSYC_MC_WARNING },
};
@ -185,6 +187,7 @@ psyc_method (char *method, size_t methodlen, PsycMethod *family, unsigned int *f
break;
case PSYC_MC_STATUS:
case PSYC_MC_STATUS_CONTEXTS_ENTERED:
case PSYC_MC_STATUS_HELLO:
*family = PSYC_MC_STATUS;
*flag = PSYC_METHOD_TEMPLATE | PSYC_METHOD_REPLY | PSYC_METHOD_VISIBLE
| PSYC_METHOD_LOGGABLE;