Figure A.2: Web Admin showing a virtual host when the web browser provides the
+Figure A.2: Web Admin showing a virtual host when the web browser provides the
HTTP header ‘Accept-Language: ru’ |
diff --git a/doc/guide.tex b/doc/guide.tex
index 7d5631f9c..6c62769ae 100644
--- a/doc/guide.tex
+++ b/doc/guide.tex
@@ -102,7 +102,7 @@
\include{contributed_modules}
%% Common options
-\newcommand{\iqdiscitem}[1]{\titem{iqdisc} \ind{options!iqdisc}This specifies
+\newcommand{\iqdiscitem}[1]{\titem{iqdisc} \ind{options!iqdisc}This specifies
the processing discipline for #1 IQ queries (see section~\ref{modiqdiscoption}).}
\newcommand{\hostitem}[1]{
\titem{host} \ind{options!host} This option defines the Jabber ID of the
@@ -159,8 +159,8 @@ ejabberd Development Team
\newstyle{table[border="1"]}{border-collapse:collapse;margin-bottom:1em;}
\newstyle{table[border="1"] td}{border:1px solid \#aaa;padding:2px}
% Don't display before and after tables or images:
-\newstyle{BLOCKQUOTE.table DIV.center DIV.center HR}{display:none;}
-\newstyle{BLOCKQUOTE.figure DIV.center DIV.center HR}{display:none;}
+\newstyle{BLOCKQUOTE.table DIV.center DIV.center HR}{display:none;}
+\newstyle{BLOCKQUOTE.figure DIV.center DIV.center HR}{display:none;}
%% Footnotes
\begin{latexonly}
@@ -208,8 +208,8 @@ ejabberd Development Team
\makesection{install.binary}{Installing \ejabberd{} with Binary Installer}
Probably the easiest way to install an \ejabberd{} instant messaging server
-is using the binary installer published by ProcessOne.
-The binary installers of released \ejabberd{} versions
+is using the binary installer published by ProcessOne.
+The binary installers of released \ejabberd{} versions
are available in the ProcessOne \ejabberd{} downloads page:
\ahrefurl{http://www.process-one.net/en/ejabberd/downloads}
@@ -227,17 +227,17 @@ or automatically by the operating system at system boot time.
To start and stop \ejabberd{} manually,
use the desktop shortcuts created by the installer.
-If the machine doesn't have a graphical system, use the scripts 'start'
+If the machine doesn't have a graphical system, use the scripts 'start'
and 'stop' in the 'bin' directory where \ejabberd{} is installed.
The Windows installer also adds ejabberd as a system service,
and a shortcut to a debug console for experienced administrators.
-If you want ejabberd to be started automatically at boot time,
+If you want ejabberd to be started automatically at boot time,
go to the Windows service settings and set ejabberd to be automatically started.
-Note that the Windows service is a feature still in development,
+Note that the Windows service is a feature still in development,
and for example it doesn't read the file ejabberdctl.cfg.
-On a *nix system, if you want ejabberd to be started as daemon at boot time,
+On a *nix system, if you want ejabberd to be started as daemon at boot time,
copy \term{ejabberd.init} from the 'bin' directory to something like \term{/etc/init.d/ejabberd}
(depending on your distribution) and call \term{/etc/inid.d/ejabberd start} to start it.
@@ -263,9 +263,9 @@ and configurable options to fine tune the Erlang runtime system.
\makesection{install.os}{Installing \ejabberd{} with Operating System specific packages}
-Some Operating Systems provide a specific \ejabberd{} package adapted to
+Some Operating Systems provide a specific \ejabberd{} package adapted to
the system architecture and libraries.
-It usually also checks dependencies
+It usually also checks dependencies
and performs basic configuration tasks like creating the initial
administrator account. Some examples are Debian and Gentoo. Consult the
resources provided by your Operating System for more information.
@@ -282,7 +282,7 @@ The binaries are available for many different system architectures, so this is a
alternative to the binary installer and Operating System's \ejabberd{} packages.
You will have to create your own \ejabberd{} start
-script depending of how you handle your CEAN installation.
+script depending of how you handle your CEAN installation.
The default \term{ejabberdctl} script is located
into \ejabberd{}'s priv directory and can be used as an example.
@@ -290,7 +290,7 @@ into \ejabberd{}'s priv directory and can be used as an example.
\ind{install}
The canonical form for distribution of \ejabberd{} stable releases is the source code package.
-Compiling \ejabberd{} from source code is quite easy in *nix systems,
+Compiling \ejabberd{} from source code is quite easy in *nix systems,
as long as your system have all the dependencies.
\makesubsection{installreq}{Requirements}
@@ -337,12 +337,12 @@ To get the full list run the command:
Some options that you may be interested in modifying:
\begin{description}
- \titem{--prefix=/}
+ \titem{--prefix=/}
Specify the path prefix where the files will be copied when running
the \term{make install} command.
\titem{--enable-user[=USER]}
- Allow this normal system user to execute the ejabberdctl script
+ Allow this normal system user to execute the ejabberdctl script
(see section~\ref{ejabberdctl}),
read the configuration files,
read and write in the spool directory,
@@ -352,20 +352,20 @@ Some options that you may be interested in modifying:
This account doesn't need an explicit HOME directory, because
\term{/var/lib/ejabberd/} will be used by default.
- \titem{--enable-pam}
+ \titem{--enable-pam}
Enable the PAM authentication method (see section \ref{pam}).
\titem{--enable-odbc or --enable-mssql}
Required if you want to use an external database.
See section~\ref{database} for more information.
- \titem{--enable-full-xml}
+ \titem{--enable-full-xml}
Enable the use of XML based optimisations.
- It will for example use CDATA to escape characters in the XMPP stream.
+ It will for example use CDATA to escape characters in the XMPP stream.
Use this option only if you are sure your Jabber clients include a fully compliant XML parser.
\titem{--disable-transient-supervisors}
- Disable the use of Erlang/OTP supervision for transient processes.
+ Disable the use of Erlang/OTP supervision for transient processes.
\end{description}
@@ -456,8 +456,8 @@ gmake
You need to have \term{GNU install},
but it isn't included in Solaris.
It can be easily installed if your Solaris system
-is set up for \footahref{http://www.blastwave.org/}{blastwave.org}
-package repository.
+is set up for \footahref{http://www.blastwave.org/}{blastwave.org}
+package repository.
Make sure \term{/opt/csw/bin} is in your \term{PATH} and run:
\begin{verbatim}
pkg-get -i fileutils
@@ -519,8 +519,8 @@ We assume that we will try to put as much library as possible into \verb|C:\sdk\
\verb|C:\sdk\GnuWin32\bin| to the \verb|PATH| environment
variable.
\item Install OpenSSL in \verb|C:\sdk\OpenSSL| and add \verb|C:\sdk\OpenSSL\lib\VC| to your path or copy the binaries to your system directory.
-\item Install ZLib in \verb|C:\sdk\gnuWin32|. Copy
- \verb|C:\sdk\GnuWin32\bin\zlib1.dll| to your system directory. If you change your path it should already be set after libiconv install.
+\item Install ZLib in \verb|C:\sdk\gnuWin32|. Copy
+ \verb|C:\sdk\GnuWin32\bin\zlib1.dll| to your system directory. If you change your path it should already be set after libiconv install.
\item Make sure the you can access Erlang binaries from your path. For example: \verb|set PATH=%PATH%;"C:\sdk\erl5.5.5\bin"|
\item Depending on how you end up actually installing the library you might need to check and tweak the paths in the file configure.erl.
\item While in the directory \verb|ejabberd\src| run:
@@ -542,20 +542,20 @@ werl -s ejabberd -name ejabberd
You need a Jabber account and grant him administrative privileges
to enter the \ejabberd{} Web Admin:
\begin{enumerate}
-\item Register a Jabber account on your \ejabberd{} server, for example \term{admin1@example.org}.
+\item Register a Jabber account on your \ejabberd{} server, for example \term{admin1@example.org}.
There are two ways to register a Jabber account:
\begin{enumerate}
\item Using \term{ejabberdctl}\ind{ejabberdctl} (see section~\ref{ejabberdctl}):
\begin{verbatim}
ejabberdctl register admin1 example.org FgT5bk3
-\end{verbatim}
+\end{verbatim}
\item Using a Jabber client and In-Band Registration (see section~\ref{modregister}).
\end{enumerate}
\item Edit the \ejabberd{} configuration file to give administration rights to the Jabber account you created:
\begin{verbatim}
{acl, admins, {user, "admin1", "example.org"}}.
{access, configure, [{allow, admins}]}.
-\end{verbatim}
+\end{verbatim}
You can grant administrative privileges to many Jabber accounts,
and also to accounts in other Jabber servers.
\item Restart \ejabberd{} to load the new configuration.
@@ -569,7 +569,7 @@ ejabberdctl register admin1 example.org FgT5bk3
To upgrade an ejabberd installation to a new version,
simply uninstall the old version, and then install the new one.
-Of course, it is important that the configuration file
+Of course, it is important that the configuration file
and Mnesia database spool directory are not removed.
\ejabberd{} automatically updates the Mnesia table definitions at startup when needed.
@@ -586,9 +586,9 @@ indicates you need to also update those tables.
The configuration file will be loaded the first time you start \ejabberd{}. The
content from this file will be parsed and stored in the internal \ejabberd{} database. Subsequently the
configuration will be loaded from the database and any commands in the
-configuration file are appended to the entries in the database.
+configuration file are appended to the entries in the database.
-Note that \ejabberd{} never edits the configuration file.
+Note that \ejabberd{} never edits the configuration file.
So, the configuration changes done using the Web Admin
are stored in the database, but are not reflected in the configuration file.
If you want those changes to be use after \ejabberd{} restart, you can either
@@ -675,7 +675,7 @@ Examples:
{ldap_password, ""}]}.
\end{verbatim}
\end{itemize}
-
+
To define specific ejabberd modules in a virtual host,
you can define the global \term{modules} option with the common modules,
and later add specific modules to certain virtual hosts.
@@ -740,7 +740,7 @@ tuple with the following elements:
\ind{modules!ejabberd\_c2s}\ind{modules!ejabberd\_s2s\_in}\ind{modules!ejabberd\_service}\ind{modules!ejabberd\_http}\ind{protocols!XEP-0114: Jabber Component Protocol}
The available modules, their purpose and the options allowed by each one are:
\begin{description}
- \titem{\texttt{ejabberd\_c2s}}
+ \titem{\texttt{ejabberd\_c2s}}
Handles c2s connections.\\
Options: \texttt{access}, \texttt{certfile}, \texttt{inet6},
\texttt{ip}, \texttt{max\_stanza\_size}, \texttt{shaper},
@@ -750,7 +750,7 @@ The available modules, their purpose and the options allowed by each one are:
Handles incoming s2s connections.\\
Options: \texttt{inet6}, \texttt{ip}, \texttt{max\_stanza\_size}
\titem{\texttt{ejabberd\_service}}
- Interacts with an \footahref{http://www.ejabberd.im/tutorials-transports}{external component}
+ Interacts with an \footahref{http://www.ejabberd.im/tutorials-transports}{external component}
(as defined in the Jabber Component Protocol (\xepref{0114}).\\
Options: \texttt{access}, \texttt{hosts}, \texttt{inet6},
\texttt{ip}, \texttt{shaper}, \texttt{service\_check\_from}
@@ -791,7 +791,7 @@ This is a detailed description of each option allowed by the listening modules:
\verb|http://server:port/http-bind/|. Be aware that support for HTTP Bind
is also needed in the \Jabber{} client. Remark also that HTTP Bind can be
interesting to host a web-based \Jabber{} client such as
- \footahref{http://jwchat.sourceforge.net/}{JWChat}
+ \footahref{http://jwchat.sourceforge.net/}{JWChat}
(check the tutorials to install JWChat with ejabberd and an
\footahref{http://www.ejabberd.im/jwchat-localserver}{embedded local web server}
or \footahref{http://www.ejabberd.im/jwchat-apache}{Apache}).
@@ -807,7 +807,7 @@ This is a detailed description of each option allowed by the listening modules:
\footahref{http://jwchat.sourceforge.net/}{JWChat}.
\titem{inet6} \ind{options!inet6}\ind{IPv6}Set up the socket for IPv6 instead of IPv4.
Note: this option is not required for S2S outgoing connections,
- because when ejabberd attempts to establish a S2S outgoing connection
+ because when ejabberd attempts to establish a S2S outgoing connection
it first tries IPv4, and if that fails it attempts with IPv6.
\titem{\{ip, IPAddress\}} \ind{options!ip}This option specifies which network
interface to listen for. For example \verb|{ip, {192, 168, 1, 1}}|.
@@ -839,7 +839,7 @@ This is a detailed description of each option allowed by the listening modules:
You can define a certificate file for a specific domain using the global option \option{domain\_certfile}.
\titem{starttls\_required} \ind{options!starttls\_required}This option
specifies that STARTTLS encryption is required on connections to the port.
- No unencrypted connections will be allowed.
+ No unencrypted connections will be allowed.
You should also set the \option{certfile} option.
You can define a certificate file for a specific domain using the global option \option{domain\_certfile}.
\titem{tls} \ind{options!tls}\ind{TLS}This option specifies that traffic on
@@ -872,7 +872,7 @@ There are some additional global options:
The default value is \term{allow}.
\titem{\{\{s2s\_host, Host\}, allow|deny\}}
Defines if incoming and outgoing s2s connections with a specific remote host are allowed or denied.
- This allows to restrict ejabberd to only establish s2s connections
+ This allows to restrict ejabberd to only establish s2s connections
with a small list of trusted servers, or to block some specific servers.
\titem{\{s2s\_max\_retry\_delay, Seconds\}} \ind{options!s2s\_max\_retry\_delay}
The maximum allowed delay for retry to connect after a failed connection attempt.
@@ -883,7 +883,7 @@ For example, the following simple configuration defines:
\begin{itemize}
\item There are three domains. The default certificate file is \term{server.pem}.
However, the c2s and s2s connections to the domain \term{example.com} use the file \term{example\_com.pem}.
-\item Port 5222 listens for c2s connections with STARTTLS,
+\item Port 5222 listens for c2s connections with STARTTLS,
and also allows plain connections for old clients.
\item Port 5223 listens for c2s connections with the old SSL.
\item Port 5269 listens for s2s connections with STARTTLS.
@@ -896,7 +896,7 @@ However, the c2s and s2s connections to the domain \term{example.com} use the fi
{listen,
[
{5222, ejabberd_c2s, [
- {access, c2s},
+ {access, c2s},
{shaper, c2s_shaper},
starttls, {certfile, "/etc/ejabberd/server.pem"},
{max_stanza_size, 65536}
@@ -936,7 +936,7 @@ In this example, the following configuration defines that:
\item Port 5280 is serving the Web Admin and the HTTP Polling service. Note
that it is also possible to serve them on different ports. The second
example in section~\ref{webadmin} shows how exactly this can be done.
-\item All users except for the administrators have a traffic of limit
+\item All users except for the administrators have a traffic of limit
1,000\,Bytes/second
\item \ind{transports!AIM}The
\footahref{http://www.ejabberd.im/pyaimt}{AIM transport}
@@ -1380,7 +1380,7 @@ following syntax:
\end{verbatim}
where \term{} stands for the maximum allowed incoming rate in bytes per
second.
-When a connection exceeds this limit, \ejabberd{} stops reading from the socket
+When a connection exceeds this limit, \ejabberd{} stops reading from the socket
until the average rate is again below the allowed maximum.
Examples:
@@ -1462,7 +1462,7 @@ The file is in a subdirectory from where the main configuration file is.
{include_config_file, "./example.org/additional_not_listen.cfg", [{disallow, [listen]}]}.
\end{verbatim}
-In this example, \term{ejabberd.cfg} defines some ACL and Access rules,
+In this example, \term{ejabberd.cfg} defines some ACL and Access rules,
and later includes another file with additional rules:
\begin{verbatim}
{acl, admin, {user, "admin", "localhost"}}.
@@ -1609,14 +1609,21 @@ Use this option to modify the value:
{odbc_pool_size, 10}.
\end{verbatim}
-You can configure an interval to make a dummy SQL request
-to keep alive the connections to the database.
-The default value is 'undefined', so no keepalive requests are made.
+You can configure an interval to make a dummy SQL request
+to keep alive the connections to the database.
+The default value is 'undefined', so no keepalive requests are made.
Specify in seconds: for example 28800 means 8 hours.
\begin{verbatim}
{odbc_keepalive_interval, undefined}.
\end{verbatim}
+If the connection to the database fails, \ejabberd{} waits 30 seconds before retrying.
+You can modify this interval with this option:
+\begin{verbatim}
+{odbc_start_interval, 30}.
+\end{verbatim}
+
+
\makesubsubsection{compilemysql}{Driver Compilation}
\ind{MySQL!Driver Compilation}
@@ -1706,9 +1713,9 @@ Use this option to modify the value:
{odbc_pool_size, 10}.
\end{verbatim}
-You can configure an interval to make a dummy SQL request
-to keep alive the connections to the database.
-The default value is 'undefined', so no keepalive requests are made.
+You can configure an interval to make a dummy SQL request
+to keep alive the connections to the database.
+The default value is 'undefined', so no keepalive requests are made.
Specify in seconds: for example 28800 means 8 hours.
\begin{verbatim}
{odbc_keepalive_interval, undefined}.
@@ -1766,9 +1773,9 @@ Use this option to modify the value:
{odbc_pool_size, 10}.
\end{verbatim}
-You can configure an interval to make a dummy SQL request
-to keep alive the connections to the database.
-The default value is 'undefined', so no keepalive requests are made.
+You can configure an interval to make a dummy SQL request
+to keep alive the connections to the database.
+The default value is 'undefined', so no keepalive requests are made.
Specify in seconds: for example 28800 means 8 hours.
\begin{verbatim}
{odbc_keepalive_interval, undefined}.
@@ -1783,7 +1790,7 @@ PostgreSQL.
\begin{enumerate}
\item First, install the Erlang pgsql library from
- \footahref{http://www.ejabberd.im/ejabberd-modules/}{ejabberd-modules SVN repository}.
+ \footahref{http://www.ejabberd.im/ejabberd-modules/}{ejabberd-modules SVN repository}.
Make sure the compiled
files are in your Erlang path; you can put them for example in the same
directory as your \ejabberd{} .beam files.
@@ -1860,9 +1867,9 @@ Use this option to modify the value:
{odbc_pool_size, 10}.
\end{verbatim}
-You can configure an interval to make a dummy SQL request
-to keep alive the connections to the database.
-The default value is 'undefined', so no keepalive requests are made.
+You can configure an interval to make a dummy SQL request
+to keep alive the connections to the database.
+The default value is 'undefined', so no keepalive requests are made.
Specify in seconds: for example 28800 means 8 hours.
\begin{verbatim}
{odbc_keepalive_interval, undefined}.
@@ -1924,7 +1931,7 @@ server and use LDAP directory as vCard storage. Shared rosters are not supported
yet.
Note that \ejabberd{} treats LDAP as a read-only storage:
-it is possible to consult data, but not possible to
+it is possible to consult data, but not possible to
create accounts, change password or edit vCard that is stored in LDAP.
@@ -1935,10 +1942,10 @@ Parameters:
\titem{ldap\_servers} \ind{options!ldap\_server}List of IP addresses or DNS names of your
LDAP servers. This option is required.
\titem{ldap\_port} \ind{options!ldap\_port}Port to connect to your LDAP server.
- The initial default value is~389, so it is used when nothing is set into the
-configuration file.
-If you configure a value, it is stored in \ejabberd{}'s database.
-Then, if you remove that value from the configuration file,
+ The initial default value is~389, so it is used when nothing is set into the
+configuration file.
+If you configure a value, it is stored in \ejabberd{}'s database.
+Then, if you remove that value from the configuration file,
the value previously stored in the database will be used instead of the default 389.
\titem{ldap\_rootdn} \ind{options!ldap\_rootdn}Bind DN. The default value
is~\term{""} which means `anonymous connection'.
@@ -2181,38 +2188,38 @@ The following table lists all modules included in \ejabberd{}.
\begin{table}[H]
\centering
\begin{tabular}{|l|l|l|}
- \hline {\bf Module} & {\bf Feature} & {\bf Dependencies} \\
+ \hline {\bf Module} & {\bf Feature} & {\bf Dependencies} \\
\hline
- \hline \modadhoc{} & Ad-Hoc Commands (\xepref{0050}) & \\
- \hline \ahrefloc{modannounce}{\modannounce{}} & Manage announcements & recommends \modadhoc{} \\
- \hline \modcaps{} & Entity Capabilities (\xepref{0115}) & \\
- \hline \modconfigure{} & Server configuration using Ad-Hoc & \modadhoc{} \\
- \hline \ahrefloc{moddisco}{\moddisco{}} & Service Discovery (\xepref{0030}) & \\
- \hline \ahrefloc{modecho}{\modecho{}} & Echoes Jabber packets & \\
- \hline \ahrefloc{modirc}{\modirc{}} & IRC transport & \\
- \hline \ahrefloc{modlast}{\modlast{}} & Last Activity (\xepref{0012}) & \\
- \hline \ahrefloc{modlast}{\modlastodbc{}} & Last Activity (\xepref{0012}) & supported DB (*) \\
- \hline \ahrefloc{modmuc}{\modmuc{}} & Multi-User Chat (\xepref{0045}) & \\
- \hline \ahrefloc{modmuclog}{\modmuclog{}} & Multi-User Chat room logging & \modmuc{} \\
- \hline \ahrefloc{modoffline}{\modoffline{}} & Offline message storage (\xepref{0160}) & \\
- \hline \ahrefloc{modoffline}{\modofflineodbc{}} & Offline message storage (\xepref{0160}) & supported DB (*) \\
- \hline \ahrefloc{modprivacy}{\modprivacy{}} & Blocking Communication (XMPP IM) & \\
- \hline \ahrefloc{modprivacy}{\modprivacyodbc{}} & Blocking Communication (XMPP IM) & supported DB (*) \\
- \hline \ahrefloc{modprivate}{\modprivate{}} & Private XML Storage (\xepref{0049}) & \\
- \hline \ahrefloc{modprivate}{\modprivateodbc{}} & Private XML Storage (\xepref{0049}) & supported DB (*) \\
+ \hline \modadhoc{} & Ad-Hoc Commands (\xepref{0050}) & \\
+ \hline \ahrefloc{modannounce}{\modannounce{}} & Manage announcements & recommends \modadhoc{} \\
+ \hline \modcaps{} & Entity Capabilities (\xepref{0115}) & \\
+ \hline \modconfigure{} & Server configuration using Ad-Hoc & \modadhoc{} \\
+ \hline \ahrefloc{moddisco}{\moddisco{}} & Service Discovery (\xepref{0030}) & \\
+ \hline \ahrefloc{modecho}{\modecho{}} & Echoes Jabber packets & \\
+ \hline \ahrefloc{modirc}{\modirc{}} & IRC transport & \\
+ \hline \ahrefloc{modlast}{\modlast{}} & Last Activity (\xepref{0012}) & \\
+ \hline \ahrefloc{modlast}{\modlastodbc{}} & Last Activity (\xepref{0012}) & supported DB (*) \\
+ \hline \ahrefloc{modmuc}{\modmuc{}} & Multi-User Chat (\xepref{0045}) & \\
+ \hline \ahrefloc{modmuclog}{\modmuclog{}} & Multi-User Chat room logging & \modmuc{} \\
+ \hline \ahrefloc{modoffline}{\modoffline{}} & Offline message storage (\xepref{0160}) & \\
+ \hline \ahrefloc{modoffline}{\modofflineodbc{}} & Offline message storage (\xepref{0160}) & supported DB (*) \\
+ \hline \ahrefloc{modprivacy}{\modprivacy{}} & Blocking Communication (XMPP IM) & \\
+ \hline \ahrefloc{modprivacy}{\modprivacyodbc{}} & Blocking Communication (XMPP IM) & supported DB (*) \\
+ \hline \ahrefloc{modprivate}{\modprivate{}} & Private XML Storage (\xepref{0049}) & \\
+ \hline \ahrefloc{modprivate}{\modprivateodbc{}} & Private XML Storage (\xepref{0049}) & supported DB (*) \\
\hline \ahrefloc{modproxy}{\modproxy{}} & SOCKS5 Bytestreams (\xepref{0065}) & \\
- \hline \ahrefloc{modpubsub}{\modpubsub{}} & Pub-Sub (\xepref{0060}), PEP (\xepref{0163}) & \modcaps{} \\
- \hline \ahrefloc{modregister}{\modregister{}} & In-Band Registration (\xepref{0077}) & \\
- \hline \ahrefloc{modroster}{\modroster{}} & Roster management (XMPP IM) & \\
- \hline \ahrefloc{modroster}{\modrosterodbc{}} & Roster management (XMPP IM) & supported DB (*) \\
- \hline \ahrefloc{modservicelog}{\modservicelog{}} & Copy user messages to logger service & \\
- \hline \ahrefloc{modsharedroster}{\modsharedroster{}} & Shared roster management & \modroster{} or \\
- & & \modrosterodbc\\
- \hline \ahrefloc{modstats}{\modstats{}} & Statistics Gathering (\xepref{0039}) & \\
- \hline \ahrefloc{modtime}{\modtime{}} & Entity Time (\xepref{0090}) & \\
- \hline \ahrefloc{modvcard}{\modvcard{}} & vcard-temp (\xepref{0054}) & \\
- \hline \ahrefloc{modvcardldap}{\modvcardldap{}} & vcard-temp (\xepref{0054}) & LDAP server \\
- \hline \ahrefloc{modvcard}{\modvcardodbc{}} & vcard-temp (\xepref{0054}) & supported DB (*) \\
+ \hline \ahrefloc{modpubsub}{\modpubsub{}} & Pub-Sub (\xepref{0060}), PEP (\xepref{0163}) & \modcaps{} \\
+ \hline \ahrefloc{modregister}{\modregister{}} & In-Band Registration (\xepref{0077}) & \\
+ \hline \ahrefloc{modroster}{\modroster{}} & Roster management (XMPP IM) & \\
+ \hline \ahrefloc{modroster}{\modrosterodbc{}} & Roster management (XMPP IM) & supported DB (*) \\
+ \hline \ahrefloc{modservicelog}{\modservicelog{}} & Copy user messages to logger service & \\
+ \hline \ahrefloc{modsharedroster}{\modsharedroster{}} & Shared roster management & \modroster{} or \\
+ & & \modrosterodbc\\
+ \hline \ahrefloc{modstats}{\modstats{}} & Statistics Gathering (\xepref{0039}) & \\
+ \hline \ahrefloc{modtime}{\modtime{}} & Entity Time (\xepref{0090}) & \\
+ \hline \ahrefloc{modvcard}{\modvcard{}} & vcard-temp (\xepref{0054}) & \\
+ \hline \ahrefloc{modvcardldap}{\modvcardldap{}} & vcard-temp (\xepref{0054}) & LDAP server \\
+ \hline \ahrefloc{modvcard}{\modvcardodbc{}} & vcard-temp (\xepref{0054}) & supported DB (*) \\
\hline \ahrefloc{modversion}{\modversion{}} & Software Version (\xepref{0092}) & \\
\hline
\end{tabular}
@@ -2303,7 +2310,7 @@ This option defines the Jabber ID of a service provided by an \ejabberd{} module
The keyword "@HOST@" is replaced at start time with the real virtual host string.
This example configures
-the \ind{modules!\modecho{}}echo module to provide its echoing service
+the \ind{modules!\modecho{}}echo module to provide its echoing service
in the Jabber ID \jid{mirror.example.org}:
\begin{verbatim}
{modules,
@@ -2329,7 +2336,7 @@ the "@HOST@" keyword must be used:
\ind{modules!\modannounce{}}\ind{MOTD}\ind{message of the day}\ind{announcements}
This module enables configured users to broadcast announcements and to set
-the message of the day (MOTD).
+the message of the day (MOTD).
Configured users can perform these actions with a
\Jabber{} client either using Ad-hoc commands
or sending messages to specific JIDs.
@@ -2587,7 +2594,7 @@ Some of the features of Multi-User Chat:
The MUC service allows any Jabber ID to register a nickname,
so nobody else can use that nickname in any room in the MUC service.
-To register a nickname, open the Service Discovery in your
+To register a nickname, open the Service Discovery in your
Jabber client and register in the MUC service.
This module supports clustering and load
@@ -2665,7 +2672,7 @@ Module options:
discarded. A good value for this option is 4 seconds.
\titem{default\_room\_options} \ind{options!default\_room\_options}
This module option allows to define the desired default room options.
- Note that the creator of a room can modify the options of his room
+ Note that the creator of a room can modify the options of his room
at any time using a Jabber client with MUC capability.
The available room options and the default values are:
\begin{description}
@@ -2861,7 +2868,7 @@ Options:
To prevent spam, the \term{spam\_prevention} option adds a special attribute
to links that prevent their indexation by search engines. The default value
is \term{true}, which mean that nofollow attributes will be added to user
- submitted links.
+ submitted links.
\titem{timezone}\ind{options!timezone}
The time zone for the logs is configurable with this option. Allowed values
are \term{local} and \term{universal}. With the first value, the local time,
@@ -3078,7 +3085,7 @@ Options:
pubsub plugin is always used.
\titem{nodetree} To specify which nodetree to use. If not defined, the default pubsub
nodetree is used. Nodetrees are default and virtual. Only one nodetree can be used
- and is shared by all node plugins.
+ and is shared by all node plugins.
%\titem{served\_hosts} \ind{options!served\_hosts}
% This option allows to create additional pubsub virtual hosts in a single module instance.
\end{description}
@@ -3116,10 +3123,10 @@ Options:
user name, registration for that user name is denied. (there are no
restrictions by default).
\titem{welcome\_message} \ind{options!welcomem}Set a welcome message that
- is sent to each newly registered account. The first string is the subject, and
+ is sent to each newly registered account. The first string is the subject, and
the second string is the message body.
In the body you can set a newline with the characters: \verb|\n|
-\titem{registration\_watchers} \ind{options!rwatchers}This option defines a
+\titem{registration\_watchers} \ind{options!rwatchers}This option defines a
list of JIDs which will be notified each time a new account is registered.
\iqdiscitem{In-Band Registration (\ns{jabber:iq:register})}
\end{description}
@@ -3223,7 +3230,7 @@ Examples:
]}.
\end{verbatim}
\item To log all end user packets to the Bandersnatch service running on
- \jid{bandersnatch.example.com} and the backup service on
+ \jid{bandersnatch.example.com} and the backup service on
\jid{bandersnatch.example.org}:
\begin{verbatim}
{modules,
@@ -3243,9 +3250,9 @@ This module enables you to create shared roster groups. This means that you can
create groups of people that can see members from (other) groups in their
rosters. The big advantages of this feature are that end users do not need to
manually add all users to their rosters, and that they cannot permanently delete
-users from the shared roster groups.
+users from the shared roster groups.
A shared roster group can have members from any Jabber server,
-but the presence will only be available from and to members
+but the presence will only be available from and to members
of the same virtual host where the group is created.
Shared roster groups can be edited \emph{only} via the Web Admin. Each group
@@ -3467,7 +3474,7 @@ implemented in the \modvcardldap{} module. This module does not depend on the
authentication method (see~\ref{ldapauth}).
Note that \ejabberd{} treats LDAP as a read-only storage:
-it is possible to consult data, but not possible to
+it is possible to consult data, but not possible to
create accounts, change password or edit vCard that is stored in LDAP.
The \modvcardldap{} module has
@@ -3571,7 +3578,7 @@ consists of the following \modvcardldap{}-specific options:
%TODO: this examples still should be organised better
Examples:
\begin{itemize}
-\item
+\item
Let's say \term{ldap.example.org} is the name of our LDAP server. We have
users with their passwords in \term{"ou=Users,dc=example,dc=org"} directory.
@@ -3689,11 +3696,11 @@ Options:
\makesubsection{commands}{Commands}
-The \term{ejabberdctl} command line administration script allows to start, stop and perform
+The \term{ejabberdctl} command line administration script allows to start, stop and perform
many other administrative tasks in a local or remote \ejabberd{} server.
When \term{ejabberdctl} is executed without any parameter,
-it displays the available options. If there isn't an \ejabberd{} server running,
+it displays the available options. If there isn't an \ejabberd{} server running,
the available parameters are:
\begin{description}
\titem{start} Start \ejabberd{} in background mode. This is the default method.
@@ -3710,7 +3717,7 @@ The more interesting ones are:
\titem{reopen-log} If you use a tool to rotate logs, you have to configure it
so that this command is executed after each rotation.
\titem {backup, restore, install-fallback, dump, load} You can use these
- commands to create and restore backups.
+ commands to create and restore backups.
%%More information about backuping can
%% be found in section~\ref{backup}.
\titem{import-file, import-dir} \ind{migration from other software}
@@ -3741,70 +3748,70 @@ for example using: \term{echo \$?}
\ejabberd{} is an Erlang/OTP application that runs inside an Erlang runtime system.
This system is configured using environment variables and command line parameters.
The \term{ejabberdctl} administration script uses many of those possibilities.
-You can configure some of them with the file \term{ejabberdctl.cfg},
+You can configure some of them with the file \term{ejabberdctl.cfg},
which includes detailed description about them.
-This section describes for reference purposes
+This section describes for reference purposes
all the environment variables and command line parameters.
The environment variables:
\begin{description}
- \titem{EJABBERD\_CONFIG\_PATH}
+ \titem{EJABBERD\_CONFIG\_PATH}
Path to the ejabberd configuration file.
- \titem{EJABBERD\_MSGS\_PATH}
+ \titem{EJABBERD\_MSGS\_PATH}
Path to the directory with translated strings.
- \titem{EJABBERD\_LOG\_PATH}
+ \titem{EJABBERD\_LOG\_PATH}
Path to the ejabberd service log file.
- \titem{EJABBERD\_SO\_PATH}
+ \titem{EJABBERD\_SO\_PATH}
Path to the directory with binary system libraries.
- \titem{HOME}
+ \titem{HOME}
Path to the directory that is considered \ejabberd{}'s home.
This path is used to read the file \term{.erlang.cookie}.
- \titem{ERL\_CRASH\_DUMP}
+ \titem{ERL\_CRASH\_DUMP}
Path to the file where crash reports will be dumped.
- \titem{ERL\_INETRC}
+ \titem{ERL\_INETRC}
Indicates which IP name resolution to use.
If using \term{-sname}, specify either this option or \term{-kernel inetrc filepath}.
- \titem{ERL\_MAX\_PORTS}
+ \titem{ERL\_MAX\_PORTS}
Maximum number of simultaneously open Erlang ports.
- \titem{ERL\_MAX\_ETS\_TABLES}
+ \titem{ERL\_MAX\_ETS\_TABLES}
Maximum number of ETS and Mnesia tables.
\end{description}
The command line parameters:
\begin{description}
- \titem{-sname ejabberd}
+ \titem{-sname ejabberd}
The Erlang node will be identified using only the first part
of the host name, i.\,e. other Erlang nodes outside this domain cannot contact
this node. This is the preferable option in most cases.
- \titem{-name ejabberd}
+ \titem{-name ejabberd}
The Erlang node will be fully identified.
This is only useful if you plan to setup an \ejabberd{} cluster with nodes in different networks.
- \titem{-kernel inetrc "/etc/ejabberd/inetrc"}
- Indicates which IP name resolution to use.
+ \titem{-kernel inetrc "/etc/ejabberd/inetrc"}
+ Indicates which IP name resolution to use.
If using \term{-sname}, specify either this option or \term{ERL\_INETRC}.
- \titem{-kernel inet\_dist\_listen\_min 4200 inet\_dist\_listen\_min 4210}
+ \titem{-kernel inet\_dist\_listen\_min 4200 inet\_dist\_listen\_min 4210}
Define the first and last ports that \term{epmd} (section \ref{epmd}) can listen to.
- \titem{-detached}
- Starts the Erlang system detached from the system console.
- Useful for running daemons and backgrounds processes.
- \titem{-noinput}
+ \titem{-detached}
+ Starts the Erlang system detached from the system console.
+ Useful for running daemons and backgrounds processes.
+ \titem{-noinput}
Ensures that the Erlang system never tries to read any input.
- Useful for running daemons and backgrounds processes.
- \titem{-pa /var/lib/ejabberd/ebin}
+ Useful for running daemons and backgrounds processes.
+ \titem{-pa /var/lib/ejabberd/ebin}
Specify the directory where Erlang binary files (*.beam) are located.
- \titem{-s ejabberd}
+ \titem{-s ejabberd}
Tell Erlang runtime system to start the \ejabberd{} application.
\titem{-mnesia dir "/var/lib/ejabberd/"}
Specify the Mnesia database directory.
\titem{-sasl sasl\_error\_logger \{file, "/var/log/ejabberd/sasl.log"\}}
Path to the Erlang/OTP system log file.
- \titem{+K [true|false]}
+ \titem{+K [true|false]}
Kernel polling.
- \titem{-smp [auto|enable|disable]}
+ \titem{-smp [auto|enable|disable]}
SMP support.
- \titem{+P 250000}
+ \titem{+P 250000}
Maximum number of Erlang processes.
- \titem{-remsh ejabberd@localhost}
+ \titem{-remsh ejabberd@localhost}
Open an Erlang shell in a remote Erlang node.
\end{description}
Note that some characters need to be escaped when used in shell scripts, for instance \verb|"| and \verb|{}|.
@@ -3818,7 +3825,7 @@ The \ejabberd{} Web Admin allows to administer most of \ejabberd{} using a web b
This feature is enabled by default:
a \term{ejabberd\_http} listener with the option \term{web\_admin} (see
-section~\ref{listened}) is included in the listening ports. Then you can open
+section~\ref{listened}) is included in the listening ports. Then you can open
\verb|http://server:port/admin/| in your favourite web browser. You
will be asked to enter the username (the \emph{full} \Jabber{} ID) and password
of an \ejabberd{} user with administrator rights. After authentication
@@ -3894,7 +3901,7 @@ an account with proper privileges.
\makesection{changeerlangnodename}{Change Computer Hostname}
-\ejabberd{} uses the distributed Mnesia database.
+\ejabberd{} uses the distributed Mnesia database.
Being distributed, Mnesia enforces consistency of its file,
so it stores the name of the Erlang node in it (see section \ref{nodename}).
The name of an Erlang node includes the hostname of the computer.
@@ -3906,7 +3913,7 @@ So, if you want to change the computer hostname where \ejabberd{} is installed,
you must follow these instructions:
\begin{enumerate}
\item In the old server, backup the Mnesia database using the Web Admin or \term{ejabberdctl}.
- For example:
+ For example:
\begin{verbatim}
ejabberdctl backup /tmp/ejabberd-oldhost.backup
\end{verbatim}
@@ -3940,15 +3947,15 @@ You need to take the following TCP ports in mind when configuring your firewall:
\makesection{epmd}{epmd}
\footahref{http://www.erlang.org/doc/man/epmd.html}{epmd (Erlang Port Mapper Daemon)}
-is a small name server included in Erlang/OTP
-and used by Erlang programs when establishing distributed Erlang communications.
-\ejabberd{} needs \term{epmd} to use \term{ejabberdctl} and also when clustering \ejabberd{} nodes.
+is a small name server included in Erlang/OTP
+and used by Erlang programs when establishing distributed Erlang communications.
+\ejabberd{} needs \term{epmd} to use \term{ejabberdctl} and also when clustering \ejabberd{} nodes.
This small program is automatically started by Erlang, and is never stopped.
-If \ejabberd{} is stopped, and there aren't any other Erlang programs
+If \ejabberd{} is stopped, and there aren't any other Erlang programs
running in the system, you can safely stop \term{epmd} if you want.
-\ejabberd{} runs inside an Erlang node.
-To communicate with \ejabberd{}, the script \term{ejabberdctl} starts a new Erlang node
+\ejabberd{} runs inside an Erlang node.
+To communicate with \ejabberd{}, the script \term{ejabberdctl} starts a new Erlang node
and connects to the Erlang node that holds \ejabberd{}.
In order for this communication to work,
\term{epmd} must be running and listening for name requests in the port 4369.
@@ -3965,7 +3972,7 @@ Remember to block the port so Internet doesn't have access to it.
Once an Erlang node solved the node name of another Erlang node using EPMD and port 4369,
the nodes communicate directly.
-The ports used in this case by default are random,
+The ports used in this case by default are random,
but can be configured in the file \term{ejabberdctl.cfg}.
The Erlang command-line parameter used internally is, for example:
\begin{verbatim}
@@ -3975,12 +3982,12 @@ erl ... -kernel inet_dist_listen_min 4370 inet_dist_listen_max 4375
\makesection{cookie}{Erlang Cookie}
-The Erlang cookie is a string with numbers and letters.
+The Erlang cookie is a string with numbers and letters.
An Erlang node reads the cookie at startup from the command-line parameter \term{-setcookie}.
If not indicated, the cookie is read from the cookie file \term{\$HOME/.erlang.cookie}.
If this file does not exist, it is created immediately with a random cookie.
Two Erlang nodes communicate only if they have the same cookie.
-Setting a cookie on the Erlang node allows you to structure your Erlang network
+Setting a cookie on the Erlang node allows you to structure your Erlang network
and define which nodes are allowed to connect to which.
Thanks to Erlang cookies, you can prevent access to the Erlang node by mistake,
@@ -3988,7 +3995,7 @@ for example when there are several Erlang nodes running different programs in th
Setting a secret cookie is a simple method
to difficult unauthorized access to your Erlang node.
-However, the cookie system is not ultimately effective
+However, the cookie system is not ultimately effective
to prevent unauthorized access or intrusion to an Erlang node.
The communication between Erlang nodes are not encrypted,
so the cookie could be read sniffing the traffic on the network.
@@ -3998,14 +4005,14 @@ The recommended way to secure the Erlang node is to block the port 4369.
\makesection{nodename}{Erlang node name}
An Erlang node may have a node name.
-The name can be short (if indicated with the command-line parameter \term{-sname})
-or long (if indicated with the parameter \term{-name}).
+The name can be short (if indicated with the command-line parameter \term{-sname})
+or long (if indicated with the parameter \term{-name}).
Starting an Erlang node with -sname limits the communication between Erlang nodes to the LAN.
-Using the option \term{-sname} instead of \term{-name} is a simple method
+Using the option \term{-sname} instead of \term{-name} is a simple method
to difficult unauthorized access to your Erlang node.
However, it is not ultimately effective to prevent access to the Erlang node,
-because it may be possible to fake the fact that you are on another network
+because it may be possible to fake the fact that you are on another network
using a modified version of Erlang \term{epmd}.
The recommended way to secure the Erlang node is to block the port 4369.
@@ -4194,7 +4201,7 @@ The default distribution algorithm try to deliver to a local instance of a compo
If you need a different behaviour, you can change the load balancing behaviour with the option \option{domain\_balancing}. The syntax of the option is the following:
\begin{verbatim}
-{domain_balancing, "component.example.com", }.
+{domain_balancing, "component.example.com", }.
\end{verbatim}
Several balancing criteria are available:
@@ -4281,7 +4288,7 @@ With this Erlang shell, an experienced administrator can perform complex tasks.
This shell gives complete control over the \ejabberd{} server,
so it is important to use it with extremely care.
-There are some simple and safe examples in the article
+There are some simple and safe examples in the article
\footahref{http://www.ejabberd.im/interconnect-erl-nodes}{Interconnecting Erlang Nodes}
To exit the shell, close the window or press the keys: control+c control+c.
@@ -4293,8 +4300,8 @@ To exit the shell, close the window or press the keys: control+c control+c.
\ind{xml:lang}\ind{internationalization}\ind{localization}\ind{i18n}\ind{l10n}
The source code of \ejabberd{} supports localization.
-The translators can edit the
-\footahref{http://www.gnu.org/software/gettext/}{gettext} .po files
+The translators can edit the
+\footahref{http://www.gnu.org/software/gettext/}{gettext} .po files
using any capable program (KBabel, Lokalize, Poedit...) or a simple text editor.
Then gettext
@@ -4327,7 +4334,7 @@ The Web Admin also supports the \verb|Accept-Language| HTTP header.
\begin{figure}[htbp]
\centering
\insimg{webadmmainru.png}
- \caption{Web Admin showing a virtual host when the web browser provides the
+ \caption{Web Admin showing a virtual host when the web browser provides the
HTTP header `Accept-Language: ru'}
\label{fig:webadmmainru}
\end{figure}
@@ -4382,7 +4389,7 @@ Street, Fifth Floor, Boston, MA 02110-1301, USA.
%\ind{glossary}
%\begin{description}
-%\titem{c2s}
+%\titem{c2s}
%\titem{s2s}
%\titem{STARTTLS}
%\titem{XEP} (\XMPP{} Extension Protocol)
diff --git a/src/ejabberd_rdbms.erl b/src/ejabberd_rdbms.erl
index 0eff6c3ca..fcbe16cbb 100644
--- a/src/ejabberd_rdbms.erl
+++ b/src/ejabberd_rdbms.erl
@@ -16,7 +16,7 @@
%%% 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
@@ -52,14 +52,21 @@ start_hosts() ->
%% Start the ODBC module on the given host
start_odbc(Host) ->
+ Supervisor_name = gen_mod:get_module_proc(Host, ejabberd_odbc_sup),
ChildSpec =
- {gen_mod:get_module_proc(Host, ejabberd_odbc_sup),
+ {Supervisor_name,
{ejabberd_odbc_sup, start_link, [Host]},
- temporary,
+ transient,
infinity,
supervisor,
[ejabberd_odbc_sup]},
- supervisor:start_child(ejabberd_sup, ChildSpec).
+ case supervisor:start_child(ejabberd_sup, ChildSpec) of
+ {ok, _PID} ->
+ ok;
+ _Error ->
+ ?ERROR_MSG("Start of supervisor ~p failed:~n~p~nRetrying...~n", [Supervisor_name, _Error]),
+ start_odbc(Host)
+ end.
%% Returns true if we have configured odbc_server for the given host
needs_odbc(Host) ->
diff --git a/src/ejabberd_zlib/Makefile.win32 b/src/ejabberd_zlib/Makefile.win32
index bd9c9d561..c13383fa8 100644
--- a/src/ejabberd_zlib/Makefile.win32
+++ b/src/ejabberd_zlib/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\ejabberd_zlib.beam
SOURCE = ejabberd_zlib_drv.c
OBJECT = ejabberd_zlib_drv.o
diff --git a/src/eldap/Makefile.win32 b/src/eldap/Makefile.win32
index b5bdbcf14..9733055f9 100644
--- a/src/eldap/Makefile.win32
+++ b/src/eldap/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\eldap.beam ..\eldap_filter.beam ..\eldap_pool.beam ..\eldap_utils.beam
ALL : $(BEAMS)
diff --git a/src/mod_configure.erl b/src/mod_configure.erl
index b1cb0cced..47c6e1336 100644
--- a/src/mod_configure.erl
+++ b/src/mod_configure.erl
@@ -1240,7 +1240,7 @@ get_form(Host, ?NS_ADMINL("get-registered-users-num"), Lang) ->
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
[?HFIELD(),
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
- [#xmlattr{name = 'type', value = "jid-single"},
+ [#xmlattr{name = 'type', value = "text-single"},
#xmlattr{name = 'label', value = ?T(Lang, "Number of registered users")},
#xmlattr{name = 'var', value = "registeredusersnum"}], children =
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
@@ -1252,7 +1252,7 @@ get_form(Host, ?NS_ADMINL("get-online-users-num"), Lang) ->
[#xmlel{ns = ?NS_DATA_FORMS, name = 'x', children =
[?HFIELD(),
#xmlel{ns = ?NS_DATA_FORMS, name = 'field', attrs =
- [#xmlattr{name = 'type', value = "jid-single"},
+ [#xmlattr{name = 'type', value = "text-single"},
#xmlattr{name = 'label', value = ?T(Lang, "Number of online users")},
#xmlattr{name = 'var', value = "onlineusersnum"}], children =
[#xmlel{ns = ?NS_DATA_FORMS, name = 'value', children = [#xmlcdata{cdata = list_to_binary(Num)}]}]
diff --git a/src/mod_irc/Makefile.win32 b/src/mod_irc/Makefile.win32
index 28fc15e9c..9c22f43f1 100644
--- a/src/mod_irc/Makefile.win32
+++ b/src/mod_irc/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\iconv.beam ..\mod_irc.beam ..\mod_irc_connection.beam
SOURCE = iconv_erl.c
OBJECT = iconv_erl.o
diff --git a/src/mod_muc/Makefile.win32 b/src/mod_muc/Makefile.win32
index e53f9b7f5..5107b1069 100644
--- a/src/mod_muc/Makefile.win32
+++ b/src/mod_muc/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\mod_muc.beam ..\mod_muc_log.beam ..\mod_muc_room.beam
ALL : $(BEAMS)
diff --git a/src/mod_proxy65/Makefile.win32 b/src/mod_proxy65/Makefile.win32
index 718dd0c70..7683097d3 100644
--- a/src/mod_proxy65/Makefile.win32
+++ b/src/mod_proxy65/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\mod_proxy65.beam ..\mod_proxy65_lib.beam ..\mod_proxy65_service.beam ..\mod_proxy65_sm.beam ..\mod_proxy65_stream.beam
ALL : $(BEAMS)
@@ -19,7 +18,7 @@ $(OUTDIR)\mod_proxy65_service.beam : mod_proxy65_service.erl
erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_service.erl
$(OUTDIR)\mod_proxy65_sm.beam : mod_proxy65_sm.erl
- erlc -W $(EFLAGS) -o $(OUTDIR) mod_mod_proxy65_sm.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_sm.erl
$(OUTDIR)\mod_proxy65_stream.beam : mod_proxy65_stream.erl
erlc -W $(EFLAGS) -o $(OUTDIR) mod_proxy65_stream.erl
diff --git a/src/mod_pubsub/Makefile.win32 b/src/mod_pubsub/Makefile.win32
index f68375ccd..f981329c9 100644
--- a/src/mod_pubsub/Makefile.win32
+++ b/src/mod_pubsub/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\gen_pubsub_node.beam ..\gen_pubsub_nodetree.beam ..\mod_pubsub.beam ..\nodetree_default.beam ..\nodetree_virtual.beam ..\node_buddy.beam ..\node_club.beam ..\node_default.beam ..\node_dispatch.beam ..\node_pep.beam ..\node_private.beam ..\node_public.beam
ALL : $(BEAMS)
@@ -27,9 +26,23 @@ $(OUTDIR)\nodetree_default.beam : nodetree_default.erl
$(OUTDIR)\nodetree_virtual.beam : nodetree_virtual.erl
erlc -W $(EFLAGS) -o $(OUTDIR) nodetree_virtual.erl
+$(OUTDIR)\node_buddy.beam : node_buddy.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) node_buddy.erl
+
+$(OUTDIR)\node_club.beam : node_club.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) node_club.erl
+
$(OUTDIR)\node_default.beam : node_default.erl
erlc -W $(EFLAGS) -o $(OUTDIR) node_default.erl
+$(OUTDIR)\node_dispatch.beam : node_dispatch.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) node_dispatch.erl
+
$(OUTDIR)\node_pep.beam : node_pep.erl
erlc -W $(EFLAGS) -o $(OUTDIR) node_pep.erl
+$(OUTDIR)\node_private.beam : node_private.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) node_private.erl
+
+$(OUTDIR)\node_public.beam : node_public.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) node_public.erl
diff --git a/src/mod_pubsub/gen_pubsub_node.erl b/src/mod_pubsub/gen_pubsub_node.erl
index a193a51cc..f3fc16ff8 100644
--- a/src/mod_pubsub/gen_pubsub_node.erl
+++ b/src/mod_pubsub/gen_pubsub_node.erl
@@ -63,7 +63,7 @@ behaviour_info(callbacks) ->
{get_state, 3},
{set_state, 1},
{get_items, 7},
- {get_items, 2},
+ {get_items, 3},
{get_item, 8},
{get_item, 3},
{set_item, 1},
diff --git a/src/mod_pubsub/mod_pubsub.erl b/src/mod_pubsub/mod_pubsub.erl
index dd86b91bb..a7084fad6 100644
--- a/src/mod_pubsub/mod_pubsub.erl
+++ b/src/mod_pubsub/mod_pubsub.erl
@@ -77,7 +77,8 @@
delete_item/4,
get_configure/4,
set_configure/5,
- get_items/2,
+ get_items/3,
+ tree_action/3,
node_action/3,
node_action/4
]).
@@ -114,6 +115,7 @@
-record(state, {server_host,
host,
access,
+ pep_mapping = [],
nodetree = ?STDTREE,
plugins = [?STDNODE]}).
@@ -175,7 +177,7 @@ init([ServerHost, Opts]) ->
{?NS_PUBSUB, ejabberd_sm, iq_sm},
{?NS_PUBSUB_OWNER, ejabberd_sm, iq_sm}]),
ejabberd_router:register_route(Host),
- {Plugins, NodeTree} = init_plugins(Host, ServerHost, Opts),
+ {Plugins, NodeTree, PepMapping} = init_plugins(Host, ServerHost, Opts),
update_database(Host),
ets:new(gen_mod:get_module_proc(Host, pubsub_state), [set, named_table]),
ets:insert(gen_mod:get_module_proc(Host, pubsub_state), {nodetree, NodeTree}),
@@ -183,10 +185,12 @@ init([ServerHost, Opts]) ->
ets:new(gen_mod:get_module_proc(ServerHost, pubsub_state), [set, named_table]),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {nodetree, NodeTree}),
ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {plugins, Plugins}),
+ ets:insert(gen_mod:get_module_proc(ServerHost, pubsub_state), {pep_mapping, PepMapping}),
init_nodes(Host, ServerHost),
{ok, #state{host = Host,
server_host = ServerHost,
access = Access,
+ pep_mapping = PepMapping,
nodetree = NodeTree,
plugins = Plugins}}.
@@ -209,12 +213,14 @@ init_plugins(Host, ServerHost, Opts) ->
?DEBUG("** tree plugin is ~p",[TreePlugin]),
TreePlugin:init(Host, ServerHost, Opts),
Plugins = lists:usort(gen_mod:get_opt(plugins, Opts, []) ++ [?STDNODE]),
+ PepMapping = lists:usort(gen_mod:get_opt(pep_mapping, Opts, [])),
+ ?DEBUG("** PEP Mapping : ~p~n",[PepMapping]),
lists:foreach(fun(Name) ->
?DEBUG("** init ~s plugin",[Name]),
Plugin = list_to_atom(?PLUGIN_PREFIX ++ Name),
Plugin:init(Host, ServerHost, Opts)
end, Plugins),
- {Plugins, TreePlugin}.
+ {Plugins, TreePlugin, PepMapping}.
terminate_plugins(Host, ServerHost, Plugins, TreePlugin) ->
lists:foreach(fun(Name) ->
@@ -371,11 +377,11 @@ disco_sm_items(Acc, _From, To, [], _Lang) ->
{result, NodeItems ++ Items}
end;
-disco_sm_items(Acc, _From, To, Node, _Lang) ->
+disco_sm_items(Acc, From, To, Node, _Lang) ->
%% TODO, use iq_disco_items(Host, Node, From)
Host = To#jid.lserver,
LJID = jlib:jid_tolower(jlib:jid_remove_resource(To)),
- case get_items(Host, Node) of
+ case get_items(Host, Node, From) of
[] ->
Acc;
AllItems ->
@@ -430,6 +436,8 @@ handle_call(server_host, _From, State) ->
{reply, State#state.server_host, State};
handle_call(plugins, _From, State) ->
{reply, State#state.plugins, State};
+handle_call(pep_mapping, _From, State) ->
+ {reply, State#state.pep_mapping, State};
handle_call(nodetree, _From, State) ->
{reply, State#state.nodetree, State};
handle_call(stop, _From, State) ->
@@ -717,7 +725,7 @@ node_disco_info(Host, Node, From, Identity, Features) ->
[] ->
["leaf"]; %% No sub-nodes: it's a leaf node
_ ->
- case node_call(Type, get_items, [Host, Node]) of
+ case node_call(Type, get_items, [Host, Node, From]) of
{result, []} -> ["collection"];
{result, _} -> ["leaf", "collection"];
_ -> []
@@ -782,7 +790,7 @@ iq_disco_items(Host, Item, From) ->
%% TODO That is, remove name attribute
Action =
fun(#pubsub_node{type = Type}) ->
- NodeItems = case node_call(Type, get_items, [Host, Node]) of
+ NodeItems = case node_call(Type, get_items, [Host, Node, From]) of
{result, I} -> I;
_ -> []
end,
@@ -1183,10 +1191,7 @@ create_node(Host, ServerHost, [], Owner, Type, Access, Configuration) ->
{error, extended_error(?ERR_NOT_ACCEPTABLE, "nodeid-required")}
end;
create_node(Host, ServerHost, Node, Owner, GivenType, Access, Configuration) ->
- Type = case Host of
- {_User, _Server, _Resource} -> ?PEPNODE;
- _ -> GivenType
- end,
+ Type = select_type(ServerHost, Host, Node, GivenType),
Parent = lists:sublist(Node, length(Node) - 1),
%% TODO, check/set node_type = Type
ParseOptions = case xml:remove_cdata(Configuration) of
@@ -1488,12 +1493,7 @@ publish_item(Host, ServerHost, Node, Publisher, ItemId, Payload) ->
%% handles auto-create feature
%% for automatic node creation. we'll take the default node type:
%% first listed into the plugins configuration option, or pep
- Type = case Host of
- {_User, _Server, _Resource} ->
- ?PEPNODE;
- _ ->
- hd(plugins(ServerHost))
- end,
+ Type = select_type(ServerHost, Host, Node),
case lists:member("auto-create", features(Type)) of
true ->
case create_node(Host, ServerHost, Node, Publisher, Type) of
@@ -1712,8 +1712,8 @@ get_items(Host, Node, From, SubId, SMaxItems, ItemIDs) ->
end
end.
-get_items(Host, Node) ->
- case node_action(Host, Node, get_items, [Host, Node]) of
+get_items(Host, Node, From) ->
+ case node_action(Host, Node, get_items, [Host, Node, From]) of
{result, Items} -> Items;
_ -> []
end.
@@ -1723,15 +1723,15 @@ get_items(Host, Node) ->
%% Node = pubsubNode()
%% LJID = {U, S, []}
%% @doc Resend the items of a node to the user.
-send_all_items(Host, Node, LJID) ->
- send_items(Host, Node, LJID, all).
+%send_all_items(Host, Node, LJID) ->
+% send_items(Host, Node, LJID, all).
send_last_item(Host, Node, LJID) ->
send_items(Host, Node, LJID, last).
%% TODO use cache-last-item feature
send_items(Host, Node, LJID, Number) ->
- ToSend = case get_items(Host, Node) of
+ ToSend = case get_items(Host, Node, LJID) of
[] ->
[];
Items ->
@@ -2411,11 +2411,8 @@ get_configure(Host, Node, From, Lang) ->
end,
transaction(Host, Node, Action, sync_dirty).
-get_default(Host, _Node, _From, Lang) ->
- Type = case Host of
- {_, _, _} -> ?PEPNODE;
- _ -> hd(plugins(Host))
- end,
+get_default(Host, Node, _From, Lang) ->
+ Type=select_type(Host, Host, Node),
Options = node_options(Type),
{result, [{xmlelement, "pubsub", [{"xmlns", ?NS_PUBSUB_OWNER}],
[{xmlelement, "default", [],
@@ -2663,6 +2660,19 @@ plugins(Host) ->
[{plugins, PL}] -> PL;
_ -> [?STDNODE]
end.
+select_type(ServerHost, Host, Node, Type)->
+ ?DEBUG("SELECT_TYPE : ~p~n", [Node]),
+ case Host of
+ {_User, _Server, _Resource} ->
+ case ets:lookup(gen_mod:get_module_proc(ServerHost, pubsub_state), pep_mapping) of
+ [{pep_mapping, PM}] -> ?DEBUG("SELECT_TYPE : ~p~n", [PM]), proplists:get_value(Node, PM,?PEPNODE);
+ R -> ?DEBUG("SELECT_TYPE why ?: ~p~n", [R]), ?PEPNODE
+ end;
+ _ ->
+ Type
+ end.
+select_type(ServerHost, Host, Node) ->
+ select_type(ServerHost, Host, Node,hd(plugins(ServerHost))).
features() ->
[
@@ -2811,3 +2821,4 @@ uniqid() ->
get_item_name(Host, Node, Id) ->
{result, Name} = node_action(Host, Node, get_item_name, [Host, Node, Id]),
Name.
+
diff --git a/src/mod_pubsub/node.template b/src/mod_pubsub/node.template
index 9c2344ae1..b98322d0d 100644
--- a/src/mod_pubsub/node.template
+++ b/src/mod_pubsub/node.template
@@ -62,7 +62,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1
@@ -168,8 +168,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId)
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_buddy.erl b/src/mod_pubsub/node_buddy.erl
index 8bca962d3..6cdd6118b 100644
--- a/src/mod_pubsub/node_buddy.erl
+++ b/src/mod_pubsub/node_buddy.erl
@@ -63,7 +63,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -171,8 +171,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_club.erl b/src/mod_pubsub/node_club.erl
index 978f6f39d..ae8ab9cf1 100644
--- a/src/mod_pubsub/node_club.erl
+++ b/src/mod_pubsub/node_club.erl
@@ -63,7 +63,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -170,8 +170,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_default.erl b/src/mod_pubsub/node_default.erl
index ddda469c6..9b30269e0 100644
--- a/src/mod_pubsub/node_default.erl
+++ b/src/mod_pubsub/node_default.erl
@@ -70,7 +70,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -705,9 +705,9 @@ set_state(_) ->
%% relational database), or they can even decide not to persist any items.
%% If a PubSub plugin wants to delegate the item storage to the default node,
%% they can implement this function like this:
-%% ```get_items(Host, Node) ->
-%% node_default:get_items(Host, Node).'''
-get_items(Host, Node) ->
+%% ```get_items(Host, Node, From) ->
+%% node_default:get_items(Host, Node, From).'''
+get_items(Host, Node, _From) ->
Items = mnesia:match_object(
#pubsub_item{itemid = {'_', {Host, Node}}, _ = '_'}),
{result, Items}.
@@ -747,7 +747,7 @@ get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, _SubI
%% % Payment is required for a subscription
%% {error, ?ERR_PAYMENT_REQUIRED};
true ->
- get_items(Host, Node)
+ get_items(Host, Node, JID)
end.
%% @spec (Host, Node, ItemId) -> [Item] | []
diff --git a/src/mod_pubsub/node_dispatch.erl b/src/mod_pubsub/node_dispatch.erl
index 0d9e1dcd9..98a396cbf 100644
--- a/src/mod_pubsub/node_dispatch.erl
+++ b/src/mod_pubsub/node_dispatch.erl
@@ -61,7 +61,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -173,8 +173,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_mb.erl b/src/mod_pubsub/node_mb.erl
new file mode 100644
index 000000000..f2498071c
--- /dev/null
+++ b/src/mod_pubsub/node_mb.erl
@@ -0,0 +1,197 @@
+%%% ====================================================================
+%%% ``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 ProcessOne.
+%%% Portions created by ProcessOne are Copyright 2006-2008, ProcessOne
+%%% All Rights Reserved.''
+%%% This software is copyright 2006-2008, ProcessOne.
+%%%
+%%%
+%%% @copyright 2006-2008 ProcessOne
+%%% @author Eric Cestari
+%%% @version {@vsn}, {@date} {@time}
+%%% @end
+%%% ====================================================================
+
+
+%%% @doc The module {@module} is the pep microblog PubSub plugin.
+%%% To be used, mod_pubsub must be configured :
+%%% {mod_pubsub, [ % requires mod_caps
+%%% {access_createnode, pubsub_createnode},
+%%% {plugins, ["default", "pep","mb"]},
+%%% {pep_mapping, [{"urn:xmpp:microblog", "mb"}]}
+%%% ]},
+%%% PubSub plugin nodes are using the {@link gen_pubsub_node} behaviour.
+
+-module(node_mb).
+-author('eric@ohmforce.com').
+
+-include("ejabberd.hrl").
+-include("pubsub.hrl").
+-include("jlib.hrl").
+
+-behaviour(gen_pubsub_node).
+
+%% API definition
+-export([init/3, terminate/2,
+ options/0, features/0,
+ create_node_permission/6,
+ create_node/3,
+ delete_node/2,
+ purge_node/3,
+ subscribe_node/8,
+ unsubscribe_node/5,
+ publish_item/7,
+ delete_item/4,
+ remove_extra_items/4,
+ get_entity_affiliations/2,
+ get_node_affiliations/2,
+ get_affiliation/3,
+ set_affiliation/4,
+ get_entity_subscriptions/2,
+ get_node_subscriptions/2,
+ get_subscription/3,
+ set_subscription/4,
+ get_states/2,
+ get_state/3,
+ set_state/1,
+ get_items/7,
+ get_items/3,
+ get_item/8,
+ get_item/3,
+ set_item/1,
+ get_item_name/3
+ ]).
+
+init(Host, ServerHost, Opts) ->
+ node_pep:init(Host, ServerHost, Opts).
+
+terminate(Host, ServerHost) ->
+ node_pep:terminate(Host, ServerHost),
+ ok.
+
+options() ->
+ [{node_type, pep},
+ {deliver_payloads, true},
+ {notify_config, false},
+ {notify_delete, false},
+ {notify_retract, false},
+ {persist_items, true},
+ {max_items, ?MAXITEMS},
+ {subscribe, true},
+ {access_model, presence},
+ {roster_groups_allowed, []},
+ {publish_model, publishers},
+ {max_payload_size, ?MAX_PAYLOAD_SIZE},
+ {send_last_published_item, on_sub_and_presence},
+ {deliver_notifications, true},
+ {presence_based_delivery, true}].
+
+features() ->
+ ["create-nodes", %*
+ "auto-create", %*
+ "auto-subscribe", %*
+ "delete-nodes", %*
+ "filtered-notifications", %*
+ "modify-affiliations",
+ "outcast-affiliation",
+ "persistent-items",
+ "publish", %*
+ "purge-nodes",
+ "retract-items",
+ "retrieve-affiliations",
+ "retrieve-items", %*
+ "retrieve-subscriptions",
+ "subscribe" %*
+ ].
+
+create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access) ->
+ node_pep:create_node_permission(Host, ServerHost, Node, ParentNode, Owner, Access).
+
+create_node(Host, Node, Owner) ->
+ node_pep:create_node(Host, Node, Owner).
+
+delete_node(Host, Removed) ->
+ node_pep:delete_node(Host, Removed).
+
+subscribe_node(Host, Node, Sender, Subscriber, AccessModel,
+ SendLast, PresenceSubscription, RosterGroup) ->
+ node_pep:subscribe_node(
+ Host, Node, Sender, Subscriber, AccessModel, SendLast,
+ PresenceSubscription, RosterGroup).
+
+unsubscribe_node(Host, Node, Sender, Subscriber, SubID) ->
+ node_pep:unsubscribe_node(Host, Node, Sender, Subscriber, SubID).
+
+publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload) ->
+ node_pep:publish_item(Host, Node, Publisher, Model, MaxItems, ItemId, Payload).
+
+remove_extra_items(Host, Node, MaxItems, ItemIds) ->
+ node_pep:remove_extra_items(Host, Node, MaxItems, ItemIds).
+
+delete_item(Host, Node, JID, ItemId) ->
+ node_pep:delete_item(Host, Node, JID, ItemId).
+
+purge_node(Host, Node, Owner) ->
+ node_pep:purge_node(Host, Node, Owner).
+
+get_entity_affiliations(Host, Owner) ->
+ node_pep:get_entity_affiliations(Host, Owner).
+
+get_node_affiliations(Host, Node) ->
+ node_pep:get_node_affiliations(Host, Node).
+
+get_affiliation(Host, Node, Owner) ->
+ node_pep:get_affiliation(Host, Node, Owner).
+
+set_affiliation(Host, Node, Owner, Affiliation) ->
+ node_pep:set_affiliation(Host, Node, Owner, Affiliation).
+
+get_entity_subscriptions(Host,Owner) ->
+ node_pep:get_entity_subscriptions(Host, Owner).
+
+get_node_subscriptions(Host, Node) ->
+ node_pep:get_node_subscriptions(Host, Node).
+
+get_subscription(Host,Node,Owner) ->
+ node_pep:get_subscription(Host,Node,Owner).
+
+set_subscription(Host, Node, Owner, Subscription) ->
+ node_pep:set_subscription(Host, Node, Owner, Subscription).
+
+get_states(Host, Node) ->
+ node_pep:get_states(Host, Node).
+
+get_state(Host, Node, JID) ->
+ node_pep:get_state(Host, Node, JID).
+
+set_state(State) ->
+ node_pep:set_state(State).
+
+get_items(Host, Node, From) ->
+ node_pep:get_items(Host, Node, From).
+
+get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
+ node_pep:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
+
+get_item(Host, Node, ItemId) ->
+ node_pep:get_item(Host, Node, ItemId).
+
+get_item(Host, Node, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
+ node_pep:get_item(Host, Node, ItemId, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
+
+set_item(Item) ->
+ node_pep:set_item(Item).
+
+get_item_name(Host, Node, Id) ->
+ node_pep:get_item_name(Host, Node, Id).
+
diff --git a/src/mod_pubsub/node_pep.erl b/src/mod_pubsub/node_pep.erl
index ddbf13b4b..6d2d2709e 100644
--- a/src/mod_pubsub/node_pep.erl
+++ b/src/mod_pubsub/node_pep.erl
@@ -59,7 +59,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -123,7 +123,8 @@ create_node_permission(Host, ServerHost, _Node, _ParentNode, Owner, Access) ->
{User, Server, _} -> true;
_ -> false
end;
- _ ->
+ E ->
+ ?DEBUG("Create not allowed : ~p~n", [E]),
false
end
end,
@@ -215,8 +216,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_private.erl b/src/mod_pubsub/node_private.erl
index 08d6abd85..5d87ec181 100644
--- a/src/mod_pubsub/node_private.erl
+++ b/src/mod_pubsub/node_private.erl
@@ -63,7 +63,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -173,8 +173,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_public.erl b/src/mod_pubsub/node_public.erl
index 08559e423..7fda56e22 100644
--- a/src/mod_pubsub/node_public.erl
+++ b/src/mod_pubsub/node_public.erl
@@ -63,7 +63,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -170,8 +170,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_pubsub/node_zoo.erl b/src/mod_pubsub/node_zoo.erl
index a0d8afb09..12a69c58f 100644
--- a/src/mod_pubsub/node_zoo.erl
+++ b/src/mod_pubsub/node_zoo.erl
@@ -54,7 +54,7 @@
get_state/3,
set_state/1,
get_items/7,
- get_items/2,
+ get_items/3,
get_item/8,
get_item/3,
set_item/1,
@@ -163,8 +163,8 @@ get_state(Host, Node, JID) ->
set_state(State) ->
node_default:set_state(State).
-get_items(Host, Node) ->
- node_default:get_items(Host, Node).
+get_items(Host, Node, From) ->
+ node_default:get_items(Host, Node, From).
get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId) ->
node_default:get_items(Host, Node, JID, AccessModel, PresenceSubscription, RosterGroup, SubId).
diff --git a/src/mod_roster_odbc.erl b/src/mod_roster_odbc.erl
index 88d0b8667..8f329f7ab 100644
--- a/src/mod_roster_odbc.erl
+++ b/src/mod_roster_odbc.erl
@@ -16,7 +16,7 @@
%%% 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
@@ -638,7 +638,7 @@ set_items(User, Server, #xmlel{children = Els}) ->
LServer = exmpp_stringprep:nameprep(Server),
catch odbc_queries:sql_transaction(
LServer,
- lists:map(fun(El) ->
+ lists:flatmap(fun(El) ->
process_item_set_t(LUser, LServer, El)
end, Els))
catch
@@ -877,7 +877,7 @@ groups_to_string(#roster{us = {User, _Server},
%% Empty groups do not need to be converted to string to be inserted in
%% the database
lists:foldl(fun([], Acc) -> Acc;
- (Group, Acc) ->
+ (Group, Acc) ->
String = ["'", Username, "',"
"'", SJID, "',"
"'", ejabberd_odbc:escape(binary_to_list(Group)), "'"],
@@ -1060,4 +1060,3 @@ us_to_list({User, Server}) ->
webadmin_user(Acc, _User, _Server, Lang) ->
Acc ++ [?XE("h3", [?ACT("roster/", "Roster")])].
-
diff --git a/src/mod_shared_roster.erl b/src/mod_shared_roster.erl
index 8b436f137..69ff2e395 100644
--- a/src/mod_shared_roster.erl
+++ b/src/mod_shared_roster.erl
@@ -161,6 +161,7 @@ get_user_roster(Items, US) ->
process_item(RosterItem, Host) ->
USFrom = {UserFrom, ServerFrom} = RosterItem#roster.us,
{UserTo, ServerTo, ResourceTo} = RosterItem#roster.jid,
+ NameTo = RosterItem#roster.name,
USTo = {UserTo, ServerTo},
DisplayedGroups = get_user_displayed_groups(USFrom),
CommonGroups = lists:filter(fun(Group) ->
@@ -188,24 +189,24 @@ process_item(RosterItem, Host) ->
PersonalGroups ->
%% Store roster items in From and To rosters
set_new_rosteritems(UserFrom, ServerFrom,
- UserTo, ServerTo, ResourceTo,
+ UserTo, ServerTo, ResourceTo, NameTo,
PersonalGroups)
end
end.
-build_roster_record(User1, Server1, User2, Server2, Groups) ->
+build_roster_record(User1, Server1, User2, Server2, Name2, Groups) ->
USR2 = {User2, Server2, undefined},
#roster{usj = {User1, Server1, USR2},
us = {User1, Server1},
jid = USR2,
- name = User2,
+ name = Name2,
subscription = both,
ask = none,
groups = Groups
}.
set_new_rosteritems(UserFrom, ServerFrom,
- UserTo, ServerTo, ResourceTo, GroupsFrom) ->
+ UserTo, ServerTo, ResourceTo, NameTo, GroupsFrom) ->
Mod = case lists:member(mod_roster_odbc,
gen_mod:loaded_modules(ServerFrom)) of
true -> mod_roster_odbc;
@@ -213,13 +214,13 @@ set_new_rosteritems(UserFrom, ServerFrom,
end,
RIFrom = build_roster_record(UserFrom, ServerFrom,
- UserTo, ServerTo, GroupsFrom),
+ UserTo, ServerTo, NameTo, GroupsFrom),
set_item(UserFrom, ServerFrom, ResourceTo, RIFrom),
JIDTo = exmpp_jid:make_bare_jid(UserTo, ServerTo),
JIDFrom = exmpp_jid:make_bare_jid(UserFrom, ServerFrom),
RITo = build_roster_record(UserTo, ServerTo,
- UserFrom, ServerFrom, []),
+ UserFrom, ServerFrom, UserFrom,[]),
set_item(UserTo, ServerTo, undefined, RITo),
%% From requests
diff --git a/src/mod_vcard_odbc.erl b/src/mod_vcard_odbc.erl
index 980d8d608..6dcfc506c 100644
--- a/src/mod_vcard_odbc.erl
+++ b/src/mod_vcard_odbc.erl
@@ -16,7 +16,7 @@
%%% 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
@@ -97,7 +97,7 @@ stop(Host) ->
get_sm_features({error, _Error} = Acc, _From, _To, _Node, _Lang) ->
Acc;
-
+
get_sm_features(Acc, _From, _To, Node, _Lang) ->
case Node of
[] ->
@@ -131,10 +131,7 @@ process_local_iq(_From, _To, #iq{type = set} = IQ_Rec) ->
process_sm_iq(_From, To, #iq{type = get} = IQ_Rec) ->
#jid{lnode = LUser, ldomain = LServer} = To,
Username = ejabberd_odbc:escape(LUser),
- case catch ejabberd_odbc:sql_query(
- LServer,
- ["select vcard from vcard "
- "where username='", Username, "';"]) of
+ case catch odbc_queries:get_vcard(LServer, Username) of
{selected, ["vcard"], [{SVCARD}]} ->
try exmpp_xml:parse_document(SVCARD,
[namespace, name_as_atom, autoload_known]) of
@@ -233,30 +230,13 @@ set_vcard(User, LServer, VCARD) ->
SOrgUnit = ejabberd_odbc:escape(OrgUnit),
SLOrgUnit = ejabberd_odbc:escape(LOrgUnit),
- ejabberd_odbc:sql_transaction(
- LServer,
- [["delete from vcard where username='", LUsername, "';"],
- ["insert into vcard(username, vcard) "
- "values ('", LUsername, "', '", SVCARD, "');"],
- ["delete from vcard_search where lusername='", LUsername, "';"],
- ["insert into vcard_search("
- " username, lusername, fn, lfn, family, lfamily,"
- " given, lgiven, middle, lmiddle, nickname, lnickname,"
- " bday, lbday, ctry, lctry, locality, llocality,"
- " email, lemail, orgname, lorgname, orgunit, lorgunit)"
- "values (",
- " '", Username, "', '", LUsername, "',"
- " '", SFN, "', '", SLFN, "',"
- " '", SFamily, "', '", SLFamily, "',"
- " '", SGiven, "', '", SLGiven, "',"
- " '", SMiddle, "', '", SLMiddle, "',"
- " '", SNickname, "', '", SLNickname, "',"
- " '", SBDay, "', '", SLBDay, "',"
- " '", SCTRY, "', '", SLCTRY, "',"
- " '", SLocality, "', '", SLLocality, "',"
- " '", SEMail, "', '", SLEMail, "',"
- " '", SOrgName, "', '", SLOrgName, "',"
- " '", SOrgUnit, "', '", SLOrgUnit, "');"]])
+ odbc_queries:set_vcard(LServer, LUsername, SBDay, SCTRY, SEMail,
+ SFN, SFamily, SGiven, SLBDay, SLCTRY,
+ SLEMail, SLFN, SLFamily, SLGiven,
+ SLLocality, SLMiddle, SLNickname,
+ SLOrgName, SLOrgUnit, SLocality,
+ SMiddle, SNickname, SOrgName,
+ SOrgUnit, SVCARD, Username)
catch
_ ->
{error, badarg}
@@ -612,18 +592,18 @@ make_val(Match, Field, Val) ->
% true ->
% mnesia:write(
% #vcard_search{us = US,
-% user = User, luser = LUser,
-% fn = FN, lfn = LFN,
-% family = Family, lfamily = LFamily,
-% given = Given, lgiven = LGiven,
-% middle = Middle, lmiddle = LMiddle,
-% nickname = Nickname, lnickname = LNickname,
-% bday = BDay, lbday = LBDay,
-% ctry = CTRY, lctry = LCTRY,
-% locality = Locality, llocality = LLocality,
-% email = EMail, lemail = LEMail,
-% orgname = OrgName, lorgname = LOrgName,
-% orgunit = OrgUnit, lorgunit = LOrgUnit
+% user = User, luser = LUser,
+% fn = FN, lfn = LFN,
+% family = Family, lfamily = LFamily,
+% given = Given, lgiven = LGiven,
+% middle = Middle, lmiddle = LMiddle,
+% nickname = Nickname, lnickname = LNickname,
+% bday = BDay, lbday = LBDay,
+% ctry = CTRY, lctry = LCTRY,
+% locality = Locality, llocality = LLocality,
+% email = EMail, lemail = LEMail,
+% orgname = OrgName, lorgname = LOrgName,
+% orgunit = OrgUnit, lorgunit = LOrgUnit
% })
% end.
%
@@ -643,5 +623,3 @@ remove_user(User, Server) ->
LServer,
[["delete from vcard where username='", Username, "';"],
["delete from vcard_search where lusername='", Username, "';"]]).
-
-
diff --git a/src/odbc/Makefile.win32 b/src/odbc/Makefile.win32
index 13b54fb2f..2775468b7 100644
--- a/src/odbc/Makefile.win32
+++ b/src/odbc/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\ejabberd_odbc.beam ..\ejabberd_odbc_sup.beam ..\odbc_queries.beam
ALL : $(BEAMS)
diff --git a/src/odbc/ejabberd_odbc.erl b/src/odbc/ejabberd_odbc.erl
index a373cc2d1..da1b01e2c 100644
--- a/src/odbc/ejabberd_odbc.erl
+++ b/src/odbc/ejabberd_odbc.erl
@@ -30,7 +30,7 @@
-behaviour(gen_server).
%% External exports
--export([start/1, start_link/1,
+-export([start/1, start_link/2,
sql_query/2,
sql_query_t/1,
sql_transaction/2,
@@ -63,8 +63,8 @@
start(Host) ->
gen_server:start(ejabberd_odbc, [Host], []).
-start_link(Host) ->
- gen_server:start_link(ejabberd_odbc, [Host], []).
+start_link(Host, StartInterval) ->
+ gen_server:start_link(ejabberd_odbc, [Host, StartInterval], []).
sql_query(Host, Query) ->
gen_server:call(ejabberd_odbc_sup:get_random_pid(Host),
@@ -131,10 +131,10 @@ escape_like(C) -> odbc_queries:escape(C).
%% ignore |
%% {stop, Reason}
%%----------------------------------------------------------------------
-init([Host]) ->
+init([Host, StartInterval]) ->
case ejabberd_config:get_local_option({odbc_keepalive_interval, Host}) of
- Interval when is_integer(Interval) ->
- timer:apply_interval(Interval*1000, ?MODULE, keep_alive, [self()]);
+ KeepaliveInterval when is_integer(KeepaliveInterval) ->
+ timer:apply_interval(KeepaliveInterval*1000, ?MODULE, keep_alive, [self()]);
undefined ->
ok;
_Other ->
@@ -144,16 +144,16 @@ init([Host]) ->
case SQLServer of
%% Default pgsql port
{pgsql, Server, DB, Username, Password} ->
- pgsql_connect(Server, ?PGSQL_PORT, DB, Username, Password);
+ pgsql_connect(Server, ?PGSQL_PORT, DB, Username, Password, StartInterval);
{pgsql, Server, Port, DB, Username, Password} when is_integer(Port) ->
- pgsql_connect(Server, Port, DB, Username, Password);
+ pgsql_connect(Server, Port, DB, Username, Password, StartInterval);
%% Default mysql port
{mysql, Server, DB, Username, Password} ->
- mysql_connect(Server, ?MYSQL_PORT, DB, Username, Password);
+ mysql_connect(Server, ?MYSQL_PORT, DB, Username, Password, StartInterval);
{mysql, Server, Port, DB, Username, Password} when is_integer(Port) ->
- mysql_connect(Server, Port, DB, Username, Password);
+ mysql_connect(Server, Port, DB, Username, Password, StartInterval);
_ when is_list(SQLServer) ->
- odbc_connect(SQLServer)
+ odbc_connect(SQLServer, StartInterval)
end.
%%----------------------------------------------------------------------
@@ -259,7 +259,7 @@ execute_transaction(State, F, NRestarts) ->
%% part of init/1
%% Open an ODBC database connection
-odbc_connect(SQLServer) ->
+odbc_connect(SQLServer, StartInterval) ->
application:start(odbc),
case odbc:connect(SQLServer,[{scrollable_cursors, off}]) of
{ok, Ref} ->
@@ -268,8 +268,8 @@ odbc_connect(SQLServer) ->
{error, Reason} ->
?ERROR_MSG("ODBC connection (~s) failed: ~p~n",
[SQLServer, Reason]),
- %% If we can't connect we wait for 30 seconds before retrying
- timer:sleep(30000),
+ %% If we can't connect we wait before retrying
+ timer:sleep(StartInterval),
{stop, odbc_connection_failed}
end.
@@ -278,15 +278,15 @@ odbc_connect(SQLServer) ->
%% part of init/1
%% Open a database connection to PostgreSQL
-pgsql_connect(Server, Port, DB, Username, Password) ->
+pgsql_connect(Server, Port, DB, Username, Password, StartInterval) ->
case pgsql:connect(Server, DB, Username, Password, Port) of
{ok, Ref} ->
erlang:monitor(process, Ref),
{ok, #state{db_ref = Ref, db_type = pgsql}};
{error, Reason} ->
?ERROR_MSG("PostgreSQL connection failed: ~p~n", [Reason]),
- %% If we can't connect we wait for 30 seconds before retrying
- timer:sleep(30000),
+ %% If we can't connect we wait before retrying
+ timer:sleep(StartInterval),
{stop, pgsql_connection_failed}
end.
@@ -317,7 +317,7 @@ pgsql_item_to_odbc(_) ->
%% part of init/1
%% Open a database connection to MySQL
-mysql_connect(Server, Port, DB, Username, Password) ->
+mysql_connect(Server, Port, DB, Username, Password, StartInterval) ->
NoLogFun = fun(_Level,_Format,_Argument) -> ok end,
case mysql_conn:start(Server, Port, Username, Password, DB, NoLogFun) of
{ok, Ref} ->
@@ -330,9 +330,10 @@ mysql_connect(Server, Port, DB, Username, Password) ->
"SERIALIZABLE;"], self()),
{ok, #state{db_ref = Ref, db_type = mysql}};
{error, Reason} ->
- ?ERROR_MSG("MySQL connection failed: ~p~n", [Reason]),
- %% If we can't connect we wait for 30 seconds before retrying
- timer:sleep(30000),
+ ?ERROR_MSG("MySQL connection failed: ~p~nWaiting ~p seconds before retrying...~n",
+ [Reason, StartInterval div 1000]),
+ %% If we can't connect we wait before retrying
+ timer:sleep(StartInterval),
{stop, mysql_connection_failed}
end.
diff --git a/src/odbc/ejabberd_odbc_sup.erl b/src/odbc/ejabberd_odbc_sup.erl
index c007da527..80f0a36ca 100644
--- a/src/odbc/ejabberd_odbc_sup.erl
+++ b/src/odbc/ejabberd_odbc_sup.erl
@@ -16,7 +16,7 @@
%%% 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
@@ -37,32 +37,44 @@
-include("ejabberd.hrl").
-define(DEFAULT_POOL_SIZE, 10).
+-define(DEFAULT_ODBC_START_INTERVAL, 30). % 30 seconds
start_link(Host) ->
supervisor:start_link({local, gen_mod:get_module_proc(Host, ?MODULE)},
?MODULE, [Host]).
init([Host]) ->
- N = case ejabberd_config:get_local_option({odbc_pool_size, Host}) of
- I when is_integer(I) ->
- I;
+ PoolSize = case ejabberd_config:get_local_option({odbc_pool_size, Host}) of
+ I when is_integer(I) ->
+ I;
undefined ->
- ?DEFAULT_POOL_SIZE;
- Other ->
- ?ERROR_MSG("Wrong odbc_pool_size definition '~p' for host ~p, default to ~p~n",
- [Other, Host, ?DEFAULT_POOL_SIZE]),
- ?DEFAULT_POOL_SIZE
- end,
- {ok, {{one_for_one, 10, 6},
+ ?DEFAULT_POOL_SIZE;
+ Other ->
+ ?ERROR_MSG("Wrong odbc_pool_size definition '~p' for host ~p, default to ~p~n",
+ [Other, Host, ?DEFAULT_POOL_SIZE]),
+ ?DEFAULT_POOL_SIZE
+ end,
+ StartInterval = case ejabberd_config:get_local_option({odbc_start_interval, Host}) of
+ Interval when is_integer(Interval) ->
+ Interval;
+ undefined ->
+ ?DEFAULT_ODBC_START_INTERVAL;
+ _Other2 ->
+ ?ERROR_MSG("Wrong odbc_start_interval definition '~p' for host ~p"
+ ", defaulting to ~p~n",
+ [_Other2, Host, ?DEFAULT_ODBC_START_INTERVAL]),
+ ?DEFAULT_ODBC_START_INTERVAL
+ end,
+ {ok, {{one_for_one, PoolSize+1, StartInterval},
lists:map(
fun(I) ->
{I,
- {ejabberd_odbc, start_link, [Host]},
+ {ejabberd_odbc, start_link, [Host, StartInterval*1000]},
transient,
brutal_kill,
worker,
[?MODULE]}
- end, lists:seq(1, N))}}.
+ end, lists:seq(1, PoolSize))}}.
get_pids(Host) ->
Proc = gen_mod:get_module_proc(Host, ?MODULE),
diff --git a/src/odbc/mssql2005.sql b/src/odbc/mssql2005.sql
index ca5007f15..f61980c0a 100644
--- a/src/odbc/mssql2005.sql
+++ b/src/odbc/mssql2005.sql
@@ -10,7 +10,7 @@
* 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
@@ -104,6 +104,10 @@ if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vcard]') a
drop table [dbo].[vcard]
GO
+if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[vcard_search]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
+drop table [dbo].[vcard_search]
+GO
+
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[private_storage]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[private_storage]
GO
@@ -119,7 +123,7 @@ GO
CREATE TABLE [dbo].[rostergroups] (
[username] [varchar] (250) NOT NULL ,
[jid] [varchar] (250) NOT NULL ,
- [grp] [varchar] (100) NOT NULL
+ [grp] [varchar] (100) NOT NULL
) ON [PRIMARY]
GO
@@ -133,7 +137,7 @@ CREATE TABLE [dbo].[rosterusers] (
[server] [char] (1) NOT NULL ,
[subscribe] [varchar] (200) NULL ,
[type] [varchar] (50) NULL ,
-CONSTRAINT [PK_rosterusers] PRIMARY KEY NONCLUSTERED
+CONSTRAINT [PK_rosterusers] PRIMARY KEY NONCLUSTERED
(
[username] ASC,
[jid] ASC
@@ -154,31 +158,41 @@ GO
CREATE TABLE [dbo].[users] (
[username] [varchar] (250) NOT NULL ,
[password] [varchar] (50) NOT NULL ,
- [created] [datetime] NULL
+ [created] [datetime] NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[vcard] (
[username] [varchar] (250) NOT NULL ,
- [full_name] [varchar] (250) NULL ,
- [first_name] [varchar] (50) NULL ,
- [last_name] [varchar] (50) NULL ,
- [nick_name] [varchar] (50) NULL ,
- [url] [varchar] (1024) NULL ,
- [address1] [varchar] (50) NULL ,
- [address2] [varchar] (50) NULL ,
- [locality] [varchar] (50) NULL ,
- [region] [varchar] (50) NULL ,
- [pcode] [varchar] (50) NULL ,
- [country] [varchar] (50) NULL ,
- [telephone] [varchar] (50) NULL ,
- [email] [varchar] (250) NULL ,
- [orgname] [varchar] (50) NULL ,
- [orgunit] [varchar] (50) NULL ,
- [title] [varchar] (50) NULL ,
- [role] [varchar] (50) NULL ,
- [b_day] [datetime] NULL ,
- [descr] [varchar] (500) NULL
+ [vcard] [text] NOT NULL
+) ON [PRIMARY]
+GO
+
+CREATE TABLE [dbo].[vcard_search] (
+ [username] [varchar] (250) NOT NULL ,
+ [lusername] [varchar] (250) NOT NULL ,
+ [fn] [text] NOT NULL ,
+ [lfn] [varchar] (250) NOT NULL ,
+ [family] [text] NOT NULL ,
+ [lfamily] [varchar] (250) NOT NULL ,
+ [given] [text] NOT NULL ,
+ [lgiven] [varchar] (250) NOT NULL ,
+ [middle] [text] NOT NULL ,
+ [lmiddle] [varchar] (250) NOT NULL ,
+ [nickname] [text] NOT NULL ,
+ [lnickname] [varchar] (250) NOT NULL ,
+ [bday] [text] NOT NULL ,
+ [lbday] [varchar] (250) NOT NULL ,
+ [ctry] [text] NOT NULL ,
+ [lctry] [varchar] (250) NOT NULL ,
+ [locality] [text] NOT NULL ,
+ [llocality] [varchar] (250) NOT NULL ,
+ [email] [text] NOT NULL ,
+ [lemail] [varchar] (250) NOT NULL ,
+ [orgname] [text] NOT NULL ,
+ [lorgname] [varchar] (250) NOT NULL ,
+ [orgunit] [text] NOT NULL ,
+ [lorgunit] [varchar] (250) NOT NULL
) ON [PRIMARY]
GO
@@ -199,7 +213,7 @@ CREATE TABLE [dbo].[privacy_list](
[username] [varchar](250) NOT NULL,
[name] [varchar](250) NOT NULL,
[id] [bigint] IDENTITY(1,1) NOT NULL,
- CONSTRAINT [PK_privacy_list] PRIMARY KEY CLUSTERED
+ CONSTRAINT [PK_privacy_list] PRIMARY KEY CLUSTERED
(
[id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
@@ -224,73 +238,98 @@ GO
- id in privacy_list is a SERIAL autogenerated number
- id in privacy_list_data must exist in the table privacy_list */
-ALTER TABLE [dbo].[last] WITH NOCHECK ADD
- CONSTRAINT [PK_last] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[last] WITH NOCHECK ADD
+ CONSTRAINT [PK_last] PRIMARY KEY CLUSTERED
(
[username]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
-ALTER TABLE [dbo].[rostergroups] WITH NOCHECK ADD
- CONSTRAINT [PK_rostergroups] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[rostergroups] WITH NOCHECK ADD
+ CONSTRAINT [PK_rostergroups] PRIMARY KEY CLUSTERED
(
[username],
[jid],
[grp]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
-ALTER TABLE [dbo].[spool] WITH NOCHECK ADD
- CONSTRAINT [PK_spool] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[spool] WITH NOCHECK ADD
+ CONSTRAINT [PK_spool] PRIMARY KEY CLUSTERED
(
[username],
[id]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
-ALTER TABLE [dbo].[users] WITH NOCHECK ADD
- CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[users] WITH NOCHECK ADD
+ CONSTRAINT [PK_users] PRIMARY KEY CLUSTERED
(
[username]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
-ALTER TABLE [dbo].[vcard] WITH NOCHECK ADD
- CONSTRAINT [PK_vcard] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[vcard] WITH NOCHECK ADD
+ CONSTRAINT [PK_vcard] PRIMARY KEY CLUSTERED
(
[username]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
+
+CREATE INDEX [IX_vcard_search_lfn] ON [dbo].[vcard_search]([lfn]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lfamily] ON [dbo].[vcard_search]([lfamily]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lgiven] ON [dbo].[vcard_search]([lgiven]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lmiddle] ON [dbo].[vcard_search]([lmiddle]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lnickname] ON [dbo].[vcard_search]([lnickname]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lbday] ON [dbo].[vcard_search]([lbday]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lctry] ON [dbo].[vcard_search]([lctry]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_llocality] ON [dbo].[vcard_search]([llocality]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lemail] ON [dbo].[vcard_search]([lemail]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lorgname] ON [dbo].[vcard_search]([lorgname]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+CREATE INDEX [IX_vcard_search_lorgunit] ON [dbo].[vcard_search]([lorgunit]) WITH FILLFACTOR = 90 ON [PRIMARY]
+GO
+
+
CREATE CLUSTERED INDEX [IX_rosterusers_user] ON [dbo].[rosterusers]([username]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
-ALTER TABLE [dbo].[last] WITH NOCHECK ADD
+ALTER TABLE [dbo].[last] WITH NOCHECK ADD
CONSTRAINT [DF_last_updated] DEFAULT (getdate()) FOR [Modify_Date]
GO
-ALTER TABLE [dbo].[spool] WITH NOCHECK ADD
+ALTER TABLE [dbo].[spool] WITH NOCHECK ADD
CONSTRAINT [DF_spool_notifyprocessed] DEFAULT (0) FOR [notifyprocessed],
CONSTRAINT [DF_spool_created] DEFAULT (getdate()) FOR [created],
CONSTRAINT [DF_spool_MustDelete] DEFAULT (0) FOR [MustDelete]
GO
-ALTER TABLE [dbo].[users] WITH NOCHECK ADD
+ALTER TABLE [dbo].[users] WITH NOCHECK ADD
CONSTRAINT [DF_users_created] DEFAULT (getdate()) FOR [created]
GO
-ALTER TABLE [dbo].[privacy_default_list] WITH NOCHECK ADD
- CONSTRAINT [PK_privacy_defaut_list] PRIMARY KEY CLUSTERED
+ALTER TABLE [dbo].[privacy_default_list] WITH NOCHECK ADD
+ CONSTRAINT [PK_privacy_defaut_list] PRIMARY KEY CLUSTERED
(
[username]
- ) WITH FILLFACTOR = 90 ON [PRIMARY]
+ ) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [IX_rostergroups_jid] ON [dbo].[rostergroups]([jid]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
CREATE INDEX [IX_rostergroups_user] ON [dbo].[rostergroups]([username]) WITH FILLFACTOR = 90 ON [PRIMARY]
-GO
+GO
CREATE INDEX [IX_spool_user] ON [dbo].[spool]([username]) WITH FILLFACTOR = 90 ON [PRIMARY]
GO
@@ -385,7 +424,7 @@ BEGIN
@Type
);
END
-
+
--- Update Roster Groups if exist else add group entry
IF NOT EXISTS (SELECT username FROM rostergroups WITH (NOLOCK) WHERE rostergroups.username=@Username AND rostergroups.jid=@JID AND rostergroups.grp=@Grp)
BEGIN
@@ -543,12 +582,12 @@ CREATE PROCEDURE [dbo].[add_user]
@Password varchar(50)
AS
BEGIN
- INSERT INTO users
- ( [username],
+ INSERT INTO users
+ ( [username],
[password]
- )
- VALUES
- ( @Username,
+ )
+ VALUES
+ ( @Username,
@Password
);
END
@@ -559,7 +598,7 @@ GO
/** Update users password **/
/******************************************************************/
CREATE PROCEDURE [dbo].[set_password]
- @Username varchar(200),
+ @Username varchar(200),
@Password varchar(50)
AS
BEGIN
@@ -582,7 +621,7 @@ CREATE PROCEDURE [dbo].[get_password]
@Username varchar(200)
AS
BEGIN
- SELECT users.password as password
+ SELECT users.password as password
FROM users WITH (NOLOCK)
WHERE username=@Username;
END
@@ -594,7 +633,7 @@ GO
/***************************************************************/
CREATE PROCEDURE [dbo].[clean_spool_msg]
AS
-DECLARE
+DECLARE
@dt datetime,
@myRowCount int
BEGIN
@@ -606,7 +645,7 @@ BEGIN
BEGIN
BEGIN TRANSACTION
SELECT @dt = DATEADD(d, -3, GETDATE())
- DELETE FROM spool
+ DELETE FROM spool
WITH (ROWLOCK)
WHERE (MustDelete=1) OR (Created < @dt);
@@ -640,11 +679,11 @@ CREATE PROCEDURE [dbo].[del_roster]
AS
BEGIN
BEGIN TRANSACTION
- DELETE FROM rosterusers
+ DELETE FROM rosterusers
WITH (ROWLOCK)
WHERE (rosterusers.username = @Username) AND (rosterusers.jid = @JID);
-
- DELETE FROM rostergroups
+
+ DELETE FROM rostergroups
WITH (ROWLOCK)
WHERE (rostergroups.username = @Username) AND (rostergroups.jid = @JID);
COMMIT
@@ -660,7 +699,7 @@ CREATE PROCEDURE [dbo].[del_spool_msg]
@Username varchar(250)
AS
BEGIN
- DELETE FROM spool
+ DELETE FROM spool
WITH (ROWLOCK)
WHERE spool.username=@Username;
END
@@ -674,7 +713,7 @@ CREATE PROCEDURE [dbo].[del_user]
@Username varchar(200)
AS
BEGIN
- DELETE FROM users
+ DELETE FROM users
WITH (ROWLOCK)
WHERE username=@Username;
END
@@ -691,7 +730,7 @@ DECLARE
@Pwd varchar(50)
BEGIN
EXECUTE @Pwd = dbo.get_password @Username
- DELETE FROM users
+ DELETE FROM users
WITH (ROWLOCK)
WHERE username=@Username
@@ -709,11 +748,11 @@ CREATE PROCEDURE [dbo].[del_user_roster]
AS
BEGIN
BEGIN TRANSACTION
- DELETE FROM rosterusers
+ DELETE FROM rosterusers
WITH (ROWLOCK)
WHERE rosterusers.username = @Username;
-
- DELETE FROM rostergroups
+
+ DELETE FROM rostergroups
WITH (ROWLOCK)
WHERE rostergroups.username = @Username;
COMMIT
@@ -739,9 +778,9 @@ BEGIN
FROM spool WITH (NOLOCK)
WHERE spool.username=@Username;
- DELETE spool
+ DELETE spool
WITH (ROWLOCK)
- WHERE spool.username=@Username
+ WHERE spool.username=@Username
END
ELSE
BEGIN
@@ -758,7 +797,7 @@ CREATE PROCEDURE [dbo].[get_last]
@Username varchar(250)
AS
BEGIN
- SELECT last.seconds AS seconds,
+ SELECT last.seconds AS seconds,
last.state AS state
FROM last WITH (NOLOCK)
WHERE last.username=@Username;
@@ -773,26 +812,26 @@ CREATE PROCEDURE [dbo].[get_roster]
@Username varchar(250)
AS
DECLARE
- @vRosterusers table( username varchar(1),
- jid varchar(1),
- nick varchar(1),
- subscription varchar(1),
- ask varchar(1),
- askmessage varchar(1),
- server varchar(1),
- subscribe varchar(1),
+ @vRosterusers table( username varchar(1),
+ jid varchar(1),
+ nick varchar(1),
+ subscription varchar(1),
+ ask varchar(1),
+ askmessage varchar(1),
+ server varchar(1),
+ subscribe varchar(1),
type varchar(1))
BEGIN
IF EXISTS (SELECT username FROM rosterusers with (nolock) WHERE rosterusers.username = @Username)
BEGIN
- SELECT rosterusers.username AS username,
- rosterusers.jid AS jid,
- rosterusers.nick AS nick,
- rosterusers.subscription AS subscription,
+ SELECT rosterusers.username AS username,
+ rosterusers.jid AS jid,
+ rosterusers.nick AS nick,
+ rosterusers.subscription AS subscription,
rosterusers.ask AS ask,
rosterusers.askmessage AS askmessage,
- rosterusers.server AS server,
- rosterusers.subscribe AS subscribe,
+ rosterusers.server AS server,
+ rosterusers.subscribe AS subscribe,
rosterusers.type AS type
FROM rosterusers WITH (NOLOCK)
WHERE rosterusers.username = @Username;
@@ -813,26 +852,26 @@ CREATE PROCEDURE [dbo].[get_roster_by_jid]
@JID varchar(250)
AS
DECLARE
- @vRosterusers table( username varchar(1),
- jid varchar(1),
- nick varchar(1),
- subscription varchar(1),
+ @vRosterusers table( username varchar(1),
+ jid varchar(1),
+ nick varchar(1),
+ subscription varchar(1),
ask varchar(1),
askmessage varchar(1),
- server varchar(1),
- subscribe varchar(1),
+ server varchar(1),
+ subscribe varchar(1),
type varchar(1))
BEGIN
IF EXISTS (SELECT username FROM rosterusers with (nolock) WHERE (rosterusers.username = @Username) AND (rosterusers.jid = @JID))
BEGIN
- SELECT rosterusers.username AS username,
- rosterusers.jid AS jid,
- rosterusers.nick AS nick,
- rosterusers.subscription AS subscription,
+ SELECT rosterusers.username AS username,
+ rosterusers.jid AS jid,
+ rosterusers.nick AS nick,
+ rosterusers.subscription AS subscription,
rosterusers.ask AS ask,
rosterusers.askmessage AS askmessage,
- rosterusers.server AS server,
- rosterusers.subscribe AS subscribe,
+ rosterusers.server AS server,
+ rosterusers.subscribe AS subscribe,
rosterusers.type AS type
FROM rosterusers WITH (NOLOCK)
WHERE (rosterusers.username = @Username) AND (rosterusers.jid = @JID);
@@ -852,12 +891,12 @@ CREATE PROCEDURE [dbo].[get_roster_jid_groups]
@Username varchar(200)
AS
DECLARE
- @vrostergroups table( jid varchar(1),
+ @vrostergroups table( jid varchar(1),
grp varchar(1))
BEGIN
IF EXISTS (SELECT username FROM rostergroups with (nolock) WHERE rostergroups.username = @Username)
BEGIN
- SELECT rostergroups.jid AS jid,
+ SELECT rostergroups.jid AS jid,
rostergroups.grp AS grp
FROM rostergroups WITH (NOLOCK)
WHERE rostergroups.username = @Username;
@@ -930,7 +969,7 @@ DECLARE
BEGIN
IF EXISTS (SELECT username FROM rosterusers with (nolock) WHERE rosterusers.username=@Username AND rosterusers.jid=@JID)
BEGIN
- SELECT rosterusers.subscription AS subscription
+ SELECT rosterusers.subscription AS subscription
FROM rosterusers WITH (NOLOCK)
WHERE rosterusers.username=@Username AND rosterusers.jid=@JID;
END
@@ -958,7 +997,7 @@ GO
/******************************************************************/
CREATE PROCEDURE [dbo].[set_last]
@Username varchar(250),
- @Seconds varchar(50),
+ @Seconds varchar(50),
@State varchar(100)
AS
BEGIN
@@ -1050,4 +1089,151 @@ END
GO
+/******************************************************************/
+/****** Object: StoredProcedure [dbo].[set_vcard] **/
+/** Set the user's vCard **/
+/******************************************************************/
+CREATE PROCEDURE [dbo].[set_vcard]
+ @VCard varchar(8000),
+ @Username varchar(250),
+ @Lusername varchar(250),
+ @Fn varchar(8000),
+ @Lfn varchar(250),
+ @Family varchar(8000),
+ @Lfamily varchar(250),
+ @Given varchar(8000),
+ @Lgiven varchar(250),
+ @Middle varchar(8000),
+ @Lmiddle varchar(250),
+ @Nickname varchar(8000),
+ @Lnickname varchar(250),
+ @Bday varchar(8000),
+ @Lbday varchar(250),
+ @Ctry varchar(8000),
+ @Lctry varchar(250),
+ @Locality varchar(8000),
+ @Llocality varchar(250),
+ @Email varchar(8000),
+ @Lemail varchar(250),
+ @Orgname varchar(8000),
+ @Lorgname varchar(250),
+ @Orgunit varchar(8000),
+ @Lorgunit varchar(250)
+AS
+BEGIN
+ IF EXISTS (SELECT username FROM vcard with (nolock) WHERE vcard.username = @Username)
+ BEGIN
+ UPDATE [vcard]
+ SET [vcard].username = @LUsername,
+ [vcard].vcard = @Vcard
+ WHERE vcard.username = @LUsername;
+ UPDATE [vcard_search]
+ SET [vcard_search].username = @Username,
+ [vcard_search].lusername = @Lusername,
+ [vcard_search].fn = @Fn,
+ [vcard_search].lfn = @Lfn,
+ [vcard_search].family = @Family,
+ [vcard_search].lfamily = @Lfamily,
+ [vcard_search].given = @Given,
+ [vcard_search].lgiven = @Lgiven,
+ [vcard_search].middle = @Middle,
+ [vcard_search].lmiddle = @Lmiddle,
+ [vcard_search].nickname = @Nickname,
+ [vcard_search].lnickname = @Lnickname,
+ [vcard_search].bday = @Bday,
+ [vcard_search].lbday = @Lbday,
+ [vcard_search].ctry = @Ctry,
+ [vcard_search].lctry = @Lctry,
+ [vcard_search].locality = @Locality,
+ [vcard_search].llocality = @Llocality,
+ [vcard_search].email = @Email,
+ [vcard_search].lemail = @Lemail,
+ [vcard_search].orgname = @Orgname,
+ [vcard_search].lorgname = @Lorgname,
+ [vcard_search].orgunit = @Orgunit,
+ [vcard_search].lorgunit = @Lorgunit
+ WHERE vcard_search.lusername = @LUsername;
+ END
+ ELSE
+ BEGIN
+ INSERT INTO [vcard]
+ ( [vcard].username,
+ [vcard].vcard
+ )
+ VALUES
+ ( @lUsername,
+ @Vcard
+ );
+
+ INSERT INTO [vcard_search]
+ (
+ [vcard_search].username ,
+ [vcard_search].lusername ,
+ [vcard_search].fn ,
+ [vcard_search].lfn ,
+ [vcard_search].family ,
+ [vcard_search].lfamily ,
+ [vcard_search].given ,
+ [vcard_search].lgiven ,
+ [vcard_search].middle ,
+ [vcard_search].lmiddle ,
+ [vcard_search].nickname,
+ [vcard_search].lnickname,
+ [vcard_search].bday,
+ [vcard_search].lbday,
+ [vcard_search].ctry,
+ [vcard_search].lctry,
+ [vcard_search].locality,
+ [vcard_search].llocality,
+ [vcard_search].email,
+ [vcard_search].lemail,
+ [vcard_search].orgname,
+ [vcard_search].lorgname,
+ [vcard_search].orgunit,
+ [vcard_search].lorgunit
+ )
+ VALUES
+ (
+ @Username,
+ @Lusername,
+ @Fn,
+ @Lfn,
+ @Family,
+ @Lfamily,
+ @Given,
+ @Lgiven,
+ @Middle,
+ @Lmiddle,
+ @Nickname,
+ @Lnickname,
+ @Bday,
+ @Lbday,
+ @Ctry,
+ @Lctry,
+ @Locality,
+ @Llocality,
+ @Email,
+ @Lemail,
+ @Orgname,
+ @Lorgname,
+ @Orgunit,
+ @Lorgunit
+ )
+ END
+END
+GO
+
+/******************************************************************/
+/****** Object: StoredProcedure [dbo].[get_vcard] **/
+/** Retrive the user's vCard **/
+/******************************************************************/
+CREATE PROCEDURE [dbo].[get_vcard]
+ @Username varchar(250)
+AS
+BEGIN
+ SELECT vcard.vcard as vcard
+ FROM vcard WITH (NOLOCK)
+ WHERE username=@Username;
+END
+GO
diff --git a/src/odbc/odbc_queries.erl b/src/odbc/odbc_queries.erl
index 33caa71d1..c9f6819be 100644
--- a/src/odbc/odbc_queries.erl
+++ b/src/odbc/odbc_queries.erl
@@ -61,6 +61,8 @@
set_private_data_sql/3,
get_private_data/3,
del_user_private_storage/2,
+ set_vcard/26,
+ get_vcard/2,
escape/1,
count_records_where/3]).
@@ -327,11 +329,11 @@ update_roster_sql(Username, SJID, ItemVals, ItemGroups) ->
" values (", ItemVals, ");"],
["delete from rostergroups "
" where username='", Username, "' "
- " and jid='", SJID, "';"],
+ " and jid='", SJID, "';"]] ++
[["insert into rostergroups("
" username, jid, grp) "
" values (", ItemGroup, ");"] ||
- ItemGroup <- ItemGroups]].
+ ItemGroup <- ItemGroups].
roster_subscribe(_LServer, Username, SJID, ItemVals) ->
ejabberd_odbc:sql_query_t(
@@ -378,6 +380,42 @@ del_user_private_storage(LServer, Username) ->
LServer,
["delete from private_storage where username='", Username, "';"]).
+
+set_vcard(LServer, LUsername, SBDay, SCTRY, SEMail, SFN, SFamily, SGiven,
+ SLBDay, SLCTRY, SLEMail, SLFN, SLFamily, SLGiven, SLLocality,
+ SLMiddle, SLNickname, SLOrgName, SLOrgUnit, SLocality, SMiddle,
+ SNickname, SOrgName, SOrgUnit, SVCARD, Username) ->
+ ejabberd_odbc:sql_transaction(
+ LServer,
+ [["delete from vcard where username='", LUsername, "';"],
+ ["insert into vcard(username, vcard) "
+ "values ('", LUsername, "', '", SVCARD, "');"],
+ ["delete from vcard_search where lusername='", LUsername, "';"],
+ ["insert into vcard_search("
+ " username, lusername, fn, lfn, family, lfamily,"
+ " given, lgiven, middle, lmiddle, nickname, lnickname,"
+ " bday, lbday, ctry, lctry, locality, llocality,"
+ " email, lemail, orgname, lorgname, orgunit, lorgunit)"
+ "values (",
+ " '", Username, "', '", LUsername, "',"
+ " '", SFN, "', '", SLFN, "',"
+ " '", SFamily, "', '", SLFamily, "',"
+ " '", SGiven, "', '", SLGiven, "',"
+ " '", SMiddle, "', '", SLMiddle, "',"
+ " '", SNickname, "', '", SLNickname, "',"
+ " '", SBDay, "', '", SLBDay, "',"
+ " '", SCTRY, "', '", SLCTRY, "',"
+ " '", SLocality, "', '", SLLocality, "',"
+ " '", SEMail, "', '", SLEMail, "',"
+ " '", SOrgName, "', '", SLOrgName, "',"
+ " '", SOrgUnit, "', '", SLOrgUnit, "');"]]).
+
+get_vcard(LServer, Username) ->
+ ejabberd_odbc:sql_query(
+ LServer,
+ ["select vcard from vcard "
+ "where username='", Username, "';"]).
+
%% Characters to escape
escape($\0) -> "\\0";
escape($\n) -> "\\n";
@@ -597,6 +635,25 @@ del_user_private_storage(LServer, Username) ->
LServer,
["EXECUTE dbo.del_user_storage '", Username, "'"]).
+set_vcard(LServer, LUsername, SBDay, SCTRY, SEMail, SFN, SFamily, SGiven,
+ SLBDay, SLCTRY, SLEMail, SLFN, SLFamily, SLGiven, SLLocality,
+ SLMiddle, SLNickname, SLOrgName, SLOrgUnit, SLocality, SMiddle,
+ SNickname, SOrgName, SOrgUnit, SVCARD, Username) ->
+ ejabberd_odbc:sql_query(
+ LServer,
+ ["EXECUTE dbo.set_vcard '", SVCARD, "' , '", Username, "' , '", LUsername, "' , '",
+ SFN, "' , '", SLFN, "' , '", SFamily, "' , '", SLFamily, "' , '",
+ SGiven, "' , '", SLGiven, "' , '", SMiddle, "' , '", SLMiddle, "' , '",
+ SNickname, "' , '", SLNickname, "' , '", SBDay, "' , '", SLBDay, "' , '",
+ SCTRY, "' , '", SLCTRY, "' , '", SLocality, "' , '", SLLocality, "' , '",
+ SEMail, "' , '", SLEMail, "' , '", SOrgName, "' , '", SLOrgName, "' , '",
+ SOrgUnit, "' , '", SLOrgUnit, "'"]).
+
+get_vcard(LServer, Username) ->
+ ejabberd_odbc:sql_query(
+ LServer,
+ ["EXECUTE dbo.get_vcard '", Username, "'"]).
+
%% Characters to escape
escape($\0) -> "\\0";
escape($\t) -> "\\t";
diff --git a/src/stringprep/Makefile.win32 b/src/stringprep/Makefile.win32
index 23f493ff6..60ccb416c 100644
--- a/src/stringprep/Makefile.win32
+++ b/src/stringprep/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\stringprep.beam ..\stringprep_sup.beam
SOURCE = stringprep_drv.c
AUXIL = uni_data.c uni_norm.c
diff --git a/src/tls/Makefile.win32 b/src/tls/Makefile.win32
index 576112e20..93ec8471d 100644
--- a/src/tls/Makefile.win32
+++ b/src/tls/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\tls.beam
SOURCE = tls_drv.c
OBJECT = tls_drv.o
diff --git a/src/web/Makefile.win32 b/src/web/Makefile.win32
index 3fc9ce2a1..411d57ce8 100644
--- a/src/web/Makefile.win32
+++ b/src/web/Makefile.win32
@@ -4,8 +4,7 @@ include ..\Makefile.inc
EFLAGS = -I .. -pz ..
OUTDIR = ..
-SOURCES = $(wildcard *.erl)
-BEAMS = $(addprefix $(OUTDIR)/,$(SOURCES:.erl=.beam))
+BEAMS = ..\ejabberd_http.beam ..\ejabberd_http_bind.beam ..\ejabberd_http_poll.beam ..\ejabberd_web.beam ..\ejabberd_web_admin.beam ..\mod_http_bind.beam ..\mod_http_fileserver.beam
ALL : $(BEAMS)
@@ -21,5 +20,14 @@ $(OUTDIR)\ejabberd_web.beam : ejabberd_web.erl
$(OUTDIR)\ejabberd_web_admin.beam : ejabberd_web_admin.erl
erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_web_admin.erl
+$(OUTDIR)\ejabberd_http_bind.beam : ejabberd_http_bind.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http_bind.erl
+
$(OUTDIR)\ejabberd_http_poll.beam : ejabberd_http_poll.erl
erlc -W $(EFLAGS) -o $(OUTDIR) ejabberd_http_poll.erl
+
+$(OUTDIR)\mod_http_bind.beam : mod_http_bind.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) mod_http_bind.erl
+
+$(OUTDIR)\mod_http_fileserver.beam : mod_http_fileserver.erl
+ erlc -W $(EFLAGS) -o $(OUTDIR) mod_http_fileserver.erl
|