Snippets: Msnp - GroupList
// SOCKSArmor Snippets - MSNP. // Author: Felipe Kellermann <felipek@socksarmor.org> // Revision: $Revision: 5395 $ // Date: $Date: 2008-01-03 18:05:06 -0200 (Thu, 03 Jan 2008) $ // // This snippet shows a group referencing another group, just like a // pointer in programming. This is an important concept that exists // in all objects supported by the SOCKSArmor Architecture. using System; using SocksArmor; using SocksArmor.Plugins.Msnp; class SocksArmorSnippet { static void Main(string[] args) { // Remote SOCKSArmor server. RemoteServer server = new RemoteServer(); server.Connect("127.0.0.1", 10842, "username", "password"); // Msnp plugin interface. MsnpPlugin msnp = server.Plugins["msnp"].Interface as MsnpPlugin; // Creates the local instance and immediately registers the // instance on the server. Now the group object is "attached". MsnpGroup group = new MsnpGroup("TestingGroup"); msnp.Objects.Add(group); // Gets a reference of the remote's "Local" group object. MsnpGroup local = msnp.Objects["Local"] as MsnpGroup; // This operations references the "local" (Local, on the server) // object on the "group" (TestingGroup, on the server). One can // read this like "group has local" or "group points do local". group.Add(local); // Testing object gets removed from the server. msnp.Objects.Remove(group); server.Disconnect(); } }
