public PrivateXmlStorage(Account account) { m_Account = account; }
public bool AuthenticateAndBlock(Account account) { return lm_connection_authenticate_and_block (this._obj, account.username, account.password, account.resource, IntPtr.Zero); }
public ServiceDiscovery(Account account) { m_Account = account; account.RegisterMessageHandler(MessageType.Iq, HandlerPriority.Normal, ReceivedDiscoRequest); }
public void Authenticate(Account account, ResultFunction func) { if (this.result_func != null) { // Throw exception? Console.WriteLine("Connection::Authenticate: this.result_func != null"); return; } this.result_func = func; lm_connection_authenticate(this._obj, account.username, account.password, account.resource, new _ResultFunction(this._HandleResult), IntPtr.Zero, IntPtr.Zero, IntPtr.Zero); }
private HandlerResult ReceivedDiscoRequest(Account account, Message message) { if (message.SubType == MessageSubType.Get && message.Node.FirstChild != null && message.Node.FirstChild.Name == "query" && message.Node.FirstChild.GetAttribute("xmlns") == Namespace.DiscoInfo) { string from = message.Node.GetAttribute("from"); string id = message.Node.GetAttribute("id"); Console.WriteLine("Received disco info request from " + from); Message resultMessage = new Message(from, MessageType.Iq, MessageSubType.Result); resultMessage.Node.SetAttribute("id", id); MessageNode queryNode = resultMessage.Node.AddChild("query", null); queryNode.SetAttribute("xmlns", Namespace.DiscoInfo); foreach (Identity identity in m_Account.Identities) { MessageNode identityNode = queryNode.AddChild("identity", null); identityNode.SetAttribute("category", identity.Category.ToString()); identityNode.SetAttribute("type", identity.Type.ToString()); identityNode.SetAttribute("name", identity.Name); } foreach (string featureName in m_Account.Features.SelectMany(x => x.FeatureNames)) { MessageNode featureNode = queryNode.AddChild("feature", null); featureNode.SetAttribute("var", featureName); } account.Send(resultMessage); } return HandlerResult.AllowMoreHandlers; }