summaryrefslogtreecommitdiff
path: root/protocols/WhatsAppWeb/src/utils.h
diff options
context:
space:
mode:
Diffstat (limited to 'protocols/WhatsAppWeb/src/utils.h')
-rw-r--r--protocols/WhatsAppWeb/src/utils.h35
1 files changed, 35 insertions, 0 deletions
diff --git a/protocols/WhatsAppWeb/src/utils.h b/protocols/WhatsAppWeb/src/utils.h
index 292a8e7011..cd98fe8749 100644
--- a/protocols/WhatsAppWeb/src/utils.h
+++ b/protocols/WhatsAppWeb/src/utils.h
@@ -60,6 +60,38 @@ __forceinline WANode& operator<<(WANode &node, const CHAR_PARAM &param)
return node;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+namespace IQ
+{
+ enum Type { GET, SET, RESULT };
+};
+
+struct WANodeIq : public WANode
+{
+ WANodeIq(IQ::Type type, const char *pszXmlns = nullptr, const char *pszTo = nullptr);
+};
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+struct XCHILD
+{
+ const char *name, *value;
+
+ __forceinline XCHILD(const char *_name) :
+ name(_name)
+ {}
+};
+
+__forceinline WANode& operator<<(WANode &node, const XCHILD &child)
+{
+ node.addChild(child.name);
+ return node;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+// WAReader
+
class WAReader
{
const BYTE *m_buf, *m_limit;
@@ -87,6 +119,9 @@ public:
__forceinline uint32_t readInt32() { return readIntN(4); }
};
+/////////////////////////////////////////////////////////////////////////////////////////
+// WAWriter
+
class WAWriter
{
__forceinline void writeInt8(int value) { writeIntN(value, 1); }