public static void ProcessRosterIQGet(string username, IQ iq) { iq.Type = IqType.result; iq.Query = new Roster(); BLL.Users api = new BLL.Users(); List <DAL.VwFriend> FList = api.ListFriend(username); for (int i = 0; i < FList.Count; i++) { RosterItem ri = new RosterItem(); ri.Name = FList[i].VcardFirstName + " " + FList[i].VcardLastName; ri.Subscription = (FList[i].FriendStatus == 1) ? SubscriptionType.from : SubscriptionType.both; ri.Jid = new agsXMPP.Jid(FList[i].FriendUserName + "@" + Config.AppSetting.domain); if (!string.IsNullOrEmpty(FList[i].GroupName)) { ri.AddGroup(FList[i].GroupName); } iq.Query.AddChild(ri); } int index; if (ThreadTools.Users.Online.IsAuthenticated(username, out index)) { ThreadTools.Users.Online[index].Send(iq); ThreadTools.Users.Online[index].Send(Rosters.FriendStatus(username)); ThreadTools.Users.Online[index].Send(Messages.OfflineMessage(username)); ThreadTools.Users.Online[index].Send(Rosters.PendingStatus(iq.From.User)); } }