]> granicus.if.org Git - ejabberd/commitdiff
Migration code for people using previous version of the HTTP binding module (EJAB...
authorBadlop <badlop@process-one.net>
Tue, 16 Jun 2009 17:46:08 +0000 (17:46 +0000)
committerBadlop <badlop@process-one.net>
Tue, 16 Jun 2009 17:46:08 +0000 (17:46 +0000)
SVN Revision: 2230

src/web/ejabberd_http_bind.erl
src/web/mod_http_bind.erl

index e68ef8a8e44ff07de374176798bcd4c67e90e799..b0204c1ccecc0d7d86447a7b7a78ebea670be5a0 100644 (file)
@@ -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.
index 1dba7d193c61b34ea62dfca1c294705dca9a98f7..edd9fa08ce6044a133bb87032418ebb2139be9bb 100644 (file)
@@ -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 $
 %%%----------------------------------------------------------------------
 
 %%%----------------------------------------------------------------------