Пример #1
0
        /// <summary>
        /// Send a request to get cipher keys from an user
        /// </summary>
        /// <param name="number">Phone number of the user you want to get the cipher keys</param>
        /// <param name="replaceKey"></param>
        public void sendGetCipherKeysFromUser(string number, bool replaceKeyIn = false)
        {
            replaceKey = replaceKeyIn;
            var msgId = TicketManager.GenerateId();

            cipherKeys.Add(msgId);

            ProtocolTreeNode user = new ProtocolTreeNode("user", new[] {
                new KeyValue("jid", ApiBase.GetJID(number)),
            }, null, null);

            ProtocolTreeNode keyNode = new ProtocolTreeNode("key", null, new ProtocolTreeNode[] { user }, null);
            ProtocolTreeNode Node    = new ProtocolTreeNode("iq", new[] {
                new KeyValue("id", msgId),
                new KeyValue("xmlns", "encrypt"),
                new KeyValue("type", "get"),
                new KeyValue("to", "s.whatsapp.net")
            }, new ProtocolTreeNode[] { keyNode }, null);

            this.SendNode(Node);
        }