From 07901658f30becb5c0f5661b0da6c695e59247e8 Mon Sep 17 00:00:00 2001 From: "tg(x)" <*@tg-x.net> Date: Tue, 27 Dec 2011 17:50:25 +0100 Subject: [PATCH] hello methods --- include/psyc.h | 1 + include/psyc/method.h | 4 ++++ src/templates.h | 4 ++++ src/variable.c | 3 +++ 4 files changed, 12 insertions(+) diff --git a/include/psyc.h b/include/psyc.h index 2ba0d56..9a1a7bb 100644 --- a/include/psyc.h +++ b/include/psyc.h @@ -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 diff --git a/include/psyc/method.h b/include/psyc/method.h index e58896f..cb41300 100644 --- a/include/psyc/method.h +++ b/include/psyc/method.h @@ -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; diff --git a/src/templates.h b/src/templates.h index 46b5acf..38c587d 100644 --- a/src/templates.h +++ b/src/templates.h @@ -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]"), diff --git a/src/variable.c b/src/variable.c index 253c0bd..4db11ec 100644 --- a/src/variable.c +++ b/src/variable.c @@ -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;