Ejemplo n.º 1
0
 private void addItems(List <DiscoItem> items, string from, XMPPClient client, bool requestInfo)
 {
     if (items != null)
     {
         dB.Execute("DELETE FROM " + DBTableConsts.DISCO_ITEM_TABLE + " WHERE fromServer = ?;", from);
         foreach (DiscoItem i in items)
         {
             if (from != null && i.JID != null)
             {
                 dB.InsertOrReplace(new DiscoItemTable()
                 {
                     id         = DiscoItemTable.generateId(from, i.JID),
                     fromServer = from,
                     jid        = i.JID,
                     name       = i.NAME
                 });
                 if (requestInfo)
                 {
                     MessageResponseHelper <IQMessage> helper = client.GENERAL_COMMAND_HELPER.createDisco(i.JID, DiscoType.INFO, onDiscoMsg, onDiscoTimeout);
                     RESPONSE_HELPERS.Add(helper);
                 }
             }
         }
     }
 }
Ejemplo n.º 2
0
 private async Task addItemsAsync(List <DiscoItem> items, string from, XMPPClient client, bool requestInfo)
 {
     if (items != null)
     {
         dB.Execute("DELETE FROM " + DBTableConsts.DISCO_ITEM_TABLE + " WHERE fromServer = ?;", from);
         foreach (DiscoItem i in items)
         {
             if (from != null && i.JID != null)
             {
                 update(new DiscoItemTable()
                 {
                     id         = DiscoItemTable.generateId(from, i.JID),
                     fromServer = from,
                     jid        = i.JID,
                     name       = i.NAME
                 });
                 if (requestInfo)
                 {
                     messageIdCache.addTimed(await client.createDiscoAsync(i.JID, DiscoType.INFO));
                 }
             }
         }
     }
 }