%%% 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).
%%% 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) ->
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.
%%% 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 $
%%%----------------------------------------------------------------------
%%%----------------------------------------------------------------------