Small bug fixes and compatibility with Vala 0.36
This commit is contained in:
parent
aca6842c49
commit
ef0483765a
|
@ -14,12 +14,12 @@ public class Dino.Entities.Jid : Object {
|
||||||
string? localpart = parsed != null ? parsed.localpart : null;
|
string? localpart = parsed != null ? parsed.localpart : null;
|
||||||
string domainpart = parsed != null ? parsed.domainpart : jid;
|
string domainpart = parsed != null ? parsed.domainpart : jid;
|
||||||
string? resourcepart = parsed != null ? parsed.resourcepart : null;
|
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) {
|
public Jid.with_resource(string bare_jid, string resource) {
|
||||||
Jid? parsed = Jid.parse(bare_jid);
|
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) {
|
public Jid.components(string? localpart, string domainpart, string? resourcepart) {
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Gee;
|
using Gee;
|
||||||
using Sqlite;
|
|
||||||
using Qlite;
|
using Qlite;
|
||||||
|
|
||||||
using Dino.Entities;
|
using Dino.Entities;
|
||||||
|
@ -17,7 +16,7 @@ public class Database : Qlite.Database {
|
||||||
public Column<string> alias = new Column.Text("alias");
|
public Column<string> alias = new Column.Text("alias");
|
||||||
public Column<bool> enabled = new Column.BoolInt("enabled");
|
public Column<bool> enabled = new Column.BoolInt("enabled");
|
||||||
|
|
||||||
protected AccountTable(Database db) {
|
internal AccountTable(Database db) {
|
||||||
base(db, "account");
|
base(db, "account");
|
||||||
init({id, bare_jid, resourcepart, password, alias, enabled});
|
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<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 };
|
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");
|
base(db, "jid");
|
||||||
init({id, bare_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> encryption = new Column.Integer("encryption");
|
||||||
public Column<int> marked = new Column.Integer("marked");
|
public Column<int> marked = new Column.Integer("marked");
|
||||||
|
|
||||||
protected MessageTable(Database db) {
|
internal MessageTable(Database db) {
|
||||||
base(db, "message");
|
base(db, "message");
|
||||||
init({id, stanza_id, account_id, counterpart_id, our_resource, counterpart_resource, direction,
|
init({id, stanza_id, account_id, counterpart_id, our_resource, counterpart_resource, direction,
|
||||||
type_, time, local_time, body, encryption, marked});
|
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<int> message_id = new Column.Integer("message_id") { primary_key = true };
|
||||||
public Column<string> real_jid = new Column.Text("real_jid");
|
public Column<string> real_jid = new Column.Text("real_jid");
|
||||||
|
|
||||||
protected RealJidTable(Database db) {
|
internal RealJidTable(Database db) {
|
||||||
base(db, "real_jid");
|
base(db, "real_jid");
|
||||||
init({message_id, 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<int> type_ = new Column.Integer("type");
|
||||||
public Column<string> data = new Column.Text("data");
|
public Column<string> data = new Column.Text("data");
|
||||||
|
|
||||||
protected UndecryptedTable(Database db) {
|
internal UndecryptedTable(Database db) {
|
||||||
base(db, "undecrypted");
|
base(db, "undecrypted");
|
||||||
init({message_id, type_, data});
|
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> encryption = new Column.Integer("encryption");
|
||||||
public Column<int> read_up_to = new Column.Integer("read_up_to");
|
public Column<int> read_up_to = new Column.Integer("read_up_to");
|
||||||
|
|
||||||
protected ConversationTable(Database db) {
|
internal ConversationTable(Database db) {
|
||||||
base(db, "conversation");
|
base(db, "conversation");
|
||||||
init({id, account_id, jid_id, active, last_active, type_, encryption, read_up_to});
|
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<string> hash = new Column.Text("hash");
|
||||||
public Column<int> type_ = new Column.Integer("type");
|
public Column<int> type_ = new Column.Integer("type");
|
||||||
|
|
||||||
protected AvatarTable(Database db) {
|
internal AvatarTable(Database db) {
|
||||||
base(db, "avatar");
|
base(db, "avatar");
|
||||||
init({jid, hash, type_});
|
init({jid, hash, type_});
|
||||||
}
|
}
|
||||||
|
@ -107,7 +106,7 @@ public class Database : Qlite.Database {
|
||||||
public Column<string> entity = new Column.Text("entity");
|
public Column<string> entity = new Column.Text("entity");
|
||||||
public Column<string> feature = new Column.Text("feature");
|
public Column<string> feature = new Column.Text("feature");
|
||||||
|
|
||||||
protected EntityFeatureTable(Database db) {
|
internal EntityFeatureTable(Database db) {
|
||||||
base(db, "entity_feature");
|
base(db, "entity_feature");
|
||||||
init({entity, feature});
|
init({entity, feature});
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,10 +35,10 @@ public class RosterManager : StreamInteractionModule, Object {
|
||||||
|
|
||||||
public Roster.Item? get_roster_item(Account account, Jid jid) {
|
public Roster.Item? get_roster_item(Account account, Jid jid) {
|
||||||
Core.XmppStream? stream = stream_interactor.get_stream(account);
|
Core.XmppStream? stream = stream_interactor.get_stream(account);
|
||||||
if (stream != null) {
|
if (stream == null) return null;
|
||||||
return stream.get_flag(Roster.Flag.IDENTITY).get_item(jid.bare_jid.to_string());
|
Xmpp.Roster.Flag? flag = stream.get_flag(Xmpp.Roster.Flag.IDENTITY);
|
||||||
}
|
if (flag == null) return null;
|
||||||
return null;
|
return flag.get_item(jid.bare_jid.to_string());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void remove_jid(Account account, Jid jid) {
|
public void remove_jid(Account account, Jid jid) {
|
||||||
|
|
|
@ -41,7 +41,7 @@ public class Dialog : Gtk.Dialog {
|
||||||
if (cancel_image.get_parent() != null) cancel_button.remove(cancel_image);
|
if (cancel_image.get_parent() != null) cancel_button.remove(cancel_image);
|
||||||
cancel_button.add(cancel_label);
|
cancel_button.add(cancel_label);
|
||||||
cancel_button.clicked.disconnect(show_jid_add_view);
|
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.label = "Next";
|
||||||
ok_button.sensitive = select_fragment.done;
|
ok_button.sensitive = select_fragment.done;
|
||||||
ok_button.clicked.disconnect(on_ok_button_clicked);
|
ok_button.clicked.disconnect(on_ok_button_clicked);
|
||||||
|
@ -55,7 +55,7 @@ public class Dialog : Gtk.Dialog {
|
||||||
private void show_conference_details_view() {
|
private void show_conference_details_view() {
|
||||||
if (cancel_label.get_parent() != null) cancel_button.remove(cancel_label);
|
if (cancel_label.get_parent() != null) cancel_button.remove(cancel_label);
|
||||||
cancel_button.add(cancel_image);
|
cancel_button.add(cancel_image);
|
||||||
cancel_button.clicked.disconnect(close);
|
cancel_button.clicked.disconnect(on_cancel);
|
||||||
cancel_button.clicked.connect(show_jid_add_view);
|
cancel_button.clicked.connect(show_jid_add_view);
|
||||||
ok_button.label = "Join";
|
ok_button.label = "Join";
|
||||||
ok_button.sensitive = details_fragment.done;
|
ok_button.sensitive = details_fragment.done;
|
||||||
|
@ -143,8 +143,8 @@ public class Dialog : Gtk.Dialog {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void close() {
|
private void on_cancel() {
|
||||||
base.close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void animate_window_resize() {
|
private void animate_window_resize() {
|
||||||
|
|
|
@ -25,7 +25,7 @@ public interface ConversationItem : Gtk.Widget {
|
||||||
case MessageKind.ME_COMMAND:
|
case MessageKind.ME_COMMAND:
|
||||||
return new SlashMeItem(stream_interactor, conversation, message);
|
return new SlashMeItem(stream_interactor, conversation, message);
|
||||||
}
|
}
|
||||||
return null;
|
assert_not_reached();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
using Gee;
|
using Gee;
|
||||||
using Sqlite;
|
|
||||||
using Qlite;
|
using Qlite;
|
||||||
|
|
||||||
using Dino.Entities;
|
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_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 };
|
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");
|
base(db, "identity");
|
||||||
init({id, account_id, device_id, identity_key_private_base64, identity_key_public_base64});
|
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<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 };
|
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");
|
base(db, "signed_pre_key");
|
||||||
init({identity_id, signed_pre_key_id, record_base64});
|
init({identity_id, signed_pre_key_id, record_base64});
|
||||||
unique({identity_id, signed_pre_key_id});
|
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<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 };
|
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");
|
base(db, "pre_key");
|
||||||
init({identity_id, pre_key_id, record_base64});
|
init({identity_id, pre_key_id, record_base64});
|
||||||
unique({identity_id, pre_key_id});
|
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<int> device_id = new Column.Integer("device_id") { not_null = true };
|
||||||
public Column<string> record_base64 = new Column.Text("record_base64") { 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");
|
base(db, "session");
|
||||||
init({identity_id, address_name, device_id, record_base64});
|
init({identity_id, address_name, device_id, record_base64});
|
||||||
unique({identity_id, address_name, device_id});
|
unique({identity_id, address_name, device_id});
|
||||||
|
|
|
@ -11,7 +11,7 @@ public class Database : Qlite.Database {
|
||||||
public Column<int> account_id = new Column.Integer("account_id") { primary_key = true };
|
public Column<int> account_id = new Column.Integer("account_id") { primary_key = true };
|
||||||
public Column<string> key = new Column.Text("key") { not_null = true };
|
public Column<string> key = new Column.Text("key") { not_null = true };
|
||||||
|
|
||||||
protected AccountSetting(Database db) {
|
internal AccountSetting(Database db) {
|
||||||
base(db, "account_setting");
|
base(db, "account_setting");
|
||||||
init({account_id, key});
|
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> jid = new Column.Text("jid") { primary_key = true };
|
||||||
public Column<string> key = new Column.Text("key") { not_null = true };
|
public Column<string> key = new Column.Text("key") { not_null = true };
|
||||||
|
|
||||||
protected ContactKey(Database db) {
|
internal ContactKey(Database db) {
|
||||||
base(db, "contact_key");
|
base(db, "contact_key");
|
||||||
init({jid, key});
|
init({jid, key});
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ public abstract class Column<T> {
|
||||||
return false;
|
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() {
|
public string to_string() {
|
||||||
string res = name;
|
string res = name;
|
||||||
|
@ -66,7 +66,7 @@ public abstract class Column<T> {
|
||||||
return !row.has_integer(name);
|
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);
|
stmt.bind_int(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ public abstract class Column<T> {
|
||||||
return !row.has_integer(name);
|
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);
|
stmt.bind_int64(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ public abstract class Column<T> {
|
||||||
return !row.has_real(name);
|
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);
|
stmt.bind_double(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -120,7 +120,7 @@ public abstract class Column<T> {
|
||||||
return get(row) == null;
|
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) {
|
if (value != null) {
|
||||||
stmt.bind_text(index, value);
|
stmt.bind_text(index, value);
|
||||||
} else {
|
} else {
|
||||||
|
@ -138,7 +138,7 @@ public abstract class Column<T> {
|
||||||
return row.get_text(name) == "1";
|
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");
|
stmt.bind_text(index, value ? "1" : "0");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -152,7 +152,7 @@ public abstract class Column<T> {
|
||||||
return row.get_integer(name) == 1;
|
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);
|
stmt.bind_int(index, value ? 1 : 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -126,7 +126,7 @@ public class Database {
|
||||||
return new RowIterator(this, sql, args);
|
return new RowIterator(this, sql, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Statement prepare(string sql) throws DatabaseError {
|
internal Statement prepare(string sql) throws DatabaseError {
|
||||||
ensure_init();
|
ensure_init();
|
||||||
if (debug) print(@"prepare: $sql\n");
|
if (debug) print(@"prepare: $sql\n");
|
||||||
Sqlite.Statement statement;
|
Sqlite.Statement statement;
|
||||||
|
@ -136,7 +136,7 @@ public class Database {
|
||||||
return statement;
|
return statement;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exec(string sql) throws DatabaseError {
|
internal void exec(string sql) throws DatabaseError {
|
||||||
ensure_init();
|
ensure_init();
|
||||||
if (db.exec(sql) != OK) {
|
if (db.exec(sql) != OK) {
|
||||||
throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
|
throw new DatabaseError.EXEC_ERROR(@"SQLite error: $(db.errcode()) - $(db.errmsg())");
|
||||||
|
|
|
@ -12,7 +12,7 @@ public class DeleteBuilder : StatementBuilder {
|
||||||
private string selection;
|
private string selection;
|
||||||
private StatementBuilder.Field[] selection_args;
|
private StatementBuilder.Field[] selection_args;
|
||||||
|
|
||||||
protected DeleteBuilder(Database db) {
|
internal DeleteBuilder(Database db) {
|
||||||
base(db);
|
base(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,7 @@ public class DeleteBuilder : StatementBuilder {
|
||||||
return this;
|
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": "")");
|
Statement stmt = db.prepare(@"DELETE FROM $table_name $(selection != null ? @"WHERE $selection": "")");
|
||||||
for (int i = 0; i < selection_args.length; i++) {
|
for (int i = 0; i < selection_args.length; i++) {
|
||||||
selection_args[i].bind(stmt, i+1);
|
selection_args[i].bind(stmt, i+1);
|
||||||
|
|
|
@ -15,7 +15,7 @@ public class InsertBuilder : StatementBuilder {
|
||||||
// VALUES [...]
|
// VALUES [...]
|
||||||
private StatementBuilder.Field[] fields;
|
private StatementBuilder.Field[] fields;
|
||||||
|
|
||||||
protected InsertBuilder(Database db) {
|
internal InsertBuilder(Database db) {
|
||||||
base(db);
|
base(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ public class InsertBuilder : StatementBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Statement prepare() throws DatabaseError {
|
internal override Statement prepare() throws DatabaseError {
|
||||||
string fields_text = "";
|
string fields_text = "";
|
||||||
string value_qs = "";
|
string value_qs = "";
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
|
|
|
@ -23,7 +23,7 @@ public class QueryBuilder : StatementBuilder {
|
||||||
// LIMIT [...]
|
// LIMIT [...]
|
||||||
private int limit_val;
|
private int limit_val;
|
||||||
|
|
||||||
protected QueryBuilder(Database db) {
|
internal QueryBuilder(Database db) {
|
||||||
base(db);
|
base(db);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ public class QueryBuilder : StatementBuilder {
|
||||||
return row()[field];
|
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" : "")");
|
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++) {
|
for (int i = 0; i < selection_args.length; i++) {
|
||||||
selection_args[i].bind(stmt, i+1);
|
selection_args[i].bind(stmt, i+1);
|
||||||
|
|
|
@ -8,7 +8,7 @@ public class Row {
|
||||||
private Map<string, long> int_map = new HashMap<string, long>();
|
private Map<string, long> int_map = new HashMap<string, long>();
|
||||||
private Map<string, double?> real_map = new HashMap<string, double?>();
|
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++) {
|
for (int i = 0; i < stmt.column_count(); i++) {
|
||||||
switch(stmt.column_type(i)) {
|
switch(stmt.column_type(i)) {
|
||||||
case TEXT:
|
case TEXT:
|
||||||
|
|
|
@ -5,13 +5,13 @@ namespace Qlite {
|
||||||
public abstract class StatementBuilder {
|
public abstract class StatementBuilder {
|
||||||
protected Database db;
|
protected Database db;
|
||||||
|
|
||||||
public StatementBuilder(Database db) {
|
internal StatementBuilder(Database db) {
|
||||||
this.db = 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 T value;
|
||||||
public Column<T>? column;
|
public Column<T>? column;
|
||||||
|
|
||||||
|
@ -20,29 +20,29 @@ public abstract class StatementBuilder {
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void bind(Statement stmt, int index) {
|
internal virtual void bind(Statement stmt, int index) {
|
||||||
if (column != null) {
|
if (column != null) {
|
||||||
column.bind(stmt, index, value);
|
column.bind(stmt, index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class NullField<T> : Field<T> {
|
internal class NullField<T> : Field<T> {
|
||||||
public NullField(Column<T>? column) {
|
public NullField(Column<T>? column) {
|
||||||
base(column, null);
|
base(column, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void bind(Statement stmt, int index) {
|
internal override void bind(Statement stmt, int index) {
|
||||||
stmt.bind_null(index);
|
stmt.bind_null(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected class StringField : Field<string> {
|
internal class StringField : Field<string> {
|
||||||
public StringField(string value) {
|
public StringField(string value) {
|
||||||
base(null, 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);
|
stmt.bind_text(index, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,7 +18,7 @@ public class UpdateBuilder : StatementBuilder {
|
||||||
private string selection;
|
private string selection;
|
||||||
private StatementBuilder.Field[] selection_args;
|
private StatementBuilder.Field[] selection_args;
|
||||||
|
|
||||||
protected UpdateBuilder(Database db, Table table) {
|
internal UpdateBuilder(Database db, Table table) {
|
||||||
base(db);
|
base(db);
|
||||||
this.table = table;
|
this.table = table;
|
||||||
this.table_name = table.name;
|
this.table_name = table.name;
|
||||||
|
@ -101,7 +101,7 @@ public class UpdateBuilder : StatementBuilder {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Statement prepare() throws DatabaseError {
|
internal override Statement prepare() throws DatabaseError {
|
||||||
string sql = "UPDATE";
|
string sql = "UPDATE";
|
||||||
if (or_val != null) sql += @" OR $or_val";
|
if (or_val != null) sql += @" OR $or_val";
|
||||||
sql += @" $table_name SET ";
|
sql += @" $table_name SET ";
|
||||||
|
|
|
@ -43,8 +43,8 @@ namespace Xmpp.Xep.UserAvatars {
|
||||||
|
|
||||||
public static void on_event_result(XmppStream stream, string jid, string id, StanzaNode node, Object? obj) {
|
public static void on_event_result(XmppStream stream, string jid, string id, StanzaNode node, Object? obj) {
|
||||||
PixbufStorage? storage = obj as PixbufStorage;
|
PixbufStorage? storage = obj as PixbufStorage;
|
||||||
StanzaNode info_node = node.get_subnode("info", NS_URI_METADATA);
|
StanzaNode? info_node = node.get_subnode("info", NS_URI_METADATA);
|
||||||
if (info_node.get_attribute("type") != "image/png") return;
|
if (info_node == null || info_node.get_attribute("type") != "image/png") return;
|
||||||
if (storage.has_image(id)) {
|
if (storage.has_image(id)) {
|
||||||
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
|
stream.get_module(Module.IDENTITY).received_avatar(stream, jid, id);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue