From a5184b5e19951983bb9f699807cd9c5cf206c7ce Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 7 Jun 2015 13:12:43 +0000 Subject: YAHOO search -> utf8 git-svn-id: http://svn.miranda-ng.org/main/trunk@14049 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- protocols/Yahoo/src/server.cpp | 53 +++++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'protocols/Yahoo/src/server.cpp') diff --git a/protocols/Yahoo/src/server.cpp b/protocols/Yahoo/src/server.cpp index aaaac11341..c9b742fb2a 100644 --- a/protocols/Yahoo/src/server.cpp +++ b/protocols/Yahoo/src/server.cpp @@ -37,7 +37,7 @@ int PASCAL recv(SOCKET s, char FAR *buf, int len, int flags) if (RecvResult == 0) { LOG(("[recv] Connection closed gracefully.")); return 0; - } + } if (RecvResult == SOCKET_ERROR) { LOG(("[recv] Connection abortively closed")); return -1; @@ -51,13 +51,13 @@ void __cdecl CYahooProto::server_main(void *empty) enum yahoo_status status = (enum yahoo_status) (int)empty; time_t lLastPing, lLastKeepAlive, t; YList *l; - NETLIBSELECTEX nls = {0}; + NETLIBSELECTEX nls = { 0 }; int recvResult, ridx = 0, widx = 0, i; debugLogA("Server Thread Starting status: %d", status); - do_yahoo_debug=YAHOO_LOG_DEBUG; - yahoo_set_log_level(( yahoo_log_level )do_yahoo_debug); + do_yahoo_debug = YAHOO_LOG_DEBUG; + yahoo_set_log_level((yahoo_log_level)do_yahoo_debug); poll_loop = 1; /* set this so we start looping */ @@ -73,10 +73,10 @@ void __cdecl CYahooProto::server_main(void *empty) FD_ZERO(&nls.hWriteStatus); FD_ZERO(&nls.hExceptStatus); nls.hExceptConns[0] = NULL; - ridx = 0; widx = 0; + ridx = 0; widx = 0; - for(l=m_connections; l; ) { - struct _conn *c = ( _conn * )l->data; + for (l = m_connections; l;) { + struct _conn *c = (_conn *)l->data; //LOG(("Connection tag:%d id:%d fd:%d remove:%d", c->tag, c->id, c->fd, c->remove)); if (c->remove) { YList *n = y_list_next(l); @@ -84,8 +84,9 @@ void __cdecl CYahooProto::server_main(void *empty) m_connections = y_list_remove_link(m_connections, l); y_list_free_1(l); FREE(c); - l=n; - } else { + l = n; + } + else { if (c->cond & YAHOO_INPUT_READ) { //LOG(("[YAHOO_INPUT_READ] Waiting on read. Tag: %d fd: %d", c->tag, c->fd )); nls.hReadConns[ridx++] = (HANDLE)c->fd; @@ -93,7 +94,7 @@ void __cdecl CYahooProto::server_main(void *empty) if (c->cond & YAHOO_INPUT_WRITE) { //LOG(("[YAHOO_INPUT_WRITE] Waiting on write. Tag: %d fd: %d", c->tag, c->fd )); - nls.hWriteConns[widx++] =(HANDLE) c->fd; + nls.hWriteConns[widx++] = (HANDLE)c->fd; } l = y_list_next(l); @@ -109,7 +110,7 @@ void __cdecl CYahooProto::server_main(void *empty) debugLogA("Last connection closed."); break; } - recvResult = CallService(MS_NETLIB_SELECTEX, (WPARAM) 0, (LPARAM)&nls); + recvResult = CallService(MS_NETLIB_SELECTEX, (WPARAM)0, (LPARAM)&nls); /* do the timer check */ if (m_id > 0) { @@ -117,7 +118,7 @@ void __cdecl CYahooProto::server_main(void *empty) //debugLogA("HTTPGateway: %d", iHTTPGateway); if (!iHTTPGateway) { #endif - t = time(NULL); + t = time(NULL); if (m_bLoggedIn && t - lLastKeepAlive >= 60) { LOG(("[TIMER] Sending a keep alive message")); @@ -140,8 +141,8 @@ void __cdecl CYahooProto::server_main(void *empty) if ( m_bLoggedIn && ( (ylad->rpkts > 0 && (time(NULL) - lLastSend) >=3) || ( (time(NULL) - lLastSend) >= 13)) ) { - LOG(("[TIMER] Sending an idle message...")); - yahoo_send_idle_packet(m_id); + LOG(("[TIMER] Sending an idle message...")); + yahoo_send_idle_packet(m_id); } // @@ -153,16 +154,16 @@ void __cdecl CYahooProto::server_main(void *empty) } /* do the timer check ends */ - for(l = m_connections; l; l = y_list_next(l)) { - struct _conn *c = ( _conn * )l->data; + for (l = m_connections; l; l = y_list_next(l)) { + struct _conn *c = (_conn *)l->data; - if (c->remove) + if (c->remove) continue; /* are we waiting for a Read request? */ if (c->cond & YAHOO_INPUT_READ) { - - for (i = 0; i < ridx; i++) { + + for (i = 0; i < ridx; i++) { if ((HANDLE)c->fd == nls.hReadConns[i]) { if (nls.hReadStatus[i]) { //LOG(("[YAHOO_INPUT_READ] Read Ready. Tag: %d fd: %d", c->tag, c->fd )); @@ -170,13 +171,13 @@ void __cdecl CYahooProto::server_main(void *empty) } }//if c->fd= }//for i = 0 - + } /* are we waiting for a Write request? */ if (c->cond & YAHOO_INPUT_WRITE) { - - for (i = 0; i < widx; i++) { + + for (i = 0; i < widx; i++) { if ((HANDLE)c->fd == nls.hWriteConns[i]) { if (nls.hWriteStatus[i]) { //LOG(("[YAHOO_INPUT_WRITE] Write ready. Tag: %d fd: %d", c->tag, c->fd )); @@ -197,9 +198,9 @@ void __cdecl CYahooProto::server_main(void *empty) debugLogA("Exited loop"); /* cleanup the data stuff and close our connection handles */ - while(m_connections) { + while (m_connections) { YList *tmp = m_connections; - struct _conn * c = ( _conn * )m_connections->data; + struct _conn * c = (_conn *)m_connections->data; Netlib_CloseHandle((HANDLE)c->fd); FREE(c); m_connections = y_list_remove_link(m_connections, m_connections); @@ -208,14 +209,14 @@ void __cdecl CYahooProto::server_main(void *empty) yahoo_close(m_id); - m_bLoggedIn = FALSE; + m_bLoggedIn = FALSE; m_status = YAHOO_STATUS_OFFLINE; m_id = 0; /* now set ourselves to offline */ BroadcastStatus(ID_STATUS_OFFLINE); - logoff_buddies(); + logoff_buddies(); debugLogA("Server thread ending"); } -- cgit v1.2.3