From 6f6e4b97cba49469440fc0aefafb71623a3eabb9 Mon Sep 17 00:00:00 2001 From: fiaxh Date: Fri, 15 Mar 2019 20:56:19 +0100 Subject: Use glib log functions --- plugins/http-files/src/manager.vala | 2 +- plugins/omemo/CMakeLists.txt | 2 +- plugins/omemo/src/manager.vala | 10 +++++----- plugins/omemo/src/pre_key_store.vala | 2 +- plugins/omemo/src/session_store.vala | 2 +- plugins/omemo/src/signed_pre_key_store.vala | 2 +- plugins/omemo/src/stream_module.vala | 8 ++++---- plugins/omemo/src/trust_manager.vala | 4 ++-- plugins/openpgp/src/stream_module.vala | 2 +- 9 files changed, 17 insertions(+), 17 deletions(-) (limited to 'plugins') diff --git a/plugins/http-files/src/manager.vala b/plugins/http-files/src/manager.vala index 96490bb1..2f702be3 100644 --- a/plugins/http-files/src/manager.vala +++ b/plugins/http-files/src/manager.vala @@ -83,7 +83,7 @@ public class Manager : StreamInteractionModule, FileSender, Object { } }, (stream, error_str) => { - print(@"Failed getting upload url + $error_str\n"); + warning("Failed getting upload url: %s", error_str); file_transfer.state = FileTransfer.State.FAILED; } ); diff --git a/plugins/omemo/CMakeLists.txt b/plugins/omemo/CMakeLists.txt index 92d5cd51..fe6bb079 100644 --- a/plugins/omemo/CMakeLists.txt +++ b/plugins/omemo/CMakeLists.txt @@ -66,7 +66,7 @@ OPTIONS --vapidir=${CMAKE_CURRENT_SOURCE_DIR}/vapi ) -add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\") +add_definitions(${VALA_CFLAGS} -DGETTEXT_PACKAGE=\"${GETTEXT_PACKAGE}\" -DLOCALE_INSTALL_DIR=\"${LOCALE_INSTALL_DIR}\" -DG_LOG_DOMAIN="OMEMO") add_library(omemo SHARED ${OMEMO_VALA_C} ${OMEMO_GRESOURCES_TARGET}) add_dependencies(omemo ${GETTEXT_PACKAGE}-translations) target_link_libraries(omemo libdino signal-protocol-vala ${OMEMO_PACKAGES}) diff --git a/plugins/omemo/src/manager.vala b/plugins/omemo/src/manager.vala index d0df6c8e..db64c3ee 100644 --- a/plugins/omemo/src/manager.vala +++ b/plugins/omemo/src/manager.vala @@ -134,10 +134,10 @@ public class Manager : StreamInteractionModule, Object { //Encryption failed - need to fetch more information if (!state.will_send_now) { if (message.marked == Entities.Message.Marked.WONTSEND) { - if (Plugin.DEBUG) print(@"OMEMO: message was not sent: $state\n"); + debug("message was not sent: %s", state.to_string()); message_states.unset(message); } else { - if (Plugin.DEBUG) print(@"OMEMO: message will be delayed: $state\n"); + debug("message will be delayed: %s", state.to_string()); if (state.waiting_own_sessions > 0) { module.fetch_bundles((!)stream, conversation.account.bare_jid, trust_manager.get_trusted_devices(conversation.account, conversation.account.bare_jid)); @@ -175,7 +175,7 @@ public class Manager : StreamInteractionModule, Object { } private void on_device_list_loaded(Account account, Jid jid, ArrayList device_list) { - if (Plugin.DEBUG) print(@"OMEMO: received device list for $(account.bare_jid) from $jid\n"); + debug("received device list for %s from %s", account.bare_jid.to_string(), jid.to_string()); XmppStream? stream = stream_interactor.get_stream(account); if (stream == null) { @@ -199,7 +199,7 @@ public class Manager : StreamInteractionModule, Object { inc++; } if (inc > 0) { - if (Plugin.DEBUG) print(@"OMEMO: new bundles $inc/$(device_list.size) for $jid\n"); + debug("new bundles %i/%i for %s", inc, device_list.size, jid.to_string()); } //Create an entry for the jid in the account table if one does not exist already @@ -343,7 +343,7 @@ public class Manager : StreamInteractionModule, Object { store.pre_key_store = new BackedPreKeyStore(db, identity_id); store.session_store = new BackedSessionStore(db, identity_id); } else { - print(@"OMEMO: store for $(account.bare_jid) is not persisted!"); + warning("store for %s is not persisted!", account.bare_jid.to_string()); } // Generated new device ID, ensure this gets added to the devicelist diff --git a/plugins/omemo/src/pre_key_store.vala b/plugins/omemo/src/pre_key_store.vala index 93ec2dfe..716fd32f 100644 --- a/plugins/omemo/src/pre_key_store.vala +++ b/plugins/omemo/src/pre_key_store.vala @@ -19,7 +19,7 @@ private class BackedPreKeyStore : SimplePreKeyStore { store_pre_key(row[db.pre_key.pre_key_id], Base64.decode(row[db.pre_key.record_base64])); } } catch (Error e) { - print(@"OMEMO: Error while initializing pre key store: $(e.message)\n"); + warning("Error while initializing pre key store: %s", e.message); } pre_key_stored.connect(on_pre_key_stored); diff --git a/plugins/omemo/src/session_store.vala b/plugins/omemo/src/session_store.vala index 25b4d719..654591d1 100644 --- a/plugins/omemo/src/session_store.vala +++ b/plugins/omemo/src/session_store.vala @@ -21,7 +21,7 @@ private class BackedSessionStore : SimpleSessionStore { addr.device_id = 0; } } catch (Error e) { - print(@"OMEMO: Error while initializing session store: $(e.message)\n"); + print("Error while initializing session store: %s", e.message); } session_stored.connect(on_session_stored); diff --git a/plugins/omemo/src/signed_pre_key_store.vala b/plugins/omemo/src/signed_pre_key_store.vala index d96ded1f..8ff54a93 100644 --- a/plugins/omemo/src/signed_pre_key_store.vala +++ b/plugins/omemo/src/signed_pre_key_store.vala @@ -19,7 +19,7 @@ private class BackedSignedPreKeyStore : SimpleSignedPreKeyStore { store_signed_pre_key(row[db.signed_pre_key.signed_pre_key_id], Base64.decode(row[db.signed_pre_key.record_base64])); } } catch (Error e) { - print(@"OMEMO: Error while initializing signed pre key store: $(e.message)\n"); + print("Error while initializing signed pre key store: %s", e.message); } signed_pre_key_stored.connect(on_signed_pre_key_stored); diff --git a/plugins/omemo/src/stream_module.vala b/plugins/omemo/src/stream_module.vala index 6ee42771..30f8c04c 100644 --- a/plugins/omemo/src/stream_module.vala +++ b/plugins/omemo/src/stream_module.vala @@ -38,7 +38,7 @@ public class StreamModule : XmppStreamModule { public void request_user_devicelist(XmppStream stream, Jid jid) { if (active_devicelist_requests.add(jid)) { - if (Plugin.DEBUG) print(@"OMEMO: requesting device list for $jid\n"); + debug("requesting device list for %s", jid.to_string()); stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid, NODE_DEVICELIST, (stream, jid, id, node) => on_devicelist(stream, jid, id, node)); } } @@ -56,7 +56,7 @@ public class StreamModule : XmppStreamModule { } } if (!am_on_devicelist) { - if (Plugin.DEBUG) print(@"OMEMO: Not on device list, adding id\n"); + debug(@"Not on device list, adding id"); node.put_node(new StanzaNode.build("device", NS_URI).put_attribute("id", store.local_registration_id.to_string())); stream.get_module(Pubsub.Module.IDENTITY).publish(stream, jid, NODE_DEVICELIST, NODE_DEVICELIST, id, node); } @@ -90,7 +90,7 @@ public class StreamModule : XmppStreamModule { public void fetch_bundle(XmppStream stream, Jid jid, int device_id) { if (active_bundle_requests.add(jid.bare_jid.to_string() + @":$device_id")) { - if (Plugin.DEBUG) print(@"OMEMO: Asking for bundle from $(jid.bare_jid.to_string()):$device_id\n"); + debug(@"Asking for bundle from %s: %i", jid.bare_jid.to_string(), device_id); stream.get_module(Pubsub.Module.IDENTITY).request(stream, jid.bare_jid, @"$NODE_BUNDLES:$device_id", (stream, jid, id, node) => { on_other_bundle_result(stream, jid, device_id, id, node); }); @@ -233,7 +233,7 @@ public class StreamModule : XmppStreamModule { publish_bundles(stream, (!)signed_pre_key_record, identity_key_pair, pre_key_records, (int32) store.local_registration_id); } } catch (Error e) { - if (Plugin.DEBUG) print(@"Unexpected error while publishing bundle: $(e.message)\n"); + warning(@"Unexpected error while publishing bundle: $(e.message)\n"); } stream.get_module(IDENTITY).active_bundle_requests.remove(jid.bare_jid.to_string() + @":$(store.local_registration_id)"); } diff --git a/plugins/omemo/src/trust_manager.vala b/plugins/omemo/src/trust_manager.vala index 4ec141f0..d57adc35 100644 --- a/plugins/omemo/src/trust_manager.vala +++ b/plugins/omemo/src/trust_manager.vala @@ -159,7 +159,7 @@ public class TrustManager { message.body = "[This message is OMEMO encrypted]"; status.encrypted = true; } catch (Error e) { - if (Plugin.DEBUG) print(@"OMEMO: Signal error while encrypting message: $(e.message)\n"); + warning(@"Signal error while encrypting message: $(e.message)\n"); } return status; } @@ -327,7 +327,7 @@ public class TrustManager { break; } } catch (Error e) { - if (Plugin.DEBUG) print(@"OMEMO: Signal error while decrypting message: $(e.message)\n"); + warning(@"Signal error while decrypting message: $(e.message)\n"); } } } diff --git a/plugins/openpgp/src/stream_module.vala b/plugins/openpgp/src/stream_module.vala index f7c24b80..447ed5fd 100644 --- a/plugins/openpgp/src/stream_module.vala +++ b/plugins/openpgp/src/stream_module.vala @@ -24,7 +24,7 @@ namespace Dino.Plugins.OpenPgp { if (own_key_id != null) { try { own_key = GPGHelper.get_private_key(own_key_id); - if (own_key == null) print("PRIV KEY NULL\n"); + if (own_key == null) warning("Can't get PGP private key"); } catch (Error e) { } if (own_key != null) { signed_status = gpg_sign("", own_key); -- cgit v1.2.3-54-g00ecf