~ubuntu-branches/ubuntu/precise/folks/precise

« back to all changes in this revision

Viewing changes to backends/telepathy/lib/tpf-persona.vala

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-06-10 11:28:11 UTC
  • mfrom: (1.2.11 upstream) (4.2.1 experimental)
  • Revision ID: james.westby@ubuntu.com-20110610112811-whyeodbo9mjezxfp
Tags: 0.5.2-1ubuntu1
* Merge with Debian experimental, remaining Ubuntu changes:
  - debian/control:
    + Add Vcs-Bzr link

Show diffs side-by-side

added added

removed removed

Lines of Context:
35
35
    ImDetails,
36
36
    PresenceDetails
37
37
{
38
 
  private HashTable<string, bool> _groups;
 
38
  private HashSet<string> _groups;
 
39
  private Set<string> _groups_ro;
39
40
  private bool _is_favourite;
40
41
  private string _alias;
41
 
  private HashTable<string, LinkedHashSet<string>> _im_addresses;
 
42
  private HashMultiMap<string, string> _im_addresses;
42
43
  private const string[] _linkable_properties = { "im-addresses" };
43
44
 
44
45
  /* Whether we've finished being constructed; this is used to prevent
131
132
    }
132
133
 
133
134
  /**
134
 
   * A mapping of IM protocol to an ordered set of IM addresses.
 
135
   * A mapping of IM protocol to an (unordered) set of IM addresses.
135
136
   *
136
137
   * See {@link Folks.ImDetails.im_addresses}.
137
138
   */
138
 
  public HashTable<string, LinkedHashSet<string>> im_addresses
 
139
  public MultiMap<string, string> im_addresses
139
140
    {
140
141
      get { return this._im_addresses; }
141
142
      private set {}
146
147
   *
147
148
   * See {@link Folks.GroupDetails.groups}.
148
149
   */
149
 
  public HashTable<string, bool> groups
 
150
  public Set<string> groups
150
151
    {
151
 
      get { return this._groups; }
 
152
      get { return this._groups_ro; }
152
153
 
153
154
      set
154
155
        {
155
 
          value.foreach ((k, v) =>
 
156
          foreach (var group in value)
156
157
            {
157
 
              unowned string group = (string) k;
158
 
              if (this._groups.lookup (group) == false)
 
158
              if (this._groups.contains (group) == false)
159
159
                this._change_group (group, true);
160
 
            });
 
160
            }
161
161
 
162
 
          this._groups.foreach ((k, v) =>
 
162
          foreach (var group in this._groups)
163
163
            {
164
 
              unowned string group = (string) k;
165
 
              if (value.lookup (group) == false)
 
164
              if (value.contains (group) == false)
166
165
                this._change_group (group, true);
167
 
            });
 
166
            }
168
167
 
169
168
          /* Since we're only changing the members of this._groups, rather than
170
169
           * replacing it with a new instance, we have to manually emit the
193
192
 
194
193
      if (is_member)
195
194
        {
196
 
          if (this._groups.lookup (group) != true)
 
195
          if (!this._groups.contains (group))
197
196
            {
198
 
              this._groups.insert (group, true);
 
197
              this._groups.add (group);
199
198
              changed = true;
200
199
            }
201
200
        }
227
226
      unowned string id = contact.get_identifier ();
228
227
      unowned Connection connection = contact.connection;
229
228
      var account = this._account_for_connection (connection);
230
 
      var uid = this.build_uid (store.type_id, account.get_protocol (), id);
 
229
      var uid = this.build_uid (store.type_id, store.id, id);
231
230
 
232
231
      Object (alias: contact.get_alias (),
233
232
              contact: contact,
255
254
      this._is_constructed = true;
256
255
 
257
256
      /* Set our single IM address */
258
 
      LinkedHashSet<string> im_address_set = new LinkedHashSet<string> ();
 
257
      this._im_addresses = new HashMultiMap<string, string> ();
 
258
 
259
259
      try
260
260
        {
261
 
          im_address_set.add (ImDetails.normalise_im_address (id,
262
 
              account.get_protocol ()));
 
261
          this._im_addresses.set (account.get_protocol (),
 
262
              ImDetails.normalise_im_address (id, account.get_protocol ()));
263
263
        }
264
264
      catch (ImDetailsError e)
265
265
        {
267
267
          warning (e.message);
268
268
        }
269
269
 
270
 
      this._im_addresses =
271
 
          new HashTable<string, LinkedHashSet<string>> (str_hash, str_equal);
272
 
      this._im_addresses.insert (account.get_protocol (), im_address_set);
273
 
 
274
270
      /* Groups */
275
 
      this._groups = new HashTable<string, bool> (str_hash, str_equal);
 
271
      this._groups = new HashSet<string> ();
 
272
      this._groups_ro = this._groups.read_only_view;
276
273
 
277
274
      contact.notify["avatar-file"].connect ((s, p) =>
278
275
        {