public static UberChatClient Create(AccountConfig config, RiotAccount account) { Uri uri = new Uri(config.Endpoints.Chat.Uri); UberChatClient uberChatClient1 = new UberChatClient(account); uberChatClient1.Host = uri.Host; uberChatClient1.Port = uri.Port; uberChatClient1.Server = "pvp.net"; uberChatClient1.Username = config.Username; uberChatClient1.Password = "******" + config.Password; UberChatClient uberChatClient2 = uberChatClient1; uberChatClient2.ConferenceServers.AddRange((IEnumerable<string>) config.Endpoints.Chat.Conference); return uberChatClient2; }
public static UberChatClient Create(AccountConfig config, RiotAccount account) { Uri uri = new Uri(config.Endpoints.Chat.Uri); UberChatClient uberChatClient = new UberChatClient(account) { Host = uri.Host, Port = uri.Port, Server = "pvp.net", Username = config.Username, Password = string.Concat("AIR_", config.Password) }; UberChatClient uberChatClient1 = uberChatClient; uberChatClient1.ConferenceServers.AddRange(config.Endpoints.Chat.Conference); return uberChatClient1; }
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 static ContactsNotificationService.JsContact Create(UberChatClient client, Contact contact) { return new ContactsNotificationService.JsContact() { InternalId = string.Format("{0}//{1}", (object) client.RealmId, (object) contact.Id), RealmId = client.RealmId, Presence = Enumerable.FirstOrDefault<Presence>((IEnumerable<Presence>) Enumerable.OrderBy<Presence, int>((IEnumerable<Presence>) contact.Presences, new Func<Presence, int>(ContactsNotificationService.GetPresenceOrder))) ?? ContactsNotificationService.OfflinePresence, Id = contact.Id, Jid = contact.Jid, Name = contact.Name, Groups = contact.Groups, Presences = contact.Presences, ConferenceUser = contact.ConferenceUser, BareJid = contact.BareJid }; }
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); }
public static ContactsNotificationService.JsContact Create(UberChatClient client, Contact contact) { ContactsNotificationService.JsContact jsContact = new ContactsNotificationService.JsContact() { InternalId = string.Format("{0}//{1}", client.RealmId, contact.Id), RealmId = client.RealmId, Presence = contact.Presences.OrderBy<Presence, int>(new Func<Presence, int>(ContactsNotificationService.GetPresenceOrder)).FirstOrDefault<Presence>() ?? ContactsNotificationService.OfflinePresence, Id = contact.Id, Jid = contact.Jid, Name = contact.Name, Groups = contact.Groups, Presences = contact.Presences, ConferenceUser = contact.ConferenceUser, BareJid = contact.BareJid }; return jsContact; }