25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-24 16:23:40 +01:00

Migration code for people using previous version of the HTTP binding module (EJAB-390)

SVN Revision: 2230
This commit is contained in:
Badlop 2009-06-16 17:46:08 +00:00
parent b42dd00a53
commit 261b7dc0d9
2 changed files with 20 additions and 6 deletions

View File

@ -4,12 +4,12 @@
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as %%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
%%% HTTP Binding) %%% HTTP Binding)
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de> %%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
%%% Id : $Id: ejabberd_http_bind.erl 408 2007-11-08 15:48:24Z badlop $ %%% Id : $Id: ejabberd_http_bind.erl 430 2007-11-27 22:03:44Z badlop $
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
-module(ejabberd_http_bind). -module(ejabberd_http_bind).
-author('steve@zeank.in-berlin.de'). -author('steve@zeank.in-berlin.de').
-vsn('$Rev: 408 $'). -vsn('$Rev: 430 $ ').
-behaviour(gen_fsm). -behaviour(gen_fsm).
@ -88,9 +88,7 @@
%%% API %%% API
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
start(Sid, Key) -> start(Sid, Key) ->
mnesia:create_table(http_bind, setup_database(),
[{ram_copies, [node()]},
{attributes, record_info(fields, http_bind)}]),
supervisor:start_child(ejabberd_http_bind_sup, [Sid, Key]). supervisor:start_child(ejabberd_http_bind_sup, [Sid, Key]).
start_link(Sid, Key) -> start_link(Sid, Key) ->
@ -923,3 +921,19 @@ check_default_xmlns({xmlelement, Name, Attrs, Els} = El) ->
true -> true ->
El El
end. end.
setup_database() ->
migrate_database(),
mnesia:create_table(http_bind,
[{ram_copies, [node()]},
{attributes, record_info(fields, http_bind)}]).
migrate_database() ->
case mnesia:table_info(http_bind, attributes) of
[id, pid, to, hold, wait, version] ->
ok;
_ ->
%% Since the stored information is not important, instead
%% of actually migrating data, let's just destroy the table
mnesia:delete_table(http_bind)
end.

View File

@ -3,7 +3,7 @@
%%% Author : Stefan Strigler <steve@zeank.in-berlin.de> %%% Author : Stefan Strigler <steve@zeank.in-berlin.de>
%%% Purpose : Implementation of XMPP over BOSH (XEP-0206) %%% Purpose : Implementation of XMPP over BOSH (XEP-0206)
%%% Created : Tue Feb 20 13:15:52 CET 2007 %%% Created : Tue Feb 20 13:15:52 CET 2007
%%% Id : $Id: mod_http_bind.erl 156 2007-06-25 09:22:57Z cromain $ %%% Id : $Id: mod_http_bind.erl 412 2007-11-15 10:10:09Z mremond $
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------