summaryrefslogtreecommitdiffstats
path: root/src/gui/Ephraim.vala
diff options
context:
space:
mode:
Diffstat (limited to 'src/gui/Ephraim.vala')
-rw-r--r--src/gui/Ephraim.vala40
1 files changed, 38 insertions, 2 deletions
diff --git a/src/gui/Ephraim.vala b/src/gui/Ephraim.vala
index 9d3083c..fe9f431 100644
--- a/src/gui/Ephraim.vala
+++ b/src/gui/Ephraim.vala
@@ -26,15 +26,33 @@ public class Ephraim {
Gee.TreeMap<string, Conversation> conversations = new Gee.TreeMap<string, Conversation>();
unowned Gtk.Notebook conversationNotebook = builder.get_object("Conversations") as Gtk.Notebook;
+ // FIXME
+ string me = "/me";
+
coreconn.new_conversation.connect((jid) => {
Contact contact = roster.get_contact(jid);
if(contact != null) {
- conversations[jid] = new Conversation(conversationNotebook, jid, contact.display_string);
+ conversations[jid] = new Conversation(conversationNotebook, me, jid, contact.display_string);
}
else {
- conversations[jid] = new Conversation(conversationNotebook, jid, null);
+ conversations[jid] = new Conversation(conversationNotebook, me, jid, null);
}
+
+ conversations[jid].send_message.connect((type, message) => coreconn.send_message(jid, type, message));
+ });
+
+ coreconn.receive_message.connect((jid, type, message) => {
+ if(!(jid in conversations))
+ return;
+
+ conversations[jid].receive_message(type, message);
+ });
+ coreconn.sent_message.connect((jid, type, message) => {
+ if(!(jid in conversations))
+ return;
+
+ conversations[jid].sent_message(type, message);
});
if(!coreconn.start())
@@ -65,6 +83,24 @@ public class Ephraim {
});
rosterView.has_tooltip = true;
+ rosterView.row_activated.connect((view, path, column) => {
+ Gtk.TreeIter iter;
+ roster.get_iter(out iter, path);
+
+ Value value;
+ roster.get_value(iter, 0, out value);
+
+ Contact contact = value.get_object() as Contact;
+ if(contact == null)
+ return;
+
+ Gee.Map.Entry<string, Contact.Resource> res = contact.get_resource_with_highest_priority();
+ if(res == null)
+ return; //FIXME
+
+ coreconn.start_conversation(contact.jid + "/" + res.key);
+ });
+
Gtk.TreeViewColumn presenceColumn = new Gtk.TreeViewColumn.with_attributes(null, new CellRendererPresence(), "contact", 0, null);
presenceColumn.min_width = 32;
rosterView.append_column(presenceColumn);