diff options
author | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-21 14:14:52 +0000 |
---|---|---|
committer | watcherhd <watcherhd@e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb> | 2011-04-21 14:14:52 +0000 |
commit | cb4a46e7fbe62d788e66ed6121c717a2d22a4d7c (patch) | |
tree | 30df260fdc5a1b5a7049c2f8cac8b7ef17513d6d /miranda-wine/protocols/Yahoo/http_gateway.c | |
parent | 19b6f534d2e784a1e120bf52c4aa07004798f473 (diff) |
svn.miranda.im is moving to a new home!
git-svn-id: http://miranda-plugins.googlecode.com/svn/trunk@7 e753b5eb-9565-29b2-b5c5-2cc6f99dfbcb
Diffstat (limited to 'miranda-wine/protocols/Yahoo/http_gateway.c')
-rw-r--r-- | miranda-wine/protocols/Yahoo/http_gateway.c | 88 |
1 files changed, 88 insertions, 0 deletions
diff --git a/miranda-wine/protocols/Yahoo/http_gateway.c b/miranda-wine/protocols/Yahoo/http_gateway.c new file mode 100644 index 0000000..110cc0a --- /dev/null +++ b/miranda-wine/protocols/Yahoo/http_gateway.c @@ -0,0 +1,88 @@ +/*
+ * $Id: http_gateway.c 3566 2006-08-22 01:55:32Z gena01 $ + *
+ * myYahoo Miranda Plugin
+ *
+ * Authors: Gennady Feldman (aka Gena01)
+ * Laurent Marechal (aka Peorth)
+ *
+ * This code is under GPL and is based on AIM, MSN and Miranda source code.
+ * I want to thank Robert Rainwater and George Hazan for their code and support
+ * and for answering some of my questions during development of this plugin.
+ */
+#ifdef HTTP_GATEWAY
+
+#include <windows.h>
+#include "yahoo.h"
+
+extern yahoo_local_account * ylad;
+
+int YAHOO_httpGatewayInit(HANDLE hConn, NETLIBOPENCONNECTION *nloc, NETLIBHTTPREQUEST *nlhr)
+{
+ NETLIBHTTPPROXYINFO nlhpi;
+
+ YAHOO_DebugLog("YAHOO_httpGatewayInit!!!");
+
+ ZeroMemory(&nlhpi, sizeof(nlhpi) );
+ nlhpi.cbSize = sizeof(nlhpi);
+ nlhpi.szHttpPostUrl = "http://shttp.msg.yahoo.com/notify/";
+
+ //CallService( MS_NETLIB_SETPOLLINGTIMEOUT, (WPARAM) hConn, 15 );
+
+ return CallService(MS_NETLIB_SETHTTPPROXYINFO, (WPARAM)hConn, (LPARAM)&nlhpi);
+}
+
+int YAHOO_httpGatewayWrapSend(HANDLE hConn, PBYTE buf, int len, int flags, MIRANDASERVICE pfnNetlibSend)
+{
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! Len: %d", len);
+
+ if (len == 0 && ylad != NULL) { // we need to send something!!!
+ int n;
+ char *z = yahoo_webmessenger_idle_packet(ylad->id, &n);
+ int ret = 0;
+
+ if (z != NULL) {
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! Got Len: %d", n);
+ NETLIBBUFFER tBuf = { ( char* )z, n, flags };
+ ret = pfnNetlibSend(( LPARAM )hConn, (WPARAM) &tBuf );
+ FREE(z);
+ } else {
+ YAHOO_DebugLog("YAHOO_httpGatewayWrapSend!!! GOT NULL???");
+ }
+
+ return ret;
+ } else {
+ NETLIBBUFFER tBuf = { ( char* )buf, len, flags };
+
+ return pfnNetlibSend(( LPARAM )hConn, (WPARAM) &tBuf );
+ }
+}
+
+PBYTE YAHOO_httpGatewayUnwrapRecv(NETLIBHTTPREQUEST *nlhr, PBYTE buf, int len, int *outBufLen, void *(*NetlibRealloc)(void *, size_t))
+{
+ YAHOO_DebugLog("YAHOO_httpGatewayUnwrapRecv!!! Len: %d", len);
+
+ YAHOO_DebugLog("Got headers: %d", nlhr->headersCount);
+ /* we need to get the first 4 bytes! */
+ if (len < 4)
+ return NULL;
+
+ if (ylad != NULL) {
+ ylad->rpkts = buf[0] + buf[1] *256;
+ YAHOO_DebugLog("Got packets: %d", ylad->rpkts);
+ }
+
+ if (len == 4){
+ *outBufLen = 0;
+ return buf;
+ } else if ( (buf[4] == 'Y') && (buf[5] == 'M') && (buf[6] == 'S') && (buf[7] == 'G') ) {
+ MoveMemory( buf, buf + 4, len - 4);
+ *outBufLen = len-4;// we take off 4 bytes from the beginning
+
+ return buf;
+ } else
+ return NULL; /* Break connection, something went wrong! */
+
+}
+
+#endif
|