aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libdino/src/entity/jid.vala4
-rw-r--r--libdino/src/service/database.vala17
-rw-r--r--libdino/src/service/roster_manager.vala8
-rw-r--r--main/src/ui/add_conversation/conference/dialog.vala8
-rw-r--r--main/src/ui/conversation_summary/conversation_item.vala2
-rw-r--r--plugins/omemo/src/database.vala9
-rw-r--r--plugins/openpgp/src/database.vala4
-rw-r--r--qlite/src/column.vala14
-rw-r--r--qlite/src/database.vala4
-rw-r--r--qlite/src/delete_builder.vala4
-rw-r--r--qlite/src/insert_builder.vala4
-rw-r--r--qlite/src/query_builder.vala4
-rw-r--r--qlite/src/row.vala2
-rw-r--r--qlite/src/statement_builder.vala16
-rw-r--r--qlite/src/update_builder.vala4
-rw-r--r--xmpp-vala/src/module/xep/0084_user_avatars.vala4
16 files changed, 53 insertions, 55 deletions
diff --git a/libdino/src/entity/jid.vala b/libdino/src/entity/jid.vala
index f1da0c00..96948ca4 100644
--- a/libdino/src/entity/jid.vala
+++ b/libdino/src/entity/jid.vala
@@ -14,12 +14,12 @@ public class Dino.Entities.Jid : Object {
string? localpart = parsed != null ? parsed.localpart : null;
string domainpart = parsed != null ? parsed.domainpart : jid;
string? resourcepart = parsed != null ? parsed.resourcepart : null;
- Jid.components(localpart, domainpart, resourcepart);
+ this.components(localpart, domainpart, resourcepart);
}
public Jid.with_resource(string bare_jid, string resource) {
Jid? parsed = Jid.parse(bare_jid);
- Jid.components(parsed.localpart, parsed.domainpart, resourcepart);
+ this.components(parsed.localpart, parsed.domainpart, resourcepart);
}
public Jid.components(string? localpart, string domainpart, string? resourcepart) {
diff --git a/libdino/src/service/database.vala b/libdino/src/service/database.vala
index f631ff1f..202a0930 100644
--- a/libdino/src/service/database.vala
+++ b/libdino/src/service/database.vala
@@ -1,5 +1,4 @@
using Gee;
-using Sqlite;
using Qlite;
using Dino.Entities;
@@ -17,7 +16,7 @@ public class Database : Qlite.Database {
public Column<string> alias = new Column.Text("alias");
public Column<bool> enabled = new Column.BoolInt("enabled");
- protected AccountTable(Database db) {
+ internal AccountTable(Database db) {
base(db, "account");
init({id, bare_jid, resourcepart, password, alias, enabled});
}
@@ -27,7 +26,7 @@ public class Database : Qlite.Database {
public Column<int> id = new Column.Integer("id") { primary_key = true, auto_increment = true };
public Column<string> bare_jid = new Column.Text("bare_jid") { unique = true, not_null = true };
- protected JidTable(Database db) {
+ internal JidTable(Database db) {
base(db, "jid");
init({id, bare_jid});
}
@@ -48,7 +47,7 @@ public class Database : Qlite.Database {
public Column<int> encryption = new Column.Integer("encryption");
public Column<int> marked = new Column.Integer("marked");
- protected MessageTable(Database db) {
+ internal MessageTable(Database db) {
base(db, "message");
init({id, stanza_id, account_id, counterpart_id, our_resource, counterpart_resource, direction,
type_, time, local_time, body, encryption, marked});
@@ -59,7 +58,7 @@ public class Database : Qlite.Database {
public Column<int> message_id = new Column.Integer("message_id") { primary_key = true };
public Column<string> real_jid = new Column.Text("real_jid");
- protected RealJidTable(Database db) {
+ internal RealJidTable(Database db) {
base(db, "real_jid");
init({message_id, real_jid});
}
@@ -70,7 +69,7 @@ public class Database : Qlite.Database {
public Column<int> type_ = new Column.Integer("type");
public Column<string> data = new Column.Text("data");
- protected UndecryptedTable(Database db) {
+ internal UndecryptedTable(Database db) {
base(db, "undecrypted");
init({message_id, type_, data});
}
@@ -86,7 +85,7 @@ public class Database : Qlite.Database {
public Column<int> encryption = new Column.Integer("encryption");
public Column<int> read_up_to = new Column.Integer("read_up_to");
- protected ConversationTable(Database db) {
+ internal ConversationTable(Database db) {
base(db, "conversation");
init({id, account_id, jid_id, active, last_active, type_, encryption, read_up_to});
}
@@ -97,7 +96,7 @@ public class Database : Qlite.Database {
public Column<string> hash = new Column.Text("hash");
public Column<int> type_ = new Column.Integer("type");
- protected AvatarTable(Database db) {
+ internal AvatarTable(Database db) {
base(db, "avatar");
init({jid, hash, type_});
}
@@ -107,7 +106,7 @@ public class Database : Qlite.Database {
public Column<string> entity = new Column.Text("entity");
public Column<string> feature = new Column.Text("feature");
- protected EntityFeatureTable(Database db) {
+ internal EntityFeatureTable(Database db) {
base(db, "entity_feature");
init({entity, feature});
}
diff --git a/libdino/src/service/roster_manager.vala b/libdino/src/service/roster_manager.vala
index 86bd7a21..bb9fbd3a 100644
--- a/libdino/src/service/roster_manager.vala
+++ b/libdino/src/service/roster_manager.vala
@@ -35,10 +35,10 @@ public class RosterManager : StreamInteractionModule, Object {
public Roster.Item? get_roster_item(Account account, Jid jid) {
Core.XmppStream? stream = stream_interactor.get_stream(account);
- if (stream != null) {
- return stream.get_flag(Roster.Flag.IDENTITY).get_item(jid.bare_jid.to_string());
- }
- return null;
+ if (stream == null) return null;
+ Xmpp.Roster.Flag? flag = stream.get_flag(Xmpp.Roster.Flag.IDENTITY);
+ if (flag == null) return null;
+ return flag.get_item(jid.bare_jid.to_string());
}
public void remove_jid(Account account, Jid jid) {
diff --git a/main/src/ui/add_conversation/conference/dialog.vala b/main/src/ui/add_conversation/conference/dialog.vala
index d766a5a8..c035c11d 100644
--- a/main/src/ui/add_conversation/conference/dialog.vala
+++ b/main/src/ui/add_conversation/conference/dialog.vala
@@ -41,7 +41,7 @@ public class Dialog : Gtk.Dialog {
if (cancel_image.get_parent() != null) cancel_button.remove(cancel_image);
cancel_button.add(cancel_label);
cancel_button.clicked.disconnect(show_jid_add_view);
- cancel_button.clicked.connect(close);
+ cancel_button.clicked.connect(on_cancel);
ok_button.label = "Next";
ok_button.sensitive = select_fragment.done;
ok_button.clicked.disconnect(on_ok_button_clicked);
@@ -55,7 +55,7 @@ public class Dialog : Gtk.Dialog {
private void show_conference_details_view() {
if (cancel_label.get_parent() != null) cancel_button.remove(cancel_label);
cancel_button.add(cancel_image);
- cancel_button.clicked.disconnect(close);
+ cancel_button.clicked.disconnect(on_cancel);
cancel_button.clicked.connect(show_jid_add_view);
ok_button.label = "Join";
ok_button.sensitive = details_fragment.done;
@@ -143,8 +143,8 @@ public class Dialog : Gtk.Dialog {
close();
}
- private void close() {
- base.close();
+ private void on_cancel() {
+ close();
}
private void animate_window_resize() {
diff --git a/main/src/ui/conversation_summary/conversation_item.vala b/main/src/ui/conversation_summary/conversation_item.vala
index fa91f78e..a99025ab 100644
--- a/main/src/ui/conversation_summary/conversation_item.vala
+++ b/main/src/ui/conversation_summary/conversation_item.vala
@@ -25,7 +25,7 @@ public interface ConversationItem : Gtk.Widget {
case MessageKind.ME_COMMAND:
return new SlashMeItem(stream_interactor, conversation, message);
}
- return null;
+ assert_not_reached();
}
}
diff --git a/plugins/omemo/src/database.vala b/plugins/omemo/src/database.vala
index db530c69..8d69ca15 100644
--- a/plugins/omemo/src/database.vala
+++ b/plugins/omemo/src/database.vala
@@ -1,5 +1,4 @@
using Gee;
-using Sqlite;
using Qlite;
using Dino.Entities;
@@ -16,7 +15,7 @@ public class Database : Qlite.Database {
public Column<string> identity_key_private_base64 = new Column.Text("identity_key_private_base64") { not_null = true };
public Column<string> identity_key_public_base64 = new Column.Text("identity_key_public_base64") { not_null = true };
- protected IdentityTable(Database db) {
+ internal IdentityTable(Database db) {
base(db, "identity");
init({id, account_id, device_id, identity_key_private_base64, identity_key_public_base64});
}
@@ -27,7 +26,7 @@ public class Database : Qlite.Database {
public Column<int> signed_pre_key_id = new Column.Integer("signed_pre_key_id") { not_null = true };
public Column<string> record_base64 = new Column.Text("record_base64") { not_null = true };
- protected SignedPreKeyTable(Database db) {
+ internal SignedPreKeyTable(Database db) {
base(db, "signed_pre_key");
init({identity_id, signed_pre_key_id, record_base64});
unique({identity_id, signed_pre_key_id});
@@ -39,7 +38,7 @@ public class Database : Qlite.Database {
public Column<int> pre_key_id = new Column.Integer("pre_key_id") { not_null = true };
public Column<string> record_base64 = new Column.Text("record_base64") { not_null = true };
- protected PreKeyTable(Database db) {
+ internal PreKeyTable(Database db) {
base(db, "pre_key");
init({identity_id, pre_key_id, record_base64});
unique({identity_id, pre_key_id});
@@ -52,7 +51,7 @@ public class Database : Qlite.Database {
public Column<int> device_id = new Column.Integer("device_id") { not_null = true };
public Column<string> record_base64 = new Column.Text("record_base64") { not_null = true };
- protected SessionTable(Database db) {
+ internal SessionTable(Database db) {
base(db, "session");
init({identity_id, address_name, device_id, record_base64});
unique({identity_id, address_name, device_id});
diff --git a/plugins/openpgp/src/database.vala b/plugins/openpgp/src/database.vala
index ac80f79a..7d41db3c 100644
--- a/plugins/openpgp/src/database.vala
+++ b/plugins/openpgp/src/database.vala
@@ -11,7 +11,7 @@ public class Database : Qlite.Database {
public Column<int> account_id = new Column.Integer("account_id") { primary_key = true };
public Column<string> key = new Column.Text("key") { not_null = true };
- protected AccountSetting(Database db) {
+ internal AccountSetting(Database db) {
base(db, "account_setting");
init({account_id, key});
}
@@ -21,7 +21,7 @@ public class Database : Qlite.Database {
public Column<string> jid = new Column.Text("jid") { primary_key = true };
public Column<string> key = new Column.Text("key") { not_null = true };
- protected ContactKey(Database db) {
+ internal ContactKey(Database db) {
base(db, "contact_key");
init({jid, key});
}
diff --git a/qlite/src/column.vala b/qlite/src/column.vala
index 105b4bbb..048446fb 100644
--- a/qlite/src/column.vala
+++ b/qlite/src/column.vala
@@ -19,7 +19,7 @@ public abstract class Column<T> {
return false;
}
- public abstract void bind(Statement stmt, int index, T value);
+ internal abstract void bind(Statement stmt, int index, T value);
public string to_string() {
string res = name;
@@ -66,7 +66,7 @@ public abstract class Column<T> {
return !row.has_integer(name);
}
- public override void bind(Statement stmt, int index, int value) {
+ internal override void bind(Statement stmt, int index, int value) {
stmt.bind_int(index, value);
}
}
@@ -84,7 +84,7 @@ public abstract class Column<T> {
return !row.has_integer(name);
}
- public override void bind(Statement stmt, int index, long value) {
+ internal override void bind(Statement stmt, int index, long value) {
stmt.bind_int64(index, value);
}
}
@@ -102,7 +102,7 @@ public abstract class Column<T> {
return !row.has_real(name);
}
- public override void bind(Statement stmt, int index, double value) {
+ internal override void bind(Statement stmt, int index, double value) {
stmt.bind_double(index, value);
}
}
@@ -120,7 +120,7 @@ public abstract class Column<T> {
return get(row) == null;
}
- public override void bind(Statement stmt, int index, string? value) {
+ internal override void bind(Statement stmt, int index, string? value) {
if (value != null) {
stmt.bind_text(index, value);
} else {
@@ -138,7 +138,7 @@ public abstract class Column<T> {
return row.get_text(name) == "1";
}
- public override void bind(Statement stmt, int index, bool value) {
+ internal override void bind(Statement stmt, int index, bool value) {
stmt.bind_text(index, value ? "1" : "0");
}
}
@@ -152,7 +152,7 @@ public abstract class Column<T> {
return row.get_integer(name) == 1;
}
- public override void bind(Statement stmt, int index, bool value) {
+ internal override void bind(Statement stmt, int index, bool value) {
stmt.bind_int(index, value ? 1 : 0);
}
}
diff --git a/qlite/src/database.vala b/qlite/src/database.vala
index 9fea7708..89eda204 100644
--- a/qlite/src/database.vala
+++ b/qlite/src/database.vala
@@ -126,7 +126,7 @@ public class Database {
return new RowIterator(this, sql, args);
}
- public Statement prepare(string sql) throws DatabaseError {
+ internal Statement prepare(string sql) throws DatabaseError {
ensure_init();
if (debug) print(@"prepare: $sql\n");
Sqlite.Statement statement;
@@ -136,7 +136,7 @@ public class Database {
return statement;
}
- public void exec(string sql) throws DatabaseError {
+ internal void exec(string sql) throws DatabaseError {
ensure_init();
if (db.exec(sql) != OK) {
throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
diff --git a/qlite/src/delete_builder.vala b/qlite/src/delete_builder.vala
index 679c8284..8e4afb06 100644
--- a/qlite/src/delete_builder.vala
+++ b/qlite/src/delete_builder.vala
@@ -12,7 +12,7 @@ public class DeleteBuilder : StatementBuilder {
private string selection;
private StatementBuilder.Field[] selection_args;
- protected DeleteBuilder(Database db) {
+ internal DeleteBuilder(Database db) {
base(db);
}
@@ -56,7 +56,7 @@ public class DeleteBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
Statement stmt = db.prepare(@"DELETE FROM $table_name $(selection != null ? @"WHERE $selection": "")");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
diff --git a/qlite/src/insert_builder.vala b/qlite/src/insert_builder.vala
index c1c17123..51030294 100644
--- a/qlite/src/insert_builder.vala
+++ b/qlite/src/insert_builder.vala
@@ -15,7 +15,7 @@ public class InsertBuilder : StatementBuilder {
// VALUES [...]
private StatementBuilder.Field[] fields;
- protected InsertBuilder(Database db) {
+ internal InsertBuilder(Database db) {
base(db);
}
@@ -69,7 +69,7 @@ public class InsertBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
string fields_text = "";
string value_qs = "";
for (int i = 0; i < fields.length; i++) {
diff --git a/qlite/src/query_builder.vala b/qlite/src/query_builder.vala
index 7259eddf..06232fc1 100644
--- a/qlite/src/query_builder.vala
+++ b/qlite/src/query_builder.vala
@@ -23,7 +23,7 @@ public class QueryBuilder : StatementBuilder {
// LIMIT [...]
private int limit_val;
- protected QueryBuilder(Database db) {
+ internal QueryBuilder(Database db) {
base(db);
}
@@ -147,7 +147,7 @@ public class QueryBuilder : StatementBuilder {
return row()[field];
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
Statement stmt = db.prepare(@"SELECT $column_selector FROM $table_name $(selection != null ? @"WHERE $selection" : "") $(order_by_terms != null ? OrderingTerm.all_to_string(order_by_terms) : "") $(limit_val > 0 ? @" LIMIT $limit_val" : "")");
for (int i = 0; i < selection_args.length; i++) {
selection_args[i].bind(stmt, i+1);
diff --git a/qlite/src/row.vala b/qlite/src/row.vala
index 60c7b666..96762be3 100644
--- a/qlite/src/row.vala
+++ b/qlite/src/row.vala
@@ -8,7 +8,7 @@ public class Row {
private Map<string, long> int_map = new HashMap<string, long>();
private Map<string, double?> real_map = new HashMap<string, double?>();
- public Row(Statement stmt) {
+ internal Row(Statement stmt) {
for (int i = 0; i < stmt.column_count(); i++) {
switch(stmt.column_type(i)) {
case TEXT:
diff --git a/qlite/src/statement_builder.vala b/qlite/src/statement_builder.vala
index e0055e87..11efb0de 100644
--- a/qlite/src/statement_builder.vala
+++ b/qlite/src/statement_builder.vala
@@ -5,13 +5,13 @@ namespace Qlite {
public abstract class StatementBuilder {
protected Database db;
- public StatementBuilder(Database db) {
+ internal StatementBuilder(Database db) {
this.db = db;
}
- public abstract Statement prepare() throws DatabaseError;
+ internal abstract Statement prepare() throws DatabaseError;
- protected class Field<T> {
+ internal class Field<T> {
public T value;
public Column<T>? column;
@@ -20,29 +20,29 @@ public abstract class StatementBuilder {
this.value = value;
}
- public virtual void bind(Statement stmt, int index) {
+ internal virtual void bind(Statement stmt, int index) {
if (column != null) {
column.bind(stmt, index, value);
}
}
}
- protected class NullField<T> : Field<T> {
+ internal class NullField<T> : Field<T> {
public NullField(Column<T>? column) {
base(column, null);
}
- public override void bind(Statement stmt, int index) {
+ internal override void bind(Statement stmt, int index) {
stmt.bind_null(index);
}
}
- protected class StringField : Field<string> {
+ internal class StringField : Field<string> {
public StringField(string value) {
base(null, value);
}
- public override void bind(Statement stmt, int index) {
+ internal override void bind(Statement stmt, int index) {
stmt.bind_text(index, value);
}
}
diff --git a/qlite/src/update_builder.vala b/qlite/src/update_builder.vala
index 41fd28b2..6aad2aa1 100644
--- a/qlite/src/update_builder.vala
+++ b/qlite/src/update_builder.vala
@@ -18,7 +18,7 @@ public class UpdateBuilder : StatementBuilder {
private string selection;
private StatementBuilder.Field[] selection_args;
- protected UpdateBuilder(Database db, Table table) {
+ internal UpdateBuilder(Database db, Table table) {
base(db);
this.table = table;
this.table_name = table.name;
@@ -101,7 +101,7 @@ public class UpdateBuilder : StatementBuilder {
return this;
}
- public override Statement prepare() throws DatabaseError {
+ internal override Statement prepare() throws DatabaseError {
string sql = "UPDATE";
if (or_val != null) sql += @" OR $or_val";
sql += @" $table_name SET ";
diff --git a/xmpp-vala/src/module/xep/0084_user_avatars.vala b/xmpp-vala/src/module/xep/0084_user_avatars.vala
index fec46675..f9bf057f 100644
--- a/xmpp-vala/src/module/xep/0084_user_avatars.vala
+++ b/xmpp-vala/src/module/xep/0084_user_avatars.vala
@@ -43,8 +43,8 @@ namespace Xmpp.Xep.UserAvatars {
public static void on_event_result(XmppStream stream, string jid, string id, StanzaNode node, Object? obj) {
PixbufStorage? storage = obj as PixbufStorage;
- StanzaNode info_node = node.get_subnode("info", NS_URI_METADATA);
- if (info_node.get_attribute("type") != "image/png") return;
+ StanzaNode? info_node = node.get_subnode("info", NS_URI_METADATA);
+ if (info_node == null || info_node.get_attribute("type") != "image/png") return;
if (storage.has_image(id)) {
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
} else {