diff -r f108642d2da6 -r 77d18e17199b plugins/icq/proxy.c --- a/plugins/icq/proxy.c Tue May 29 09:46:05 2001 +0000 +++ b/plugins/icq/proxy.c Tue May 29 10:32:53 2001 +0000 @@ -1,116 +1,88 @@ /* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* -$Id: proxy.c 1442 2001-01-28 01:52:27Z warmenhoven $ -$Log$ -Revision 1.3 2001/01/28 01:52:27 warmenhoven -icqlib 1.1.5 - -Revision 1.9 2001/01/17 01:19:49 bills -cleanup - -Revision 1.8 2000/05/10 18:51:23 denis -icq_Disconnect() now called before icq_Disconnected callback to -prevent high CPU usage in kicq's "reconnect on disconnect" code. - -Revision 1.7 2000/05/03 18:29:15 denis -Callbacks have been moved to the ICQLINK structure. - -Revision 1.6 2000/04/05 14:37:02 denis -Applied patch from "Guillaume R." for basic Win32 -compatibility. - -Revision 1.5 1999/10/07 18:00:59 denis -proxy.h file removed. -Revision 1.4 1999/07/16 12:01:06 denis -ICQLINK support added. - -Revision 1.3 1999/07/12 15:13:33 cproch -- added definition of ICQLINK to hold session-specific global variabled - applications which have more than one connection are now possible -- changed nearly every function defintion to support ICQLINK parameter - -Revision 1.2 1999/04/14 14:51:42 denis -Switched from icq_Log callback to icq_Fmt function. -Cleanups for "strict" compiling (-ansi -pedantic) +/* + * Copyright (C) 1998-2001, Denis V. Dmitrienko and + * Bill Soudan + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * + */ -Revision 1.1 1999/03/24 11:37:38 denis -Underscored files with TCP stuff renamed. -TCP stuff cleaned up -Function names changed to corresponding names. -icqlib.c splitted to many small files by subject. -C++ comments changed to ANSI C comments. - -*/ - -#ifndef _WIN32 -#include -#else +#ifdef _WIN32 #include #endif #include -#include "util.h" -#include "icqtypes.h" -#include "icq.h" #include "icqlib.h" -void icq_HandleProxyResponse(ICQLINK *link) +void icq_HandleProxyResponse(icq_Link *icqlink) { int s; char buf[256]; #ifdef _WIN32 - s = recv(link->icq_ProxySok, buf, sizeof(buf), 0); + s = recv(icqlink->icq_ProxySok, buf, sizeof(buf), 0); #else - s = read(link->icq_ProxySok, &buf, sizeof(buf)); + s = read(icqlink->icq_ProxySok, &buf, sizeof(buf)); #endif if(s<=0) { - icq_FmtLog(link, ICQ_LOG_FATAL, "[SOCKS] Connection terminated\n"); - icq_Disconnect(link); - if(link->icq_Disconnected) - (*link->icq_Disconnected)(link); + icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection terminated\n"); + icq_Disconnect(icqlink); + invoke_callback(icqlink, icq_Disconnected)(icqlink); } } /******************* SOCKS5 Proxy support ********************/ -void icq_SetProxy(ICQLINK *link, const char *phost, unsigned short pport, int pauth, const char *pname, const char *ppass) +void icq_SetProxy(icq_Link *icqlink, const char *phost, unsigned short pport, + int pauth, const char *pname, const char *ppass) { - if(link->icq_ProxyHost) - free(link->icq_ProxyHost); - if(link->icq_ProxyName) - free(link->icq_ProxyName); - if(link->icq_ProxyPass) - free(link->icq_ProxyPass); + if(icqlink->icq_ProxyHost) + free(icqlink->icq_ProxyHost); + if(icqlink->icq_ProxyName) + free(icqlink->icq_ProxyName); + if(icqlink->icq_ProxyPass) + free(icqlink->icq_ProxyPass); if(strlen(pname)>255) { - icq_FmtLog(link, ICQ_LOG_ERROR, "[SOCKS] User name greater than 255 chars\n"); - link->icq_UseProxy = 0; + icq_FmtLog(icqlink, ICQ_LOG_ERROR, "[SOCKS] User name greater than 255 chars\n"); + icqlink->icq_UseProxy = 0; return; } if(strlen(ppass)>255) { - icq_FmtLog(link, ICQ_LOG_ERROR, "[SOCKS] User password greater than 255 chars\n"); - link->icq_UseProxy = 0; + icq_FmtLog(icqlink, ICQ_LOG_ERROR, "[SOCKS] User password greater than 255 chars\n"); + icqlink->icq_UseProxy = 0; return; } - link->icq_UseProxy = 1; - link->icq_ProxyHost = strdup(phost); - link->icq_ProxyPort = pport; - link->icq_ProxyAuth = pauth; - link->icq_ProxyName = strdup(pname); - link->icq_ProxyPass = strdup(ppass); + icqlink->icq_UseProxy = 1; + icqlink->icq_ProxyHost = strdup(phost); + icqlink->icq_ProxyPort = pport; + icqlink->icq_ProxyAuth = pauth; + icqlink->icq_ProxyName = strdup(pname); + icqlink->icq_ProxyPass = strdup(ppass); } -void icq_UnsetProxy(ICQLINK *link) +void icq_UnsetProxy(icq_Link *icqlink) { - link->icq_UseProxy = 0; + icqlink->icq_UseProxy = 0; } -int icq_GetProxySok(ICQLINK *link) +int icq_GetProxySok(icq_Link *icqlink) { - return link->icq_ProxySok; + return icqlink->icq_ProxySok; }