1 /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * 2 * Copyright (c) 2003-2012 by AG-Software * 3 * All Rights Reserved. * 4 * Contact information for AG-Software is available at http://www.ag-software.de * 5 * * 6 * Licence: * 7 * The agsXMPP SDK is released under a dual licence * 8 * agsXMPP can be used under either of two licences * 9 * * 10 * A commercial licence which is probably the most appropriate for commercial * 11 * corporate use and closed source projects. * 12 * * 13 * The GNU Public License (GPL) is probably most appropriate for inclusion in * 14 * other open source projects. * 15 * * 16 * See README.html for details. * 17 * * 18 * For general enquiries visit our website at: * 19 * http://www.ag-software.de * 20 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */ 21 22 using System; 23 using System.Collections; 24 25 namespace agsXMPP 26 { 27 /// <summary> 28 /// Summary description for Grabber. 29 /// </summary> 30 public class PacketGrabber 31 { 32 internal Hashtable m_grabbing = new Hashtable(); 33 internal XmppConnection m_connection = null; 34 PacketGrabber()35 public PacketGrabber() 36 { 37 } 38 Clear()39 public void Clear() 40 { 41 // need locking here to make sure that we dont acces the Hashtable 42 // from another thread 43 lock(this) 44 { 45 m_grabbing.Clear(); 46 } 47 } 48 49 /// <summary> 50 /// Pending request can be removed. 51 /// This is useful when a ressource for the callback is destroyed and 52 /// we are not interested anymore at the result. 53 /// </summary> 54 /// <param name="id">ID of the Iq we are not interested anymore</param> Remove(string id)55 public void Remove(string id) 56 { 57 if (m_grabbing.ContainsKey(id)) 58 m_grabbing.Remove(id); 59 } 60 } 61 } 62