summaryrefslogtreecommitdiffstats
path: root/src/gui/CoreConnector.vala
diff options
context:
space:
mode:
authorMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 20:37:31 +0200
committerMatthias Schiffer <mschiffer@universe-factory.net>2010-06-23 20:37:31 +0200
commitd5adf274c137bef22d5695d4a280e10068edcb0e (patch)
tree6c01a10c06a1fabe40d8a6498b8a934df781a023 /src/gui/CoreConnector.vala
parent04a0f989a71a83114fe1f58b2ebe1af2f56cb87b (diff)
downloadephraim-d5adf274c137bef22d5695d4a280e10068edcb0e.tar
ephraim-d5adf274c137bef22d5695d4a280e10068edcb0e.zip
Show avatars in roster
Diffstat (limited to 'src/gui/CoreConnector.vala')
-rw-r--r--src/gui/CoreConnector.vala17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/gui/CoreConnector.vala b/src/gui/CoreConnector.vala
index 1030428..9c492b7 100644
--- a/src/gui/CoreConnector.vala
+++ b/src/gui/CoreConnector.vala
@@ -90,7 +90,7 @@ public class CoreConnector {
unowned Erl.Term term = store.term;
Erl.Term match_term;
- if((match_term = match("{roster_update,JID,Name,Subscription,Groups,Resources}", term)) != null) {
+ if((match_term = match("{roster_update,JID,Name,Subscription,Groups,Resources,Avatar}", term)) != null) {
Erl.Term jid_term = match_term.var_content("JID");
if(!jid_term.is_binary())
// TODO Debug output
@@ -151,6 +151,21 @@ public class CoreConnector {
resources = resources.tl();
}
+ Erl.Term avatar = match("{avatar,Data}", match_term.var_content("Avatar"));
+ if(avatar != null) {
+ Erl.Term avatarData = avatar.var_content("Data");
+
+ if(avatarData.is_binary()) {
+ InputStream avatarStream = new MemoryInputStream.from_data(avatarData.bin_ptr(), avatarData.bin_size(), null);
+ try {
+ contact.avatar = new Gdk.Pixbuf.from_stream_at_scale(avatarStream, 32, 32, true, null);
+ avatarStream.close(null);
+ } catch(Error e) {
+ // TODO Debug output
+ }
+ }
+ }
+
roster.update_contact(contact);
}
else {