ndl / mod_archive2

mod_archive2 is new ejabberd module implementing server-side instant messaging history support specified in XEP-136.
http://www.ndl.kiev.ua/content/modarchive2
27 stars 5 forks source link

How to compile mod_archive2 module #9

Open rahulgautam opened 10 years ago

rahulgautam commented 10 years ago

How to compile mod_archive2 module

Steps I done

$ cd to_mod_archive2_dir

$ erl -make

Recompile: src/xmpp_api_ejabberd
src/xmpp_api_ejabberd.erl:29: can't find include file "ejabberd.hrl"
src/xmpp_api_ejabberd.erl:30: can't find include lib "exmpp/include/exmpp.hrl"
src/xmpp_api_ejabberd.erl:43: undefined macro 'MYHOSTS'
src/xmpp_api_ejabberd.erl:46: undefined macro 'INFO_MSG/2'
src/xmpp_api_ejabberd.erl:49: undefined macro 'ERROR_MSG/2'
src/xmpp_api_ejabberd.erl:84: undefined macro 'NS_JABBER_CLIENT'
src/xmpp_api_ejabberd.erl:32: function error_msg/2 undefined
src/xmpp_api_ejabberd.erl:32: function get_valid_hosts/0 undefined
src/xmpp_api_ejabberd.erl:32: function info_msg/2 undefined
src/xmpp_api_ejabberd.erl:32: function iq_to_exmpp/1 undefined
src/xmpp_api_ejabberd.erl:60: record iq undefined
src/xmpp_api_ejabberd.erl:93: Warning: function iq_type_to_string/1 is unused
src/xmpp_api_ejabberd.erl:99: Warning: function iq_to_xml/1 is unused

Then I copied ejabberd.hrl from ejabberd/include to src of mod_archive

$ erl -make

Recompile: src/xmpp_api_ejabberd
src/xmpp_api_ejabberd.erl:30: can't find include lib "exmpp/include/exmpp.hrl"
src/xmpp_api_ejabberd.erl:46: undefined macro 'INFO_MSG/2'
src/xmpp_api_ejabberd.erl:49: undefined macro 'ERROR_MSG/2'
src/xmpp_api_ejabberd.erl:84: undefined macro 'NS_JABBER_CLIENT'
src/xmpp_api_ejabberd.erl:32: function error_msg/2 undefined
src/xmpp_api_ejabberd.erl:32: function info_msg/2 undefined
src/xmpp_api_ejabberd.erl:32: function iq_to_exmpp/1 undefined
src/xmpp_api_ejabberd.erl:60: record iq undefined
src/xmpp_api_ejabberd.erl:93: Warning: function iq_type_to_string/1 is unused
src/xmpp_api_ejabberd.erl:99: Warning: function iq_to_xml/1 is unused

Then I get the exmpp code from processsone/exmpp

Now I am having these error's

$ erl -make

Recompile: src/xmpp_api_ejabberd
src/xmpp_api_ejabberd.erl:46: undefined macro 'INFO_MSG/2'
src/xmpp_api_ejabberd.erl:49: undefined macro 'ERROR_MSG/2'
src/xmpp_api_ejabberd.erl:32: function error_msg/2 undefined
src/xmpp_api_ejabberd.erl:32: function info_msg/2 undefined

@ndl Please guide me, Thanks in advance

rahulgautam commented 10 years ago

@ndl It must be that I have not included module error_logger. I do not know how to do that.

For now I have commented the function export and call for info_msg and error_msg in src/xmpp_api_ejabberd.erl

Please let me know, how to do it right. I am complete newbie for erlang and all. Thanks

rahulgautam commented 10 years ago

@ndl after commenting logging function calls, I have the beam of mod_archive2, that I have successfully placed in ejabberd/ebin.

Now ejabberd server does not start.

Error

<0.37.0>@gen_mod:start_module:78 Problem starting the module mod_archive2 for host <<"127.0.0.1">> 
 options: [{rdbms,mysql},
           {time_accuracy,milliseconds},
           {default_auto_save,body},
           {only_in_roster,true},
           {force_utc,true},
           {enforce_default_auto_save,false},
           {default_expire,infinity},
           {enforce_min_expire,0},
           {enforce_max_expire,infinity},
           {replication_expire,31536000},
           {session_duration,1800},
           {wipeout_interval,86400},
           {prefs_cache_interval,1800}]
 error: badarg
[{erlang,list_to_atom,
         [[100,98,109,115,95,115,116,111,114,97,103,101,95|<<"127.0.0.1">>]],
         []},

Here is my_ejabberd.cfg

rahulgautam commented 10 years ago

@ndl this "100,98,109,115,95,115,116,111,114,97,103,101,95" converts to "dbmsstorage" is this some hard code string name that is used in code or just an erlang crash statement that says the function name.

ndl commented 10 years ago

You're likely missing all the supporting beams, including dbms_storage* ones. You should compile all .erl files in mod_archive2/src directory. Either use make.sh script in the mod_archive2 root directory (assumes ejabberd sources are side-by-side to mod_archive2) and get resulting beams from "ebin" directory or copy these sources to the ejabberd source directory and compile ejabberd "as normal".

rakesh-sharma commented 10 years ago

Hi @ndl,

Can we use mod_archive2 with ejabberd 13.12? Actually we are trying to plug mod_archive2 with ejabberd 13.12, but not able to. So just wanted to confirm if it's a compatible combination. If not can you please suggest what to use with ejabberd 13.12 to save the message to mysql db.

Any help is appreciated. Thanks.

pankajsoni19 commented 10 years ago

hi rakesh,

mod_archive2 was for ejabberd 3.0 in mind, as such is not compatible straight away with ejab 13.x.

you can try looking into mongooseim's mod_mam_archive, and try to import it into ejab.

jayeshjain24 commented 9 years ago

hi @softwarejoint :

I am using ejabberd 14.07.Can I use mod_archive2?I cant switch to Mongoose.