Disable AudioComponent do get everything to build nicely.
[chatter.git] / ContactModel.cs
blobc5c7d026d4dd026e2ee3768cb8869c52d301cf0c
1 using System;
2 using System.Collections.Generic;
3 using Telepathy;
5 namespace Chatter
7 public delegate void ContactModelChangedDelegate ();
9 /*
10 Represents a contact
12 Just a cache of stuff on the telepathy side really.
14 public class ContactModel
16 uint handle;
17 ConnectionModel connection_model;
19 string name;
20 string alias;
21 IDictionary<string, IDictionary<string, object>> presence_items;
23 Widget.ConversationWindow conversation_window;
24 IChannelText text_channel;
26 public ContactModel (ConnectionModel _connection_model, uint _handle)
28 handle = _handle;
29 connection_model = _connection_model;
32 public uint Handle
34 get { return handle; }
37 public string Name
39 get
41 if (name == null) {
42 string[] names = connection_model.Connection.InspectHandles (HandleType.Contact, new uint[] {handle});
43 name = names[0];
45 return name;
49 public ConnectionModel ConnectionModel
51 get { return connection_model; }
54 public Widget.ConversationWindow ConversationWindow
56 get
58 if (conversation_window == null)
60 conversation_window = new Widget.ConversationWindow (this);
62 return conversation_window;
66 public void SetTextChannel (IChannelText _text_channel)
68 if (text_channel != null)
70 // fixme: dispose of old channel
73 text_channel = _text_channel;
74 this.ConversationWindow.SetChannelText (text_channel);
80 public string Alias
82 get
84 if (alias == null) {
85 //ALP FIXME alias = conn_model.Connection.RequestAlias (handle);
86 FireUpdated ();
88 return alias;
90 set { alias = value; FireUpdated (); }
93 public IDictionary<string, IDictionary<string, object>> PresenceItems
95 get
97 if (presence_items == null) {
98 presence_items = new Dictionary<string, IDictionary<string, object>> ();
99 presence_items.Add (new KeyValuePair<string, IDictionary<string, object>> ("offline", null));
102 return presence_items;
104 set { presence_items = value; FireUpdated (); }
107 void FireUpdated ()
109 if (Updated != null) Updated (this, null);
112 public event ContactModelChangedDelegate Changed;