diff options
author | George Hazan <george.hazan@gmail.com> | 2015-02-07 19:36:41 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-02-07 19:36:41 +0000 |
commit | 5b304799fb995811a8686bab9e877cb235c21a2e (patch) | |
tree | 0e212481e8b6b92b82ae10fa6b6896f565e64bb4 /protocols/WhatsApp/src | |
parent | 9540f9a510f3eaab57285c56198d270c648d54a1 (diff) |
correct log format
git-svn-id: http://svn.miranda-ng.org/main/trunk@12044 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'protocols/WhatsApp/src')
7 files changed, 26 insertions, 26 deletions
diff --git a/protocols/WhatsApp/src/WASocketConnection.cpp b/protocols/WhatsApp/src/WASocketConnection.cpp index 00e3aa9933..3d8744a91f 100644 --- a/protocols/WhatsApp/src/WASocketConnection.cpp +++ b/protocols/WhatsApp/src/WASocketConnection.cpp @@ -106,7 +106,7 @@ unsigned char WASocketConnection::read() int WASocketConnection::read(unsigned char *buf, int length)
{
- int result = Netlib_Recv(this->hConn, (char*)buf, length, 0);
+ int result = Netlib_Recv(this->hConn, (char*)buf, length, MSG_NODUMP);
if (result <= 0)
throw WAException(getLastErrorMsg(), WAException::SOCKET_EX, WAException::SOCKET_EX_RECV);
@@ -134,9 +134,9 @@ void WASocketConnection::forceShutdown() Netlib_Shutdown(this->hConn);
}
-void WASocketConnection::log(const char *str)
+void WASocketConnection::log(const char *prefix, const char *str)
{
- Netlib_Logf(WASocketConnection::hNetlibUser, "STR: %s", str);
+ Netlib_Logf(WASocketConnection::hNetlibUser, "%s%s", prefix, str);
}
WASocketConnection::~WASocketConnection()
diff --git a/protocols/WhatsApp/src/WASocketConnection.h b/protocols/WhatsApp/src/WASocketConnection.h index 95b30c274c..72775b9cf1 100644 --- a/protocols/WhatsApp/src/WASocketConnection.h +++ b/protocols/WhatsApp/src/WASocketConnection.h @@ -20,18 +20,18 @@ public: WASocketConnection(const std::string &dir, int port) throw (WAException);
virtual ~WASocketConnection();
- void write(int i);
- unsigned char read();
- int read(std::vector<unsigned char>& b, int off, int length);
- int read(unsigned char*, int length);
- void flush();
- void write(const std::vector<unsigned char>& b, int length);
- void write(const std::vector<unsigned char>& bytes, int offset, int length);
- void makeNonBlock();
- int waitForRead();
- void forceShutdown();
+ virtual void write(int i);
+ virtual unsigned char read();
+ virtual int read(std::vector<unsigned char>& b, int off, int length);
+ virtual int read(unsigned char*, int length);
+ virtual void flush();
+ virtual void write(const std::vector<unsigned char>& b, int length);
+ virtual void write(const std::vector<unsigned char>& bytes, int offset, int length);
+ virtual void makeNonBlock();
+ virtual int waitForRead();
+ virtual void forceShutdown();
- void log(const char *str);
+ virtual void log(const char *prefix, const char *str);
static void initNetwork(HANDLE hNetlibUser) throw (WAException);
static void quitNetwork();
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp index 851d4599da..daf17108a8 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.cpp @@ -260,7 +260,7 @@ void BinTreeNodeReader::fillArray(std::vector<unsigned char>& buff, int len, Byt count += in->read(buff, count, len - count);
}
-void BinTreeNodeReader::fillArray(std::vector<unsigned char>& buff, int len, ISocketConnection* in)
+void BinTreeNodeReader::fillArray(std::vector<unsigned char>& buff, int len, ISocketConnection *in)
{
int count = 0;
while (count < len)
@@ -326,19 +326,19 @@ void BinTreeNodeReader::streamStart() delete attributes;
}
-int BinTreeNodeReader::readInt8(ISocketConnection* in)
+int BinTreeNodeReader::readInt8(ISocketConnection *in)
{
return in->read();
}
-int BinTreeNodeReader::readInt16(ISocketConnection* in)
+int BinTreeNodeReader::readInt16(ISocketConnection *in)
{
unsigned char data[2];
in->read(data, 2);
return (int(data[0]) << 8) + int(data[1]);
}
-int BinTreeNodeReader::readInt24(ISocketConnection* in)
+int BinTreeNodeReader::readInt24(ISocketConnection *in)
{
unsigned char data[3];
in->read(data, 3);
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h index eb8761ce12..7a2d43454d 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeReader.h @@ -48,17 +48,17 @@ private: ReadData* readString();
ReadData* readString(int token);
static void fillArray(std::vector<unsigned char>& buff, int len, ByteArrayInputStream* in);
- static void fillArray(std::vector<unsigned char>& buff, int len, ISocketConnection* in);
+ static void fillArray(std::vector<unsigned char>& buff, int len, ISocketConnection *in);
std::string* objectAsString(ReadData* o);
std::string* readStringAsString();
std::string* readStringAsString(int token);
void getTopLevelStream();
static int readInt8(ByteArrayInputStream* in);
- static int readInt8(ISocketConnection* in);
+ static int readInt8(ISocketConnection *in);
static int readInt16(ByteArrayInputStream* in);
- static int readInt16(ISocketConnection* in);
+ static int readInt16(ISocketConnection *in);
static int readInt24(ByteArrayInputStream* in);
- static int readInt24(ISocketConnection* in);
+ static int readInt24(ISocketConnection *in);
public:
diff --git a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp index e527e2c25b..4d55e536a0 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/BinTreeNodeWriter.cpp @@ -267,7 +267,7 @@ void BinTreeNodeWriter::write(const ProtocolTreeNode &node, bool needsFlush) if (bSecure) {
string tmp = node.toString();
- this->realOut->log(tmp.c_str());
+ this->realOut->log("XML written:\n", tmp.c_str());
}
if (node.tag.empty())
diff --git a/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h b/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h index 0661b23945..1aa9d92a49 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h +++ b/protocols/WhatsApp/src/WhatsAPI++/ISocketConnection.h @@ -20,7 +20,7 @@ public: virtual int waitForRead() = 0;
virtual void forceShutdown() = 0;
- virtual void log(const char *str) = 0;
+ virtual void log(const char *prefix, const char *str) = 0;
};
#endif /* ISOCKETCONNECTION_H_ */
diff --git a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp index be44413c52..e1e983cad0 100644 --- a/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp +++ b/protocols/WhatsApp/src/WhatsAPI++/WAConnection.cpp @@ -91,7 +91,7 @@ void WAConnection::logData(const char *format, ...) va_start(args, format);
char tmp[4000];
vsprintf_s(tmp, format, args);
- rawConn->log(tmp);
+ rawConn->log(">> ", tmp);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -196,7 +196,7 @@ bool WAConnection::read() throw(WAException) return false;
string tmp = node->toString();
- rawConn->log(tmp.c_str());
+ rawConn->log("XML received\n", tmp.c_str());
if (ProtocolTreeNode::tagEquals(node, "iq"))
parseIq(node);
|