aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2009-06-16 17:46:08 +0000
committerBadlop <badlop@process-one.net>2009-06-16 17:46:08 +0000
commit261b7dc0d94d6de84a3a0a8b6694eb88730273d6 (patch)
tree849477f8f8c918a469e5cbf8703ad89e9a672ff3 /src
parentDo not overwrite the stanza namespace (thanks to Anastasia Gornostaeva) (diff)
Migration code for people using previous version of the HTTP binding module (EJAB-390)
SVN Revision: 2230
Diffstat (limited to 'src')
-rw-r--r--src/web/ejabberd_http_bind.erl24
-rw-r--r--src/web/mod_http_bind.erl2
2 files changed, 20 insertions, 6 deletions
diff --git a/src/web/ejabberd_http_bind.erl b/src/web/ejabberd_http_bind.erl
index e68ef8a8e..b0204c1cc 100644
--- a/src/web/ejabberd_http_bind.erl
+++ b/src/web/ejabberd_http_bind.erl
@@ -4,12 +4,12 @@
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
%%% HTTP Binding)
%%% 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).
-author('steve@zeank.in-berlin.de').
--vsn('$Rev: 408 $').
+-vsn('$Rev: 430 $ ').
-behaviour(gen_fsm).
@@ -88,9 +88,7 @@
%%% API
%%%----------------------------------------------------------------------
start(Sid, Key) ->
- mnesia:create_table(http_bind,
- [{ram_copies, [node()]},
- {attributes, record_info(fields, http_bind)}]),
+ setup_database(),
supervisor:start_child(ejabberd_http_bind_sup, [Sid, Key]).
start_link(Sid, Key) ->
@@ -923,3 +921,19 @@ check_default_xmlns({xmlelement, Name, Attrs, Els} = El) ->
true ->
El
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.
diff --git a/src/web/mod_http_bind.erl b/src/web/mod_http_bind.erl
index 1dba7d193..edd9fa08c 100644
--- a/src/web/mod_http_bind.erl
+++ b/src/web/mod_http_bind.erl
@@ -3,7 +3,7 @@
%%% Author : Stefan Strigler <steve@zeank.in-berlin.de>
%%% Purpose : Implementation of XMPP over BOSH (XEP-0206)
%%% 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 $
%%%----------------------------------------------------------------------
%%%----------------------------------------------------------------------