diff options
author | Badlop <badlop@process-one.net> | 2008-07-16 16:58:42 +0000 |
---|---|---|
committer | Badlop <badlop@process-one.net> | 2008-07-16 16:58:42 +0000 |
commit | 970e9e0843e4da51bb7bfb42b89c11d491883e5c (patch) | |
tree | a37c3a7cb9a417a504860aa492e50c14d38145b5 /src | |
parent | Rolled back the previous IP getting patch, and Report connection's IP address... (diff) |
* src/*.hrl: Get back all ejabberd header files to their original
placement in src/ subdirectories (EJAB-696)
* src/*/*.erl: Likewise
* src/*/Makefile.in: Likewise
* src/Makefile.in: Install header files in system include/ dir,
reproducing the subdirectory structure of src/
SVN Revision: 1453
Diffstat (limited to 'src')
31 files changed, 871 insertions, 25 deletions
diff --git a/src/Makefile.in b/src/Makefile.in index 3d398f56..5dabf543 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -29,7 +29,6 @@ else endif EFLAGS += @ERLANG_SSL39@ -EFLAGS += -I ../include # make debug=true to compile Erlang module with debug informations. ifdef debug @@ -189,7 +188,15 @@ install: all # # ejabberd header files install -d $(INCLUDEDIR) - install -m 644 ../include/*.hrl $(INCLUDEDIR) + install -m 644 *.hrl $(INCLUDEDIR) + install -d $(INCLUDEDIR)/eldap/ + install -m 644 eldap/*.hrl $(INCLUDEDIR)/eldap/ + install -d $(INCLUDEDIR)/mod_proxy65/ + install -m 644 mod_proxy65/*.hrl $(INCLUDEDIR)/mod_proxy65/ + install -d $(INCLUDEDIR)/mod_pubsub/ + install -m 644 mod_pubsub/*.hrl $(INCLUDEDIR)/mod_pubsub/ + install -d $(INCLUDEDIR)/web/ + install -m 644 web/*.hrl $(INCLUDEDIR)/web/ # # Binary C programs install -d $(PBINDIR) diff --git a/src/adhoc.hrl b/src/adhoc.hrl new file mode 100644 index 00000000..5dbc515b --- /dev/null +++ b/src/adhoc.hrl @@ -0,0 +1,36 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(adhoc_request, {lang, + node, + sessionid, + action, + xdata, + others}). + +-record(adhoc_response, {lang, + node, + sessionid, + status, + defaultaction = "", + actions = [], + notes = [], + elements = []}). diff --git a/src/ejabberd.hrl b/src/ejabberd.hrl new file mode 100644 index 00000000..d7b16f1e --- /dev/null +++ b/src/ejabberd.hrl @@ -0,0 +1,61 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +%% This macro returns a string of the ejabberd version running, e.g. "2.3.4" +%% If the ejabberd application description isn't loaded, returns atom: undefined +-define(VERSION, element(2, application:get_key(ejabberd,vsn))). + +-define(MYHOSTS, ejabberd_config:get_global_option(hosts)). +-define(MYNAME, hd(ejabberd_config:get_global_option(hosts))). +-define(MYLANG, ejabberd_config:get_global_option(language)). + +-define(MSGS_DIR, "msgs"). +-define(CONFIG_PATH, "ejabberd.cfg"). +-define(LOG_PATH, "ejabberd.log"). + +-define(EJABBERD_URI, "http://www.process-one.net/en/ejabberd/"). + +-define(S2STIMEOUT, 600000). + +%%-define(DBGFSM, true). + +%% --------------------------------- +%% Logging mechanism + +%% Print in standard output +-define(PRINT(Format, Args), + io:format(Format, Args)). + +-define(DEBUG(Format, Args), + ejabberd_logger:debug_msg(?MODULE,?LINE,Format, Args)). + +-define(INFO_MSG(Format, Args), + ejabberd_logger:info_msg(?MODULE,?LINE,Format, Args)). + +-define(WARNING_MSG(Format, Args), + ejabberd_logger:warning_msg(?MODULE,?LINE,Format, Args)). + +-define(ERROR_MSG(Format, Args), + ejabberd_logger:error_msg(?MODULE,?LINE,Format, Args)). + +-define(CRITICAL_MSG(Format, Args), + ejabberd_logger:critical_msg(?MODULE,?LINE,Format, Args)). + diff --git a/src/ejabberd_auth_ldap.erl b/src/ejabberd_auth_ldap.erl index 8cea87a8..e22be1bc 100644 --- a/src/ejabberd_auth_ldap.erl +++ b/src/ejabberd_auth_ldap.erl @@ -58,7 +58,7 @@ ]). -include("ejabberd.hrl"). --include("eldap.hrl"). +-include("eldap/eldap.hrl"). -record(state, {host, eldap_id, diff --git a/src/ejabberd_config.hrl b/src/ejabberd_config.hrl new file mode 100644 index 00000000..aa783ea5 --- /dev/null +++ b/src/ejabberd_config.hrl @@ -0,0 +1,28 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(config, {key, value}). +-record(local_config, {key, value}). +-record(state, {opts = [], + hosts = [], + override_local = false, + override_global = false, + override_acls = false}). diff --git a/src/ejabberd_ctl.hrl b/src/ejabberd_ctl.hrl new file mode 100644 index 00000000..e8daef90 --- /dev/null +++ b/src/ejabberd_ctl.hrl @@ -0,0 +1,25 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-define(STATUS_SUCCESS, 0). +-define(STATUS_ERROR, 1). +-define(STATUS_USAGE, 2). +-define(STATUS_BADRPC, 3). diff --git a/src/ejabberd_zlib/Makefile.in b/src/ejabberd_zlib/Makefile.in index 3a70186b..dd781d0a 100644 --- a/src/ejabberd_zlib/Makefile.in +++ b/src/ejabberd_zlib/Makefile.in @@ -19,8 +19,9 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/eldap/Makefile.in b/src/eldap/Makefile.in index 4c9c33c2..22cdad48 100644 --- a/src/eldap/Makefile.in +++ b/src/eldap/Makefile.in @@ -9,8 +9,9 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/eldap/eldap.hrl b/src/eldap/eldap.hrl new file mode 100644 index 00000000..75f6f76e --- /dev/null +++ b/src/eldap/eldap.hrl @@ -0,0 +1,35 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(eldap_search, {scope = wholeSubtree, + base = [], + filter, + limit = 0, + attributes = [], + types_only = false, + timeout = 0}). + + +-record(eldap_search_result, {entries, + referrals}). + +-record(eldap_entry, {object_name, + attributes}). diff --git a/src/jlib.hrl b/src/jlib.hrl new file mode 100644 index 00000000..3ea10b15 --- /dev/null +++ b/src/jlib.hrl @@ -0,0 +1,308 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-define(NS_DISCO_ITEMS, "http://jabber.org/protocol/disco#items"). +-define(NS_DISCO_INFO, "http://jabber.org/protocol/disco#info"). +-define(NS_VCARD, "vcard-temp"). +-define(NS_AUTH, "jabber:iq:auth"). +-define(NS_AUTH_ERROR, "jabber:iq:auth:error"). +-define(NS_REGISTER, "jabber:iq:register"). +-define(NS_SEARCH, "jabber:iq:search"). +-define(NS_ROSTER, "jabber:iq:roster"). +-define(NS_PRIVACY, "jabber:iq:privacy"). +-define(NS_PRIVATE, "jabber:iq:private"). +-define(NS_VERSION, "jabber:iq:version"). +-define(NS_TIME, "jabber:iq:time"). +-define(NS_LAST, "jabber:iq:last"). +-define(NS_XDATA, "jabber:x:data"). +-define(NS_IQDATA, "jabber:iq:data"). +-define(NS_DELAY, "jabber:x:delay"). +-define(NS_EXPIRE, "jabber:x:expire"). +-define(NS_EVENT, "jabber:x:event"). +-define(NS_XCONFERENCE, "jabber:x:conference"). +-define(NS_STATS, "http://jabber.org/protocol/stats"). +-define(NS_MUC, "http://jabber.org/protocol/muc"). +-define(NS_MUC_USER, "http://jabber.org/protocol/muc#user"). +-define(NS_MUC_ADMIN, "http://jabber.org/protocol/muc#admin"). +-define(NS_MUC_OWNER, "http://jabber.org/protocol/muc#owner"). +-define(NS_PUBSUB, "http://jabber.org/protocol/pubsub"). +-define(NS_PUBSUB_EVENT, "http://jabber.org/protocol/pubsub#event"). +-define(NS_PUBSUB_OWNER, "http://jabber.org/protocol/pubsub#owner"). +-define(NS_PUBSUB_NMI, "http://jabber.org/protocol/pubsub#node-meta-info"). +-define(NS_PUBSUB_ERRORS,"http://jabber.org/protocol/pubsub#errors"). +-define(NS_PUBSUB_NODE_CONFIG, "http://jabber.org/protocol/pubsub#node_config"). +-define(NS_PUBSUB_SUB_AUTH, "http://jabber.org/protocol/pubsub#subscribe_authorization"). +-define(NS_COMMANDS, "http://jabber.org/protocol/commands"). +-define(NS_BYTESTREAMS, "http://jabber.org/protocol/bytestreams"). +-define(NS_ADMIN, "http://jabber.org/protocol/admin"). + +-define(NS_EJABBERD_CONFIG, "ejabberd:config"). + +-define(NS_STREAM, "http://etherx.jabber.org/streams"). + +-define(NS_STANZAS, "urn:ietf:params:xml:ns:xmpp-stanzas"). +-define(NS_STREAMS, "urn:ietf:params:xml:ns:xmpp-streams"). + +-define(NS_TLS, "urn:ietf:params:xml:ns:xmpp-tls"). +-define(NS_SASL, "urn:ietf:params:xml:ns:xmpp-sasl"). +-define(NS_SESSION, "urn:ietf:params:xml:ns:xmpp-session"). +-define(NS_BIND, "urn:ietf:params:xml:ns:xmpp-bind"). + +-define(NS_FEATURE_IQAUTH, "http://jabber.org/features/iq-auth"). +-define(NS_FEATURE_IQREGISTER, "http://jabber.org/features/iq-register"). +-define(NS_FEATURE_COMPRESS, "http://jabber.org/features/compress"). + +-define(NS_COMPRESS, "http://jabber.org/protocol/compress"). + +-define(NS_CAPS, "http://jabber.org/protocol/caps"). + +% TODO: remove "code" attribute (currently it used for backward-compatibility) +-define(STANZA_ERROR(Code, Type, Condition), + {xmlelement, "error", + [{"code", Code}, {"type", Type}], + [{xmlelement, Condition, [{"xmlns", ?NS_STANZAS}], []}]}). + +-define(ERR_BAD_REQUEST, + ?STANZA_ERROR("400", "modify", "bad-request")). +-define(ERR_CONFLICT, + ?STANZA_ERROR("409", "cancel", "conflict")). +-define(ERR_FEATURE_NOT_IMPLEMENTED, + ?STANZA_ERROR("501", "cancel", "feature-not-implemented")). +-define(ERR_FORBIDDEN, + ?STANZA_ERROR("403", "auth", "forbidden")). +-define(ERR_GONE, + ?STANZA_ERROR("302", "modify", "gone")). +-define(ERR_INTERNAL_SERVER_ERROR, + ?STANZA_ERROR("500", "wait", "internal-server-error")). +-define(ERR_ITEM_NOT_FOUND, + ?STANZA_ERROR("404", "cancel", "item-not-found")). +-define(ERR_JID_MALFORMED, + ?STANZA_ERROR("400", "modify", "jid-malformed")). +-define(ERR_NOT_ACCEPTABLE, + ?STANZA_ERROR("406", "modify", "not-acceptable")). +-define(ERR_NOT_ALLOWED, + ?STANZA_ERROR("405", "cancel", "not-allowed")). +-define(ERR_NOT_AUTHORIZED, + ?STANZA_ERROR("401", "auth", "not-authorized")). +-define(ERR_PAYMENT_REQUIRED, + ?STANZA_ERROR("402", "auth", "payment-required")). +-define(ERR_RECIPIENT_UNAVAILABLE, + ?STANZA_ERROR("404", "wait", "recipient-unavailable")). +-define(ERR_REDIRECT, + ?STANZA_ERROR("302", "modify", "redirect")). +-define(ERR_REGISTRATION_REQUIRED, + ?STANZA_ERROR("407", "auth", "registration-required")). +-define(ERR_REMOTE_SERVER_NOT_FOUND, + ?STANZA_ERROR("404", "cancel", "remote-server-not-found")). +-define(ERR_REMOTE_SERVER_TIMEOUT, + ?STANZA_ERROR("504", "wait", "remote-server-timeout")). +-define(ERR_RESOURCE_CONSTRAINT, + ?STANZA_ERROR("500", "wait", "resource-constraint")). +-define(ERR_SERVICE_UNAVAILABLE, + ?STANZA_ERROR("503", "cancel", "service-unavailable")). +-define(ERR_SUBSCRIPTION_REQUIRED, + ?STANZA_ERROR("407", "auth", "subscription-required")). +-define(ERR_UNEXPECTED_REQUEST, + ?STANZA_ERROR("400", "wait", "unexpected-request")). +%-define(ERR_, +% ?STANZA_ERROR("", "", "")). + +-define(STANZA_ERRORT(Code, Type, Condition, Lang, Text), + {xmlelement, "error", + [{"code", Code}, {"type", Type}], + [{xmlelement, Condition, [{"xmlns", ?NS_STANZAS}], []}, + {xmlelement, "text", [{"xmlns", ?NS_STANZAS}], + [{xmlcdata, translate:translate(Lang, Text)}]}]}). + +-define(ERRT_BAD_REQUEST(Lang, Text), + ?STANZA_ERRORT("400", "modify", "bad-request", Lang, Text)). +-define(ERRT_CONFLICT(Lang, Text), + ?STANZA_ERRORT("409", "cancel", "conflict", Lang, Text)). +-define(ERRT_FEATURE_NOT_IMPLEMENTED(Lang, Text), + ?STANZA_ERRORT("501", "cancel", "feature-not-implemented", Lang, Text)). +-define(ERRT_FORBIDDEN(Lang, Text), + ?STANZA_ERRORT("403", "auth", "forbidden", Lang, Text)). +-define(ERRT_GONE(Lang, Text), + ?STANZA_ERRORT("302", "modify", "gone", Lang, Text)). +-define(ERRT_INTERNAL_SERVER_ERROR(Lang, Text), + ?STANZA_ERRORT("500", "wait", "internal-server-error", Lang, Text)). +-define(ERRT_ITEM_NOT_FOUND(Lang, Text), + ?STANZA_ERRORT("404", "cancel", "item-not-found", Lang, Text)). +-define(ERRT_JID_MALFORMED(Lang, Text), + ?STANZA_ERRORT("400", "modify", "jid-malformed", Lang, Text)). +-define(ERRT_NOT_ACCEPTABLE(Lang, Text), + ?STANZA_ERRORT("406", "modify", "not-acceptable", Lang, Text)). +-define(ERRT_NOT_ALLOWED(Lang, Text), + ?STANZA_ERRORT("405", "cancel", "not-allowed", Lang, Text)). +-define(ERRT_NOT_AUTHORIZED(Lang, Text), + ?STANZA_ERRORT("401", "auth", "not-authorized", Lang, Text)). +-define(ERRT_PAYMENT_REQUIRED(Lang, Text), + ?STANZA_ERRORT("402", "auth", "payment-required", Lang, Text)). +-define(ERRT_RECIPIENT_UNAVAILABLE(Lang, Text), + ?STANZA_ERRORT("404", "wait", "recipient-unavailable", Lang, Text)). +-define(ERRT_REDIRECT(Lang, Text), + ?STANZA_ERRORT("302", "modify", "redirect", Lang, Text)). +-define(ERRT_REGISTRATION_REQUIRED(Lang, Text), + ?STANZA_ERRORT("407", "auth", "registration-required", Lang, Text)). +-define(ERRT_REMOTE_SERVER_NOT_FOUND(Lang, Text), + ?STANZA_ERRORT("404", "cancel", "remote-server-not-found", Lang, Text)). +-define(ERRT_REMOTE_SERVER_TIMEOUT(Lang, Text), + ?STANZA_ERRORT("504", "wait", "remote-server-timeout", Lang, Text)). +-define(ERRT_RESOURCE_CONSTRAINT(Lang, Text), + ?STANZA_ERRORT("500", "wait", "resource-constraint", Lang, Text)). +-define(ERRT_SERVICE_UNAVAILABLE(Lang, Text), + ?STANZA_ERRORT("503", "cancel", "service-unavailable", Lang, Text)). +-define(ERRT_SUBSCRIPTION_REQUIRED(Lang, Text), + ?STANZA_ERRORT("407", "auth", "subscription-required", Lang, Text)). +-define(ERRT_UNEXPECTED_REQUEST(Lang, Text), + ?STANZA_ERRORT("400", "wait", "unexpected-request", Lang, Text)). + +% Auth stanza errors +-define(ERR_AUTH_NO_RESOURCE_PROVIDED(Lang), + ?ERRT_NOT_ACCEPTABLE(Lang, "No resource provided")). +-define(ERR_AUTH_BAD_RESOURCE_FORMAT(Lang), + ?ERRT_NOT_ACCEPTABLE(Lang, "Illegal resource format")). +-define(ERR_AUTH_RESOURCE_CONFLICT(Lang), + ?ERRT_CONFLICT(Lang, "Resource conflict")). + + +-define(STREAM_ERROR(Condition), + {xmlelement, "stream:error", + [], + [{xmlelement, Condition, [{"xmlns", ?NS_STREAMS}], []}]}). + +-define(SERR_BAD_FORMAT, + ?STREAM_ERROR("bad-format")). +-define(SERR_BAD_NAMESPACE_PREFIX, + ?STREAM_ERROR("bad-namespace-prefix")). +-define(SERR_CONFLICT, + ?STREAM_ERROR("conflict")). +-define(SERR_CONNECTION_TIMEOUT, + ?STREAM_ERROR("connection-timeout")). +-define(SERR_HOST_GONE, + ?STREAM_ERROR("host-gone")). +-define(SERR_HOST_UNKNOWN, + ?STREAM_ERROR("host-unknown")). +-define(SERR_IMPROPER_ADDRESSING, + ?STREAM_ERROR("improper-addressing")). +-define(SERR_INTERNAL_SERVER_ERROR, + ?STREAM_ERROR("internal-server-error")). +-define(SERR_INVALID_FROM, + ?STREAM_ERROR("invalid-from")). +-define(SERR_INVALID_ID, + ?STREAM_ERROR("invalid-id")). +-define(SERR_INVALID_NAMESPACE, + ?STREAM_ERROR("invalid-namespace")). +-define(SERR_INVALID_XML, + ?STREAM_ERROR("invalid-xml")). +-define(SERR_NOT_AUTHORIZED, + ?STREAM_ERROR("not-authorized")). +-define(SERR_POLICY_VIOLATION, + ?STREAM_ERROR("policy-violation")). +-define(SERR_REMOTE_CONNECTION_FAILED, + ?STREAM_ERROR("remote-connection-failed")). +-define(SERR_RESOURSE_CONSTRAINT, + ?STREAM_ERROR("resource-constraint")). +-define(SERR_RESTRICTED_XML, + ?STREAM_ERROR("restricted-xml")). +% TODO: include hostname or IP +-define(SERR_SEE_OTHER_HOST, + ?STREAM_ERROR("see-other-host")). +-define(SERR_SYSTEM_SHUTDOWN, + ?STREAM_ERROR("system-shutdown")). +-define(SERR_UNSUPPORTED_ENCODING, + ?STREAM_ERROR("unsupported-encoding")). +-define(SERR_UNSUPPORTED_STANZA_TYPE, + ?STREAM_ERROR("unsupported-stanza-type")). +-define(SERR_UNSUPPORTED_VERSION, + ?STREAM_ERROR("unsupported-version")). +-define(SERR_XML_NOT_WELL_FORMED, + ?STREAM_ERROR("xml-not-well-formed")). +%-define(SERR_, +% ?STREAM_ERROR("")). + +-define(STREAM_ERRORT(Condition, Lang, Text), + {xmlelement, "stream:error", + [], + [{xmlelement, Condition, [{"xmlns", ?NS_STREAMS}], []}, + {xmlelement, "text", [{"xml:lang", Lang}, {"xmlns", ?NS_STREAMS}], + [{xmlcdata, translate:translate(Lang, Text)}]}]}). + +-define(SERRT_BAD_FORMAT(Lang, Text), + ?STREAM_ERRORT("bad-format", Lang, Text)). +-define(SERRT_BAD_NAMESPACE_PREFIX(Lang, Text), + ?STREAM_ERRORT("bad-namespace-prefix", Lang, Text)). +-define(SERRT_CONFLICT(Lang, Text), + ?STREAM_ERRORT("conflict", Lang, Text)). +-define(SERRT_CONNECTION_TIMEOUT(Lang, Text), + ?STREAM_ERRORT("connection-timeout", Lang, Text)). +-define(SERRT_HOST_GONE(Lang, Text), + ?STREAM_ERRORT("host-gone", Lang, Text)). +-define(SERRT_HOST_UNKNOWN(Lang, Text), + ?STREAM_ERRORT("host-unknown", Lang, Text)). +-define(SERRT_IMPROPER_ADDRESSING(Lang, Text), + ?STREAM_ERRORT("improper-addressing", Lang, Text)). +-define(SERRT_INTERNAL_SERVER_ERROR(Lang, Text), + ?STREAM_ERRORT("internal-server-error", Lang, Text)). +-define(SERRT_INVALID_FROM(Lang, Text), + ?STREAM_ERRORT("invalid-from", Lang, Text)). +-define(SERRT_INVALID_ID(Lang, Text), + ?STREAM_ERRORT("invalid-id", Lang, Text)). +-define(SERRT_INVALID_NAMESPACE(Lang, Text), + ?STREAM_ERRORT("invalid-namespace", Lang, Text)). +-define(SERRT_INVALID_XML(Lang, Text), + ?STREAM_ERRORT("invalid-xml", Lang, Text)). +-define(SERRT_NOT_AUTHORIZED(Lang, Text), + ?STREAM_ERRORT("not-authorized", Lang, Text)). +-define(SERRT_POLICY_VIOLATION(Lang, Text), + ?STREAM_ERRORT("policy-violation", Lang, Text)). +-define(SERRT_REMOTE_CONNECTION_FAILED(Lang, Text), + ?STREAM_ERRORT("remote-connection-failed", Lang, Text)). +-define(SERRT_RESOURSE_CONSTRAINT(Lang, Text), + ?STREAM_ERRORT("resource-constraint", Lang, Text)). +-define(SERRT_RESTRICTED_XML(Lang, Text), + ?STREAM_ERRORT("restricted-xml", Lang, Text)). +% TODO: include hostname or IP +-define(SERRT_SEE_OTHER_HOST(Lang, Text), + ?STREAM_ERRORT("see-other-host", Lang, Text)). +-define(SERRT_SYSTEM_SHUTDOWN(Lang, Text), + ?STREAM_ERRORT("system-shutdown", Lang, Text)). +-define(SERRT_UNSUPPORTED_ENCODING(Lang, Text), + ?STREAM_ERRORT("unsupported-encoding", Lang, Text)). +-define(SERRT_UNSUPPORTED_STANZA_TYPE(Lang, Text), + ?STREAM_ERRORT("unsupported-stanza-type", Lang, Text)). +-define(SERRT_UNSUPPORTED_VERSION(Lang, Text), + ?STREAM_ERRORT("unsupported-version", Lang, Text)). +-define(SERRT_XML_NOT_WELL_FORMED(Lang, Text), + ?STREAM_ERRORT("xml-not-well-formed", Lang, Text)). +%-define(SERRT_(Lang, Text), +% ?STREAM_ERRORT("", Lang, Text)). + + +-record(jid, {user, server, resource, + luser, lserver, lresource}). + +-record(iq, {id = "", + type, + xmlns = "", + lang = "", + sub_el}). + diff --git a/src/mod_irc/Makefile.in b/src/mod_irc/Makefile.in index 86212e45..76a2d57f 100644 --- a/src/mod_irc/Makefile.in +++ b/src/mod_irc/Makefile.in @@ -16,7 +16,7 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/mod_muc/Makefile.in b/src/mod_muc/Makefile.in index 80725d33..5ede5e52 100644 --- a/src/mod_muc/Makefile.in +++ b/src/mod_muc/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/mod_offline.erl b/src/mod_offline.erl index 3db29844..3a751c32 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -43,8 +43,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). --include("ejabberd_http.hrl"). --include("ejabberd_web_admin.hrl"). +-include("web/ejabberd_http.hrl"). +-include("web/ejabberd_web_admin.hrl"). -record(offline_msg, {us, timestamp, expire, from, to, packet}). diff --git a/src/mod_offline_odbc.erl b/src/mod_offline_odbc.erl index 79d7c51a..c3d0513d 100644 --- a/src/mod_offline_odbc.erl +++ b/src/mod_offline_odbc.erl @@ -42,8 +42,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). --include("ejabberd_http.hrl"). --include("ejabberd_web_admin.hrl"). +-include("web/ejabberd_http.hrl"). +-include("web/ejabberd_web_admin.hrl"). -record(offline_msg, {user, timestamp, expire, from, to, packet}). diff --git a/src/mod_privacy.hrl b/src/mod_privacy.hrl new file mode 100644 index 00000000..21ad1c96 --- /dev/null +++ b/src/mod_privacy.hrl @@ -0,0 +1,37 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(privacy, {us, + default = none, + lists = []}). + +-record(listitem, {type = none, + value = none, + action, + order, + match_all = false, + match_iq = false, + match_message = false, + match_presence_in = false, + match_presence_out = false + }). + +-record(userlist, {name = none, list = []}). diff --git a/src/mod_proxy65/Makefile.in b/src/mod_proxy65/Makefile.in index 62ae77c9..3fc94c66 100644 --- a/src/mod_proxy65/Makefile.in +++ b/src/mod_proxy65/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/mod_proxy65/mod_proxy65.hrl b/src/mod_proxy65/mod_proxy65.hrl new file mode 100644 index 00000000..66cb86f4 --- /dev/null +++ b/src/mod_proxy65/mod_proxy65.hrl @@ -0,0 +1,61 @@ +%%%---------------------------------------------------------------------- +%%% RFC 1928 constants. +%%% +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +%% Version +-define(VERSION_5, 5). + +%% Authentication methods +-define(AUTH_ANONYMOUS, 0). +-define(AUTH_GSSAPI, 1). +-define(AUTH_PLAIN, 2). +-define(AUTH_NO_METHODS, 16#FF). + +%% Address Type +-define(ATYP_IPV4, 1). +-define(ATYP_DOMAINNAME, 3). +-define(ATYP_IPV6, 4). + +%% Commands +-define(CMD_CONNECT, 1). +-define(CMD_BIND, 2). +-define(CMD_UDP, 3). + +%% RFC 1928 replies +-define(SUCCESS, 0). +-define(ERR_GENERAL_FAILURE, 1). +-define(ERR_NOT_ALLOWED, 2). +-define(ERR_NETWORK_UNREACHABLE, 3). +-define(ERR_HOST_UNREACHABLE, 4). +-define(ERR_CONNECTION_REFUSED, 5). +-define(ERR_TTL_EXPIRED, 6). +-define(ERR_COMMAND_NOT_SUPPORTED, 7). +-define(ERR_ADDRESS_TYPE_NOT_SUPPORTED, 8). + +%% RFC 1928 defined timeout. +-define(SOCKS5_REPLY_TIMEOUT, 10000). + +-record(s5_request, { + rsv = 0, + cmd, + sha1 + }). diff --git a/src/mod_pubsub/Makefile.in b/src/mod_pubsub/Makefile.in index 25dbf57a..4088303c 100644 --- a/src/mod_pubsub/Makefile.in +++ b/src/mod_pubsub/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/mod_pubsub/pubsub.hrl b/src/mod_pubsub/pubsub.hrl new file mode 100644 index 00000000..25f60c36 --- /dev/null +++ b/src/mod_pubsub/pubsub.hrl @@ -0,0 +1,131 @@ +%%% ==================================================================== +%%% ``The contents of this file are subject to the Erlang Public License, +%%% Version 1.1, (the "License"); you may not use this file except in +%%% compliance with the License. You should have received a copy of the +%%% Erlang Public License along with this software. If not, it can be +%%% retrieved via the world wide web at http://www.erlang.org/. +%%% +%%% Software distributed under the License is distributed on an "AS IS" +%%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See +%%% the License for the specific language governing rights and limitations +%%% under the License. +%%% +%%% The Initial Developer of the Original Code is Process-one. +%%% Portions created by Process-one are Copyright 2006-2008, Process-one +%%% All Rights Reserved.'' +%%% This software is copyright 2006-2008, Process-one. +%%% +%%% +%%% copyright 2006-2008 Process-one +%%% +%%% This file contains pubsub types definition. +%%% ==================================================================== + +%% ------------------------------- +%% Pubsub constants +-define(ERR_EXTENDED(E,C), mod_pubsub:extended_error(E,C)). + +%% this is currently a hard limit. +%% Would be nice to have it configurable. +-define(MAXITEMS, 20). +-define(MAX_PAYLOAD_SIZE, 60000). + +%% ------------------------------- +%% Pubsub types + +%%% @type host() = string(). +%%% <p><tt>host</tt> is the name of the PubSub service. For example, it can be +%%% <tt>"pubsub.localhost"</tt>.</p> + +%%% @type pubsubNode() = [string()]. +%%% <p>A node is defined by a list of its ancestors. The last element is the name +%%% of the current node. For example: +%%% ```["home", "localhost", "cromain", "node1"]'''</p> + +%%% @type stanzaError() = #xmlelement{}. +%%% Example: +%%% ```{xmlelement, "error", +%%% [{"code", Code}, {"type", Type}], +%%% [{xmlelement, Condition, [{"xmlns", ?NS_STANZAS}], []}]}''' + +%%% @type pubsubIQResponse() = #xmlelement{}. +%%% Example: +%%% ```{xmlelement, "pubsub", +%%% [{"xmlns", ?NS_PUBSUB_EVENT}], +%%% [{xmlelement, "affiliations", [], +%%% []}]}''' + +%%% @type nodeOption() = {Option::atom(), Value::term()}. +%%% Example: +%%% ```{deliver_payloads, true}''' + +%%% @type nodeType() = string(). +%%% <p>The <tt>nodeType</tt> is a string containing the name of the PubSub +%%% plugin to use to manage a given node. For example, it can be +%%% <tt>"default"</tt>, <tt>"collection"</tt> or <tt>"blog"</tt>.</p> + +%%% @type jid() = #jid{ +%%% user = string(), +%%% server = string(), +%%% resource = string(), +%%% luser = string(), +%%% lserver = string(), +%%% lresource = string()}. + +%%% @type usr() = {User::string(), Server::string(), Resource::string()}. + +%%% @type affiliation() = none | owner | publisher | outcast. +%%% @type subscription() = none | pending | unconfigured | subscribed. + +%%% @type pubsubNode() = #pubsub_node{ +%%% nodeid = {Host::host(), Node::pubsubNode()}, +%%% parentid = {Host::host(), Node::pubsubNode()}, +%%% type = nodeType(), +%%% owners = [usr()], +%%% options = [nodeOption()]}. +%%% <p>This is the format of the <tt>nodes</tt> table. The type of the table +%%% is: <tt>set</tt>,<tt>ram/disc</tt>.</p> +%%% <p>The <tt>parentid</tt> and <tt>type</tt> fields are indexed.</p> +-record(pubsub_node, {nodeid, + parentid = {}, + type = "", + owners = [], + options = [] + }). + +%%% @type pubsubState() = #pubsub_state{ +%%% stateid = {jid(), {Host::host(), Node::pubsubNode()}}, +%%% items = [ItemId::string()], +%%% affiliation = affiliation(), +%%% subscription = subscription()}. +%%% <p>This is the format of the <tt>affiliations</tt> table. The type of the +%%% table is: <tt>set</tt>,<tt>ram/disc</tt>.</p> +-record(pubsub_state, {stateid, + items = [], + affiliation = none, + subscription = none +}). + +%% @type pubsubItem() = #pubsub_item{ +%% itemid = {ItemId::string(), {Host::host(),Node::pubsubNode()}}, +%% creation = {JID::jid(), now()}, +%% modification = {JID::jid(), now()}, +%% payload = XMLContent::string()}. +%%% <p>This is the format of the <tt>published items</tt> table. The type of the +%%% table is: <tt>set</tt>,<tt>disc</tt>,<tt>fragmented</tt>.</p> +-record(pubsub_item, {itemid, + creation = {unknown,unknown}, + modification = {unknown,unknown}, + payload = [] + }). + + +%% @type pubsubPresence() = #pubsub_presence{ +%% key = {Host::host(), User::string(), Server::string()}, +%% presence = list()}. +%%% <p>This is the format of the <tt>published presence</tt> table. The type of the +%%% table is: <tt>set</tt>,<tt>ram</tt>.</p> +-record(pubsub_presence, {key, + resource + }). + diff --git a/src/mod_roster.erl b/src/mod_roster.erl index c1569bb6..038de586 100644 --- a/src/mod_roster.erl +++ b/src/mod_roster.erl @@ -47,8 +47,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("ejabberd_http.hrl"). --include("ejabberd_web_admin.hrl"). +-include("web/ejabberd_http.hrl"). +-include("web/ejabberd_web_admin.hrl"). start(Host, Opts) -> diff --git a/src/mod_roster.hrl b/src/mod_roster.hrl new file mode 100644 index 00000000..2a2e8bc7 --- /dev/null +++ b/src/mod_roster.hrl @@ -0,0 +1,31 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(roster, {usj, + us, + jid, + name = "", + subscription = none, + ask = none, + groups = [], + askmessage = [], + xs = []}). + diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl index dfb76dcb..d3812156 100644 --- a/src/mod_roster_odbc.erl +++ b/src/mod_roster_odbc.erl @@ -46,8 +46,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("ejabberd_http.hrl"). --include("ejabberd_web_admin.hrl"). +-include("web/ejabberd_http.hrl"). +-include("web/ejabberd_web_admin.hrl"). start(Host, Opts) -> diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl index f363bd22..ff378010 100644 --- a/src/mod_shared_roster.erl +++ b/src/mod_shared_roster.erl @@ -52,8 +52,8 @@ -include("ejabberd.hrl"). -include("jlib.hrl"). -include("mod_roster.hrl"). --include("ejabberd_http.hrl"). --include("ejabberd_web_admin.hrl"). +-include("web/ejabberd_http.hrl"). +-include("web/ejabberd_web_admin.hrl"). -record(sr_group, {group_host, opts}). -record(sr_user, {us, group_host}). diff --git a/src/mod_vcard_ldap.erl b/src/mod_vcard_ldap.erl index 2225f7c8..2b5e7faa 100644 --- a/src/mod_vcard_ldap.erl +++ b/src/mod_vcard_ldap.erl @@ -50,7 +50,7 @@ ]). -include("ejabberd.hrl"). --include("eldap.hrl"). +-include("eldap/eldap.hrl"). -include("jlib.hrl"). -define(PROCNAME, ejabberd_mod_vcard_ldap). diff --git a/src/odbc/Makefile.in b/src/odbc/Makefile.in index 5bd130b6..3f4898d3 100644 --- a/src/odbc/Makefile.in +++ b/src/odbc/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/pam/Makefile.in b/src/pam/Makefile.in index 57c1ab78..bde28940 100644 --- a/src/pam/Makefile.in +++ b/src/pam/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ @PAM_LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/stringprep/Makefile.in b/src/stringprep/Makefile.in index 248aee69..3ac6c24d 100644 --- a/src/stringprep/Makefile.in +++ b/src/stringprep/Makefile.in @@ -16,7 +16,9 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS = -I .. -pz .. +EFLAGS += -I .. +EFLAGS += -pz .. + # make debug=true to compile Erlang module with debug informations. ifdef debug EFLAGS+=+debug_info diff --git a/src/tls/Makefile.in b/src/tls/Makefile.in index db4a874e..b6f10efc 100644 --- a/src/tls/Makefile.in +++ b/src/tls/Makefile.in @@ -19,7 +19,7 @@ else DYNAMIC_LIB_CFLAGS = -fpic -shared endif -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/web/Makefile.in b/src/web/Makefile.in index 3a75f7e1..151f4c47 100644 --- a/src/web/Makefile.in +++ b/src/web/Makefile.in @@ -9,7 +9,7 @@ LIBS = @LIBS@ ERLANG_CFLAGS = @ERLANG_CFLAGS@ ERLANG_LIBS = @ERLANG_LIBS@ -EFLAGS += -I ../../include +EFLAGS += -I .. EFLAGS += -pz .. # make debug=true to compile Erlang module with debug informations. diff --git a/src/web/ejabberd_http.hrl b/src/web/ejabberd_http.hrl new file mode 100644 index 00000000..4bcf047e --- /dev/null +++ b/src/web/ejabberd_http.hrl @@ -0,0 +1,30 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-record(request, {method, + path, + q = [], + us, + auth, + lang = "", + data = "", + ip + }). diff --git a/src/web/ejabberd_web_admin.hrl b/src/web/ejabberd_web_admin.hrl new file mode 100644 index 00000000..7c37d076 --- /dev/null +++ b/src/web/ejabberd_web_admin.hrl @@ -0,0 +1,52 @@ +%%%---------------------------------------------------------------------- +%%% +%%% ejabberd, Copyright (C) 2002-2008 Process-one +%%% +%%% This program is free software; you can redistribute it and/or +%%% modify it under the terms of the GNU General Public License as +%%% published by the Free Software Foundation; either version 2 of the +%%% License, or (at your option) any later version. +%%% +%%% This program is distributed in the hope that it will be useful, +%%% but WITHOUT ANY WARRANTY; without even the implied warranty of +%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +%%% General Public License for more details. +%%% +%%% You should have received a copy of the GNU General Public License +%%% along with this program; if not, write to the Free Software +%%% Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +%%% 02111-1307 USA +%%% +%%%---------------------------------------------------------------------- + +-define(X(Name), {xmlelement, Name, [], []}). +-define(XA(Name, Attrs), {xmlelement, Name, Attrs, []}). +-define(XE(Name, Els), {xmlelement, Name, [], Els}). +-define(XAE(Name, Attrs, Els), {xmlelement, Name, Attrs, Els}). +-define(C(Text), {xmlcdata, Text}). +-define(XC(Name, Text), ?XE(Name, [?C(Text)])). +-define(XAC(Name, Attrs, Text), ?XAE(Name, Attrs, [?C(Text)])). + +-define(T(Text), translate:translate(Lang, Text)). +-define(CT(Text), ?C(?T(Text))). +-define(XCT(Name, Text), ?XC(Name, ?T(Text))). +-define(XACT(Name, Attrs, Text), ?XAC(Name, Attrs, ?T(Text))). + +-define(LI(Els), ?XE("li", Els)). +-define(A(URL, Els), ?XAE("a", [{"href", URL}], Els)). +-define(AC(URL, Text), ?A(URL, [?C(Text)])). +-define(ACT(URL, Text), ?AC(URL, ?T(Text))). +-define(P, ?X("p")). +-define(BR, ?X("br")). +-define(INPUT(Type, Name, Value), + ?XA("input", [{"type", Type}, + {"name", Name}, + {"value", Value}])). +-define(INPUTT(Type, Name, Value), ?INPUT(Type, Name, ?T(Value))). +-define(INPUTS(Type, Name, Value, Size), + ?XA("input", [{"type", Type}, + {"name", Name}, + {"value", Value}, + {"size", Size}])). +-define(INPUTST(Type, Name, Value, Size), ?INPUT(Type, Name, ?T(Value), Size)). +-define(ACLINPUT(Text), ?XE("td", [?INPUT("text", "value" ++ ID, Text)])). |