diff options
author | Marvin W <git@larma.de> | 2017-04-03 15:09:30 +0200 |
---|---|---|
committer | Marvin W <git@larma.de> | 2017-04-03 15:09:30 +0200 |
commit | 2a49d4a1aaf1d1fb644d3e4586989c696f657bcc (patch) | |
tree | c24ad367f659ba464d6130bbd3edf47483d52ce3 /libdino/src | |
parent | 8248cfcbb25dc14c81bd9673c8b3642ce98ea495 (diff) | |
download | dino-2a49d4a1aaf1d1fb644d3e4586989c696f657bcc.tar.gz dino-2a49d4a1aaf1d1fb644d3e4586989c696f657bcc.zip |
Add --print-xmpp flag to log details
Diffstat (limited to 'libdino/src')
-rw-r--r-- | libdino/src/application.vala | 14 | ||||
-rw-r--r-- | libdino/src/service/connection_manager.vala | 3 |
2 files changed, 11 insertions, 6 deletions
diff --git a/libdino/src/application.vala b/libdino/src/application.vala index 99cef929..b28bb69b 100644 --- a/libdino/src/application.vala +++ b/libdino/src/application.vala @@ -8,16 +8,18 @@ public class Dino.Application : Gtk.Application { public StreamInteractor stream_interaction; public Plugins.Registry plugin_registry = new Plugins.Registry(); + static string print_xmpp; + + private const OptionEntry[] options = { + { "print-xmpp", 0, 0, OptionArg.STRING, ref print_xmpp, "Print XMPP stanzas identified by DESC to stderr", "DESC" }, + { null } + }; + public Application() throws Error { if (DirUtils.create_with_parents(get_storage_dir(), 0700) == -1) { throw new Error(-1, 0, "Could not create storage dir \"%s\": %s", get_storage_dir(), FileUtils.error_from_errno(errno).to_string()); } - // FIXME: Legacy import - if (FileUtils.test("store.sqlite3", FileTest.IS_REGULAR)) { - FileUtils.rename("store.sqlite3", Path.build_filename(get_storage_dir(), "dino.db")); - } - this.db = new Database(Path.build_filename(get_storage_dir(), "dino.db")); this.stream_interaction = new StreamInteractor(db); @@ -31,8 +33,10 @@ public class Dino.Application : Gtk.Application { ChatInteraction.start(stream_interaction); activate.connect(() => { + stream_interaction.connection_manager.log_options = print_xmpp; restore(); }); + add_main_option_entries(options); } public static string get_storage_dir() { diff --git a/libdino/src/service/connection_manager.vala b/libdino/src/service/connection_manager.vala index 17e31c01..9d069efa 100644 --- a/libdino/src/service/connection_manager.vala +++ b/libdino/src/service/connection_manager.vala @@ -21,6 +21,7 @@ public class ConnectionManager { private NetworkManager? network_manager; private Login1Manager? login1; private ModuleManager module_manager; + public string? log_options; private class Connection { public Core.XmppStream stream { get; set; } @@ -92,7 +93,7 @@ public class ConnectionManager { foreach (Core.XmppStreamModule module in module_manager.get_modules(account, resource)) { stream.add_module(module); } - stream.debug = false; + stream.log = new Core.XmppLog(account.bare_jid.to_string(), log_options); Connection connection = new Connection(stream, new DateTime.now_local()); stream_states[account] = connection; |