public void ReloadBuddies()
 {
     mBuddies.Clear();
     using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
     {
         dbClient.AddParamWithValue("@userid", mClient.GetHabbo().ID);
         foreach (DataRow row in dbClient.ReadDataTable("SELECT id,username,figure,motto FROM users WHERE id IN(SELECT buddyid FROM messenger_buddylist WHERE userid = @userid AND accepted = 0x01) OR id IN(SELECT userid FROM messenger_buddylist WHERE buddyid = @userid AND accepted = 0x01);").Rows)
         {
             MessengerBuddy buddy = MessengerBuddy.Parse(row);
             if (buddy != null)
             {
                 mBuddies.Add(buddy);
             }
         }
     }
 }
Beispiel #2
0
        public List <MessengerBuddy> SearchHabbos(string criteria)
        {
            List <MessengerBuddy> matches = new List <MessengerBuddy>();

            using (DatabaseClient dbClient = AleedaEnvironment.GetDatabase().GetClient())
            {
                dbClient.AddParamWithValue("@criteria", criteria + "%");
                foreach (DataRow row in dbClient.ReadDataTable("SELECT id,username,figure,motto FROM users WHERE username LIKE @criteria;").Rows)
                {
                    MessengerBuddy match = MessengerBuddy.Parse(row);
                    if (match != null)
                    {
                        matches.Add(match);
                    }
                }
            }
            return(matches);
        }