mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-26 16:26:24 +01:00
Revert buggy previous commit (thanks to W. Andrew Loe III), and add better fix
This commit is contained in:
parent
9cbf08700d
commit
20c4919eda
@ -306,26 +306,26 @@ init([Host, Opts]) ->
|
|||||||
{odbc_host, Host},
|
{odbc_host, Host},
|
||||||
{attributes, record_info(fields, muc_room_opt)},
|
{attributes, record_info(fields, muc_room_opt)},
|
||||||
{type, bag},
|
{type, bag},
|
||||||
{types, [{name_host, {text, text}},
|
{types, [{name_host, {binary, binary}},
|
||||||
{opt, atom}]}]),
|
{opt, atom}]}]),
|
||||||
gen_storage:create_table(Backend, MyHost, muc_room_affiliation,
|
gen_storage:create_table(Backend, MyHost, muc_room_affiliation,
|
||||||
[{disc_copies, [node()]},
|
[{disc_copies, [node()]},
|
||||||
{odbc_host, Host},
|
{odbc_host, Host},
|
||||||
{attributes, record_info(fields, muc_room_affiliation)},
|
{attributes, record_info(fields, muc_room_affiliation)},
|
||||||
{type, bag},
|
{type, bag},
|
||||||
{types, [{name_host, {text, text}},
|
{types, [{name_host, {binary, binary}},
|
||||||
{affiliation, atom},
|
{affiliation, atom},
|
||||||
{jid, jid}]}]),
|
{jid, jid}]}]),
|
||||||
gen_storage:create_table(Backend, MyHost, muc_registered,
|
gen_storage:create_table(Backend, MyHost, muc_registered,
|
||||||
[{disc_copies, [node()]},
|
[{disc_copies, [node()]},
|
||||||
{odbc_host, Host},
|
{odbc_host, Host},
|
||||||
{attributes, record_info(fields, muc_registered)},
|
{attributes, record_info(fields, muc_registered)},
|
||||||
{types, [{user_host, {jid, text}}]}]),
|
{types, [{user_host, {jid, text}}, {nick, binary}]}]),
|
||||||
gen_storage:create_table(Backend, MyHost, muc_online_room,
|
gen_storage:create_table(Backend, MyHost, muc_online_room,
|
||||||
[{ram_copies, [node()]},
|
[{ram_copies, [node()]},
|
||||||
{odbc_host, Host},
|
{odbc_host, Host},
|
||||||
{attributes, record_info(fields, muc_online_room)},
|
{attributes, record_info(fields, muc_online_room)},
|
||||||
{types, [{name_host, {text, text}},
|
{types, [{name_host, {binary, binary}},
|
||||||
{pid, pid}]}]),
|
{pid, pid}]}]),
|
||||||
%% If ejabberd stops abruptly, ODBC table keeps obsolete data. Let's clean:
|
%% If ejabberd stops abruptly, ODBC table keeps obsolete data. Let's clean:
|
||||||
gen_storage:dirty_delete_where(MyHost, muc_online_room,
|
gen_storage:dirty_delete_where(MyHost, muc_online_room,
|
||||||
|
@ -745,7 +745,7 @@ terminate({migrated, Clone}, _StateName, StateData) ->
|
|||||||
?INFO_MSG("Migrating room ~s@~s to ~p on node ~p",
|
?INFO_MSG("Migrating room ~s@~s to ~p on node ~p",
|
||||||
[StateData#state.room, StateData#state.host,
|
[StateData#state.room, StateData#state.host,
|
||||||
Clone, node(Clone)]),
|
Clone, node(Clone)]),
|
||||||
mod_muc:room_destroyed(StateData#state.host, list_to_binary(StateData#state.room),
|
mod_muc:room_destroyed(StateData#state.host, StateData#state.room,
|
||||||
self(), StateData#state.server_host),
|
self(), StateData#state.server_host),
|
||||||
ok;
|
ok;
|
||||||
terminate(Reason, _StateName, StateData) ->
|
terminate(Reason, _StateName, StateData) ->
|
||||||
@ -784,7 +784,7 @@ terminate(Reason, _StateName, StateData) ->
|
|||||||
tab_remove_online_user(LJID, StateData)
|
tab_remove_online_user(LJID, StateData)
|
||||||
end, [], StateData#state.users),
|
end, [], StateData#state.users),
|
||||||
add_to_log(room_existence, stopped, StateData),
|
add_to_log(room_existence, stopped, StateData),
|
||||||
mod_muc:room_destroyed(StateData#state.host, list_to_binary(StateData#state.room), self(),
|
mod_muc:room_destroyed(StateData#state.host, StateData#state.room, self(),
|
||||||
StateData#state.server_host),
|
StateData#state.server_host),
|
||||||
ok.
|
ok.
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
message,
|
message,
|
||||||
presence}).
|
presence}).
|
||||||
|
|
||||||
-record(state, {room, % string()
|
-record(state, {room, % binary()
|
||||||
host, % binary()
|
host, % binary()
|
||||||
server_host, % string()
|
server_host, % string()
|
||||||
access,
|
access,
|
||||||
|
Loading…
Reference in New Issue
Block a user