private static void ApplyContactTransformations(ContactsNotificationService.JsContact contact)
 {
     if (contact.Presences != null)
     {
         foreach (Presence presence1 in
             from presence in (IEnumerable<Presence>)contact.Presences
             where presence.Resource == "xiff"
             select presence)
         {
             presence1.Resource = "adobe air";
         }
     }
     string[] groups = contact.Groups;
     if (groups != null)
     {
         for (int i = 0; i < (int)groups.Length; i++)
         {
             if (groups[i] == "**Default")
             {
                 groups[i] = "General";
             }
         }
         contact.Groups = groups.Distinct<string>(StringComparer.OrdinalIgnoreCase).ToArray<string>();
     }
 }
 private void OnContactUpdated(UberChatClient client, ContactsNotificationService.JsContact contact)
 {
   ContactsNotificationService.JsFederatedDude orAdd;
   lock (ContactsNotificationService.Contacts)
   {
     orAdd = ContactsNotificationService.Contacts.GetOrAdd(contact.InternalId, (Func<string, ContactsNotificationService.JsFederatedDude>) (_ => new ContactsNotificationService.JsFederatedDude(contact)));
     orAdd.Contact = contact;
     orAdd.Attach(client.AccountHandle);
   }
   ContactsNotificationService.PushContact("chat:contact:upsert", orAdd);
 }
 public JsFederatedDude(ContactsNotificationService.JsContact contact)
 {
   this.Contact = contact;
   this.AccountHandles = new List<int>(1);
 }
 private static void ApplyContactTransformations(ContactsNotificationService.JsContact contact)
 {
   if (contact.Presences != null)
   {
     foreach (Presence presence in Enumerable.Where<Presence>((IEnumerable<Presence>) contact.Presences, (Func<Presence, bool>) (presence => presence.Resource == "xiff")))
       presence.Resource = "adobe air";
   }
   string[] strArray = contact.Groups;
   if (strArray == null)
     return;
   for (int index = 0; index < strArray.Length; ++index)
   {
     if (strArray[index] == "**Default")
       strArray[index] = "General";
   }
   contact.Groups = Enumerable.ToArray<string>(Enumerable.Distinct<string>((IEnumerable<string>) strArray, (IEqualityComparer<string>) StringComparer.OrdinalIgnoreCase));
 }
 private static void PushContact(string key, ContactsNotificationService.JsFederatedDude dude)
 {
   ContactsNotificationService.JsContact jsContact = dude.Contact;
   if (jsContact != null)
     jsContact.Accounts = dude.AccountHandles;
   JsApiService.Push(key, (object) jsContact);
 }
 private void OnContactRemoved(UberChatClient client, ContactsNotificationService.JsContact contact)
 {
   ContactsNotificationService.JsFederatedDude dude;
   lock (ContactsNotificationService.Contacts)
   {
     if (ContactsNotificationService.Contacts.TryGetValue(contact.InternalId, out dude))
     {
       if (dude.Detach(client.AccountHandle) == 0)
         ContactsNotificationService.Contacts.TryRemove(contact.InternalId, out dude);
     }
   }
   if (dude == null)
     return;
   ContactsNotificationService.PushContact(dude.AccountHandles.Count > 0 ? "chat:contact:upsert" : "chat:contact:delete", dude);
 }