mirror of
https://github.com/processone/ejabberd.git
synced 2024-10-07 14:58:56 +02:00
* src/configure.ac: Build system now done using autoconf (thanks
to Balabanov Dmitry) * src/aclocal.m4: Likewise * src/**/Makefile.in: Likewise * src/mod_roster.erl (process_item_set_t): Slightly improved performance * src/jd2ejd.erl: Added missed closing of XML stream process, removed timeout value from import_file/1 * src/ejabberd_auth.erl: Added checks for invalid user name SVN Revision: 152
This commit is contained in:
parent
8c027ab41d
commit
392d64ee8b
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
||||
2003-10-17 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/configure.ac: Build system now done using autoconf (thanks
|
||||
to Balabanov Dmitry)
|
||||
* src/aclocal.m4: Likewise
|
||||
* src/**/Makefile.in: Likewise
|
||||
|
||||
* src/mod_roster.erl (process_item_set_t): Slightly improved
|
||||
performance
|
||||
|
||||
* src/jd2ejd.erl: Added missed closing of XML stream process,
|
||||
removed timeout value from import_file/1
|
||||
|
||||
* src/ejabberd_auth.erl: Added checks for invalid user name
|
||||
|
||||
2003-10-16 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_configure.erl: Fixed some error codes
|
||||
|
33
src/Makefile
33
src/Makefile
@ -1,33 +0,0 @@
|
||||
# $Id$
|
||||
|
||||
include Makefile.inc
|
||||
|
||||
INCLUDES = -I$(ERLANG_DIR)/usr/include \
|
||||
-I$(EI_DIR)/include \
|
||||
-I/usr/local/include
|
||||
|
||||
LIBDIRS = -L$(EI_DIR)/lib -L/usr/local/lib
|
||||
|
||||
ERLSHLIBS = expat_erl.so
|
||||
|
||||
all: $(ERLSHLIBS)
|
||||
erl -s make all report -noinput -s erlang halt
|
||||
cd stringprep; make
|
||||
|
||||
$(ERLSHLIBS): %.so: %.c
|
||||
gcc -Wall $(INCLUDES) $(LIBDIRS) \
|
||||
-lexpat \
|
||||
$(subst .so,.c,$@) \
|
||||
-lerl_interface \
|
||||
-lei \
|
||||
-o $@ -fpic -shared \
|
||||
|
||||
clean:
|
||||
rm -f *.beam
|
||||
|
||||
Makefile.inc:
|
||||
./configure
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
||||
|
47
src/Makefile.in
Normal file
47
src/Makefile.in
Normal file
@ -0,0 +1,47 @@
|
||||
# $Id$
|
||||
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INCLUDES = @ERLANG_CFLAGS@ @EXPAT_CFLAGS@
|
||||
|
||||
LIBDIRS = @ERLANG_LIBS@ @EXPAT_LIBS@
|
||||
|
||||
SUBDIRS = @mod_irc@ @mod_pubsub@ @mod_muc@ stringprep
|
||||
|
||||
ERLSHLIBS = expat_erl.so
|
||||
|
||||
all: all-recursive $(ERLSHLIBS) compile-beam
|
||||
|
||||
compile-beam:
|
||||
@erl -s make all report -noinput -s erlang halt
|
||||
|
||||
|
||||
all-recursive install-recursive uninstall-recursive \
|
||||
clean-recursive distclean-recursive \
|
||||
mostlyclean-recursive maintainer-clean-recursive:
|
||||
@subdirs="$(SUBDIRS)"; for subdir in $$subdirs; do \
|
||||
target=`echo $@|sed 's,-recursive,,'`; \
|
||||
echo making $$target in $$subdir; \
|
||||
(cd $$subdir && $(MAKE) $$target) || exit 1; \
|
||||
done
|
||||
|
||||
|
||||
$(ERLSHLIBS): ../%.so: %.c
|
||||
gcc -Wall $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LIBDIRS) \
|
||||
$(subst ../,,$(subst .so,.c,$@)) \
|
||||
-lerl_interface \
|
||||
-lei \
|
||||
-o $@ -fpic -shared \
|
||||
|
||||
clean: clean-recursive
|
||||
rm -f *.beam $(ERLSHLIBS)
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
||||
|
||||
Makefile: Makefile.in
|
||||
|
195
src/aclocal.m4
vendored
Normal file
195
src/aclocal.m4
vendored
Normal file
@ -0,0 +1,195 @@
|
||||
AC_DEFUN(AM_WITH_EXPAT,
|
||||
[ AC_ARG_WITH(expat,
|
||||
[ --with-expat=PREFIX path to expat library],
|
||||
, with_expat=no)
|
||||
|
||||
EXPAT_CFLAGS=
|
||||
EXPAT_LIBS=
|
||||
if test $with_expat != no; then
|
||||
if test $with_expat != yes; then
|
||||
EXPAT_CFLAGS="-I$with_expat/include"
|
||||
EXPAT_LIBS="-L$with_expat/lib"
|
||||
fi
|
||||
AC_CHECK_LIB(expat, XML_ParserCreate,
|
||||
[ EXPAT_LIBS="$EXPAT_LIBS -lexpat"
|
||||
expat_found=yes ],
|
||||
[ expat_found=no ],
|
||||
"$EXPAT_LIBS")
|
||||
if test $expat_found = no; then
|
||||
AC_MSG_ERROR([Could not find the Expat library])
|
||||
fi
|
||||
expat_save_CFLAGS="$CFLAGS"
|
||||
CFLAGS="$CFLAGS $EXPAT_CFLAGS"
|
||||
AC_CHECK_HEADERS(expat.h, , expat_found=no)
|
||||
if test $expat_found = no; then
|
||||
AC_MSG_ERROR([Could not find expat.h])
|
||||
fi
|
||||
CFLAGS="$expat_save_CFLAGS"
|
||||
fi
|
||||
|
||||
AC_SUBST(EXPAT_CFLAGS)
|
||||
AC_SUBST(EXPAT_LIBS)
|
||||
])
|
||||
|
||||
AC_DEFUN(AM_WITH_ERLANG,
|
||||
[ AC_ARG_WITH(erlang,
|
||||
[ --with-erlang=PREFIX path to erlc and erl ])
|
||||
|
||||
|
||||
AC_PATH_TOOL(ERLC, erlc, , $PATH:$with_erlang:$with_erlang/bin)
|
||||
AC_PATH_TOOL(ERL, erl, , $PATH:$with_erlang:$with_erlang/bin)
|
||||
|
||||
if test "z$ERLC" == "z" || test "z$ERL" == "z"; then
|
||||
AC_MSG_ERROR([erlang not found])
|
||||
fi
|
||||
|
||||
|
||||
cat >>conftest.erl <<_EOF
|
||||
|
||||
-module(conftest).
|
||||
-author('alexey@sevcom.net').
|
||||
|
||||
-export([[start/0]]).
|
||||
|
||||
start() ->
|
||||
EIDirS = code:lib_dir("erl_interface") ++ "\n",
|
||||
RootDirS = code:root_dir() ++ "\n",
|
||||
file:write_file("conftest.out", list_to_binary(EIDirS ++ RootDirS)),
|
||||
halt().
|
||||
|
||||
_EOF
|
||||
|
||||
if ! $ERLC conftest.erl; then
|
||||
AC_MSG_ERROR([could not compile sample program])
|
||||
fi
|
||||
|
||||
if ! $ERL -s conftest -noshell; then
|
||||
AC_MSG_ERROR([could not run sample program])
|
||||
fi
|
||||
|
||||
if ! test -f conftest.out; then
|
||||
AC_MSG_ERROR([erlang program was not properly executed, (conftest.out was not produced)])
|
||||
fi
|
||||
|
||||
ERLANG_EI_DIR=`cat conftest.out | head -n 1`
|
||||
ERLANG_DIR=`cat conftest.out | tail -n 1`
|
||||
|
||||
ERLANG_CFLAGS="-I$ERLANG_EI_DIR/include -I$ERLANG_DIR/usr/include"
|
||||
ERLANG_LIBS="-L$ERLANG_EI_DIR/lib"
|
||||
|
||||
AC_SUBST(ERLANG_CFLAGS)
|
||||
AC_SUBST(ERLANG_LIBS)
|
||||
AC_SUBST(ERLC)
|
||||
AC_SUBST(ERL)
|
||||
])
|
||||
|
||||
|
||||
AC_DEFUN(AC_MOD_ENABLE,
|
||||
[
|
||||
$1=
|
||||
make_$1=
|
||||
AC_MSG_CHECKING([whether build $1])
|
||||
AC_ARG_ENABLE($1,
|
||||
[ --enable-$1 enable $1 (default: $2)],
|
||||
[mr_enable_$1="$enableval"],
|
||||
[mr_enable_$1=$2])
|
||||
if test "$mr_enable_$1" = $2; then
|
||||
$1=$1
|
||||
make_$1=$1/Makefile
|
||||
fi
|
||||
AC_MSG_RESULT($mr_enable_$1)
|
||||
AC_SUBST($1)
|
||||
AC_SUBST(make_$1)
|
||||
|
||||
])
|
||||
|
||||
|
||||
dnl From Bruno Haible.
|
||||
|
||||
AC_DEFUN([AM_ICONV],
|
||||
[
|
||||
dnl Some systems have iconv in libc, some have it in libiconv (OSF/1 and
|
||||
dnl those with the standalone portable GNU libiconv installed).
|
||||
|
||||
AC_ARG_WITH([libiconv-prefix],
|
||||
[ --with-libiconv-prefix=DIR Search for libiconv in DIR/include and DIR/lib], [
|
||||
for dir in `echo "$withval" | tr : ' '`; do
|
||||
if test -d $dir/include; then CPPFLAGS="$CPPFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/include; then CFLAGS="$CFLAGS -I$dir/include"; fi
|
||||
if test -d $dir/lib; then LDFLAGS="$LDFLAGS -L$dir/lib"; fi
|
||||
done
|
||||
])
|
||||
|
||||
AC_CACHE_CHECK(for iconv, am_cv_func_iconv, [
|
||||
am_cv_func_iconv="no, consider installing GNU libiconv"
|
||||
am_cv_lib_iconv=no
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_func_iconv=yes)
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
LIBS="$LIBS -liconv"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes)
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
dnl trying /usr/local
|
||||
if test "$am_cv_func_iconv" != yes; then
|
||||
am_save_LIBS="$LIBS"
|
||||
am_save_CFLAGS="$CFLAGS"
|
||||
am_save_LDFLAGS="$LDFLAGS"
|
||||
LIBS="$LIBS -liconv"
|
||||
LDFLAGS="$LDFLAGS -L/usr/local/lib"
|
||||
CFLAGS="$CFLAGS -I/usr/local/include"
|
||||
AC_TRY_LINK([#include <stdlib.h>
|
||||
#include <iconv.h>],
|
||||
[iconv_t cd = iconv_open("","");
|
||||
iconv(cd,NULL,NULL,NULL,NULL);
|
||||
iconv_close(cd);],
|
||||
am_cv_lib_iconv=yes
|
||||
am_cv_func_iconv=yes
|
||||
CPPFLAGS="$CPPFLAGS -I/usr/local/include",
|
||||
LDFLAGS="$am_save_LDFLAGS"
|
||||
CFLAGS="$am_save_CFLAGS")
|
||||
LIBS="$am_save_LIBS"
|
||||
fi
|
||||
|
||||
])
|
||||
if test "$am_cv_func_iconv" = yes; then
|
||||
AC_DEFINE(HAVE_ICONV, 1, [Define if you have the iconv() function.])
|
||||
AC_MSG_CHECKING([for iconv declaration])
|
||||
AC_CACHE_VAL(am_cv_proto_iconv, [
|
||||
AC_TRY_COMPILE([
|
||||
#include <stdlib.h>
|
||||
#include <iconv.h>
|
||||
extern
|
||||
#ifdef __cplusplus
|
||||
"C"
|
||||
#endif
|
||||
#if defined(__STDC__) || defined(__cplusplus)
|
||||
size_t iconv (iconv_t cd, char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);
|
||||
#else
|
||||
size_t iconv();
|
||||
#endif
|
||||
], [], am_cv_proto_iconv_arg1="", am_cv_proto_iconv_arg1="const")
|
||||
am_cv_proto_iconv="extern size_t iconv (iconv_t cd, $am_cv_proto_iconv_arg1 char * *inbuf, size_t *inbytesleft, char * *outbuf, size_t *outbytesleft);"])
|
||||
am_cv_proto_iconv=`echo "[$]am_cv_proto_iconv" | tr -s ' ' | sed -e 's/( /(/'`
|
||||
AC_MSG_RESULT([$]{ac_t:-
|
||||
}[$]am_cv_proto_iconv)
|
||||
AC_DEFINE_UNQUOTED(ICONV_CONST, $am_cv_proto_iconv_arg1,
|
||||
[Define as const if the declaration of iconv() needs const.])
|
||||
fi
|
||||
LIBICONV=
|
||||
if test "$am_cv_lib_iconv" = yes; then
|
||||
LIBICONV="-liconv"
|
||||
fi
|
||||
AC_SUBST(LIBICONV)
|
||||
])
|
4508
src/configure
vendored
4508
src/configure
vendored
File diff suppressed because it is too large
Load Diff
39
src/configure.ac
Normal file
39
src/configure.ac
Normal file
@ -0,0 +1,39 @@
|
||||
# -*- Autoconf -*-
|
||||
# Process this file with autoconf to produce a configure script.
|
||||
|
||||
AC_PREREQ(2.53)
|
||||
AC_INIT(FULL-PACKAGE-NAME, VERSION, BUG-REPORT-ADDRESS)
|
||||
|
||||
# Checks for programs.
|
||||
AC_PROG_CC
|
||||
AC_PROG_MAKE_SET
|
||||
|
||||
#locating erlang
|
||||
AM_WITH_ERLANG
|
||||
#locating iconv
|
||||
AM_ICONV
|
||||
#locating libexpat
|
||||
AM_WITH_EXPAT
|
||||
|
||||
|
||||
|
||||
|
||||
# Checks for typedefs, structures, and compiler characteristics.
|
||||
AC_C_CONST
|
||||
|
||||
# Checks for library functions.
|
||||
AC_FUNC_MALLOC
|
||||
AC_HEADER_STDC
|
||||
|
||||
|
||||
AC_MOD_ENABLE(mod_pubsub, yes)
|
||||
AC_MOD_ENABLE(mod_irc, yes)
|
||||
AC_MOD_ENABLE(mod_muc, yes)
|
||||
|
||||
|
||||
AC_CONFIG_FILES([Makefile
|
||||
$make_mod_irc
|
||||
$make_mod_muc
|
||||
$make_mod_pubsub
|
||||
stringprep/Makefile])
|
||||
AC_OUTPUT
|
@ -144,25 +144,32 @@ check_password(User, Password, StreamID, Digest) ->
|
||||
|
||||
|
||||
set_password(User, Password) ->
|
||||
LUser = jlib:nodeprep(User),
|
||||
F = fun() ->
|
||||
mnesia:write(#passwd{user = LUser, password = Password})
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
case jlib:nodeprep(User) of
|
||||
error -> {error, invalid_jid};
|
||||
LUser ->
|
||||
F = fun() ->
|
||||
mnesia:write(#passwd{user = LUser,
|
||||
password = Password})
|
||||
end,
|
||||
mnesia:transaction(F)
|
||||
end.
|
||||
|
||||
try_register(User, Password) ->
|
||||
LUser = jlib:nodeprep(User),
|
||||
F = fun() ->
|
||||
case mnesia:read({passwd, LUser}) of
|
||||
[] ->
|
||||
mnesia:write(#passwd{user = LUser,
|
||||
password = Password}),
|
||||
ok;
|
||||
[E] ->
|
||||
exists
|
||||
end
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
case jlib:nodeprep(User) of
|
||||
error -> {error, invalid_jid};
|
||||
LUser ->
|
||||
F = fun() ->
|
||||
case mnesia:read({passwd, LUser}) of
|
||||
[] ->
|
||||
mnesia:write(#passwd{user = LUser,
|
||||
password = Password}),
|
||||
ok;
|
||||
[E] ->
|
||||
exists
|
||||
end
|
||||
end,
|
||||
mnesia:transaction(F)
|
||||
end.
|
||||
|
||||
dirty_get_registered_users() ->
|
||||
mnesia:dirty_all_keys(passwd).
|
||||
|
@ -31,7 +31,7 @@
|
||||
-include("ejabberd.hrl").
|
||||
-include("jlib.hrl").
|
||||
|
||||
-record(state, {socket, pid,
|
||||
-record(state, {socket, pid, xml_stream_pid,
|
||||
user = "", server = ?MYNAME, resource = ""
|
||||
}).
|
||||
|
||||
@ -66,10 +66,14 @@ start(File, User) ->
|
||||
%% {stop, StopReason}
|
||||
%%----------------------------------------------------------------------
|
||||
init([File, User, Pid]) ->
|
||||
% Profiling
|
||||
%eprof:start(),
|
||||
%eprof:profile([self()]),
|
||||
XMLStreamPid = xml_stream:start(self()),
|
||||
{ok, Text} = file:read_file(File),
|
||||
xml_stream:send_text(XMLStreamPid, Text),
|
||||
{ok, wait_for_xdb, #state{user = User, pid = Pid}}.
|
||||
{ok, wait_for_xdb, #state{user = User, pid = Pid,
|
||||
xml_stream_pid = XMLStreamPid}}.
|
||||
|
||||
%%----------------------------------------------------------------------
|
||||
%% Func: StateName/2
|
||||
@ -145,7 +149,6 @@ xdb_data({xmlstreamend, Name}, StateData) ->
|
||||
{stop, normal, StateData};
|
||||
|
||||
xdb_data(closed, StateData) ->
|
||||
% TODO
|
||||
{stop, normal, StateData}.
|
||||
|
||||
|
||||
@ -203,7 +206,12 @@ handle_info(_, StateName, StateData) ->
|
||||
%% Returns: any
|
||||
%%----------------------------------------------------------------------
|
||||
terminate(Reason, StateName, StateData) ->
|
||||
exit(StateData#state.xml_stream_pid, closed),
|
||||
StateData#state.pid ! {jd2ejd, Reason},
|
||||
% Profiling
|
||||
%eprof:log("/tmp/eprof"),
|
||||
%eprof:analyse(),
|
||||
%eprof:stop(),
|
||||
ok.
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
@ -233,7 +241,7 @@ import_file(File) ->
|
||||
start(File),
|
||||
receive
|
||||
{jd2ejd, Result} -> Result
|
||||
after 4000 -> timeout
|
||||
%after 4000 -> timeout
|
||||
end.
|
||||
|
||||
clear_queue() ->
|
||||
|
@ -1,12 +1,16 @@
|
||||
# $Id$
|
||||
|
||||
include ../Makefile.inc
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INCLUDES = -I$(ERLANG_DIR)/usr/include \
|
||||
-I$(EI_DIR)/include \
|
||||
-I/usr/local/include
|
||||
INCLUDES = @ERLANG_CFLAGS@
|
||||
|
||||
LIBDIRS = -L$(EI_DIR)/lib -L/usr/local/lib
|
||||
LIBDIRS = @ERLANG_LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
ERLSHLIBS = ../iconv_erl.so
|
||||
|
||||
@ -30,14 +34,14 @@ $(OUTDIR)/%.beam: %.erl
|
||||
# erl -s make all report "{outdir, \"..\"}" -noinput -s erlang halt
|
||||
|
||||
$(ERLSHLIBS): ../%.so: %.c
|
||||
gcc -Wall $(INCLUDES) $(LIBDIRS) \
|
||||
$(CC) -Wall $(INCLUDES) $(CFLAGS) $(LDFLAGS) $(LIBDIRS) \
|
||||
$(subst ../,,$(subst .so,.c,$@)) \
|
||||
-lerl_interface \
|
||||
-lerl_interface @LIBICONV@ \
|
||||
-lei \
|
||||
-o $@ -fpic -shared \
|
||||
|
||||
clean:
|
||||
rm -f *.beam
|
||||
rm -f $(OBJS) $(ERLSHLIBS)
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
@ -1,12 +1,16 @@
|
||||
# $Id$
|
||||
|
||||
include ../Makefile.inc
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INCLUDES = -I$(ERLANG_DIR)/usr/include \
|
||||
-I$(EI_DIR)/include \
|
||||
-I/usr/local/include
|
||||
INCLUDES = @ERLANG_CFLAGS@
|
||||
|
||||
LIBDIRS = -L$(EI_DIR)/lib -L/usr/local/lib
|
||||
LIBDIRS = @ERLANG_LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
OUTDIR = ..
|
||||
@ -22,7 +26,7 @@ $(OUTDIR)/%.beam: %.erl
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.beam
|
||||
rm -f $(OBJS)
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
@ -1,12 +1,16 @@
|
||||
# $Id$
|
||||
|
||||
include ../Makefile.inc
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INCLUDES = -I$(ERLANG_DIR)/usr/include \
|
||||
-I$(EI_DIR)/include \
|
||||
-I/usr/local/include
|
||||
INCLUDES = @ERLANG_CFLAGS@
|
||||
|
||||
LIBDIRS = -L$(EI_DIR)/lib -L/usr/local/lib
|
||||
LIBDIRS = @ERLANG_LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
|
||||
OUTDIR = ..
|
||||
@ -21,7 +25,7 @@ $(OUTDIR)/%.beam: %.erl
|
||||
|
||||
|
||||
clean:
|
||||
rm -f *.beam
|
||||
rm -f $(OBJS)
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
@ -486,21 +486,20 @@ remove_user(User) ->
|
||||
|
||||
set_items(User, SubEl) ->
|
||||
{xmlelement, Name, Attrs, Els} = SubEl,
|
||||
LUser = jlib:nodeprep(User),
|
||||
F = fun() ->
|
||||
lists:foreach(fun(El) -> process_item_set_t(User, El) end, Els)
|
||||
lists:foreach(fun(El) -> process_item_set_t(LUser, El) end, Els)
|
||||
end,
|
||||
mnesia:transaction(F).
|
||||
|
||||
process_item_set_t(User, {xmlelement, Name, Attrs, Els} = XItem) ->
|
||||
process_item_set_t(LUser, {xmlelement, Name, Attrs, Els} = XItem) ->
|
||||
JID1 = jlib:string_to_jid(xml:get_attr_s("jid", Attrs)),
|
||||
LUser = jlib:nodeprep(User),
|
||||
case JID1 of
|
||||
error ->
|
||||
ok;
|
||||
_ ->
|
||||
JID = {JID1#jid.user, JID1#jid.server, JID1#jid.resource},
|
||||
LJID = jlib:jid_tolower(JID),
|
||||
Res = mnesia:read({roster, {LUser, LJID}}),
|
||||
LJID = {JID1#jid.luser, JID1#jid.lserver, JID1#jid.lresource},
|
||||
Item = #roster{uj = {LUser, LJID},
|
||||
user = LUser,
|
||||
jid = JID},
|
||||
@ -513,7 +512,7 @@ process_item_set_t(User, {xmlelement, Name, Attrs, Els} = XItem) ->
|
||||
mnesia:write(Item2)
|
||||
end
|
||||
end;
|
||||
process_item_set_t(User, _) ->
|
||||
process_item_set_t(LUser, _) ->
|
||||
ok.
|
||||
|
||||
process_item_attrs_ws(Item, [{Attr, Val} | Attrs]) ->
|
||||
|
@ -1,12 +1,18 @@
|
||||
# $Id$
|
||||
|
||||
include ../Makefile.inc
|
||||
|
||||
INCLUDES = -I$(ERLANG_DIR)/usr/include \
|
||||
-I$(EI_DIR)/include \
|
||||
-I/usr/local/include
|
||||
CC = @CC@
|
||||
CFLAGS = @CFLAGS@
|
||||
CPPFLAGS = @CPPFLAGS@
|
||||
LDFLAGS = @LDFLAGS@
|
||||
LIBS = @LIBS@
|
||||
|
||||
INCLUDES = @ERLANG_CFLAGS@
|
||||
|
||||
LIBDIRS = @ERLANG_LIBS@
|
||||
|
||||
SUBDIRS =
|
||||
|
||||
LIBDIRS = -L$(EI_DIR)/lib -L/usr/local/lib
|
||||
|
||||
ERLSHLIBS = ../stringprep_drv.so
|
||||
|
||||
@ -35,7 +41,7 @@ $(ERLSHLIBS): ../%.so: %.c uni_data.c uni_norm.c
|
||||
-o $@ -fpic -shared \
|
||||
|
||||
clean:
|
||||
rm -f *.beam
|
||||
rm -f $(OBJS) $(ERLSHLIBS)
|
||||
|
||||
TAGS:
|
||||
etags *.erl
|
Loading…
Reference in New Issue
Block a user