private List <Contact> GetGlobalContacts(ContactsFound contactsFound) { var globalContacts = new List <Contact>(); _dialogs.AddUsers(contactsFound.Users); foreach (var iUser in contactsFound.Users) { var user = iUser as User; if (user != null && user.Bot == null) { globalContacts.Add(new TelegramContact { Available = TelegramUtils.GetAvailable(user), LastSeen = TelegramUtils.GetLastSeenTime(user), FirstName = user.FirstName, LastName = user.LastName, User = user, Ids = new List <Contact.ID> { new Contact.ID { Service = this, Id = user.Id.ToString(CultureInfo.InvariantCulture) } }, }); } } return(globalContacts); }
private List <Contact> GetGlobalPartyContacts(ContactsFound contactsFound) { var globalContacts = new List <Contact>(); _dialogs.AddChats(contactsFound.Chats); Utils.DebugPrint("Chats found " + ObjectDumper.Dump(contactsFound.Chats)); foreach (var chat in contactsFound.Chats) { var name = TelegramUtils.GetChatTitle(chat); var kicked = TelegramUtils.GetChatKicked(chat); if (kicked) { continue; } globalContacts.Add(new TelegramPartyContact { FirstName = name, Ids = new List <Contact.ID> { new Contact.PartyID { Service = this, Id = TelegramUtils.GetChatId(chat), ExtendedParty = chat is Channel } }, }); } return(globalContacts); }
private List <Contact> GetGlobalContacts(ContactsFound contactsFound) { var globalContacts = new List <Contact>(); _dialogs.AddUsers(contactsFound.Users); foreach (var iUser in contactsFound.Users) { var user = iUser as User; if (user != null) { var globalContact = CreateTelegramContact(user); globalContacts.Add(globalContact); } } return(globalContacts); }
private List <Contact> GetGlobalPartyContacts(ContactsFound contactsFound, bool forChannels) { var globalContacts = new List <Contact>(); _dialogs.AddChats(contactsFound.Chats); foreach (var chat in contactsFound.Chats) { var name = TelegramUtils.GetChatTitle(chat); var kicked = TelegramUtils.GetChatKicked(chat); if (kicked) { continue; } var channel = chat as Channel; if (forChannels) { if (channel != null) { if (channel.Broadcast != null) { // it is a channel } else { continue; } } else { continue; } } else { if (channel != null) { if (channel.Broadcast != null) { continue; } else { // it is not a channel } } else { // it is not a channel } } // Public channels require us knowing the AccessHash for them in order // to join them ulong channelAccessHash = 0; if (channel != null) { channelAccessHash = channel.AccessHash; } globalContacts.Add(new TelegramPartyContact { FirstName = name, Ids = new List <Contact.ID> { new Contact.PartyID { Service = this, Id = TelegramUtils.GetChatId(chat), ExtendedParty = channel != null, } }, AccessHash = channelAccessHash }); } return(globalContacts); }