changeset 9973:09ed9a574761

[gaim-migrate @ 10884] Remove the old ICQ prpl committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Wed, 08 Sep 2004 03:11:41 +0000
parents 2c7c6bdb938b
children 37eb241b11ed
files src/protocols/icq/AUTHORS src/protocols/icq/CHANGES_SINCE_1.0 src/protocols/icq/COPYING src/protocols/icq/ChangeLog src/protocols/icq/INSTALL src/protocols/icq/Makefile.am src/protocols/icq/README src/protocols/icq/VERSION src/protocols/icq/chatsession.c src/protocols/icq/chatsession.h src/protocols/icq/contacts.c src/protocols/icq/contacts.h src/protocols/icq/cyrillic.c src/protocols/icq/eventhandle.c src/protocols/icq/eventhandle.h src/protocols/icq/filesession.c src/protocols/icq/filesession.h src/protocols/icq/gaim_icq.c src/protocols/icq/icq.h src/protocols/icq/icqbyteorder.c src/protocols/icq/icqbyteorder.h src/protocols/icq/icqevent.c src/protocols/icq/icqevent.h src/protocols/icq/icqlib.c src/protocols/icq/icqlib.h src/protocols/icq/icqpacket.c src/protocols/icq/icqpacket.h src/protocols/icq/icqtypes.h src/protocols/icq/list.c src/protocols/icq/list.h src/protocols/icq/proxy.c src/protocols/icq/queue.c src/protocols/icq/queue.h src/protocols/icq/socketmanager.c src/protocols/icq/socketmanager.h src/protocols/icq/stdpackets.c src/protocols/icq/stdpackets.h src/protocols/icq/tcp.c src/protocols/icq/tcp.h src/protocols/icq/tcpchathandle.c src/protocols/icq/tcpfilehandle.c src/protocols/icq/tcphandle.c src/protocols/icq/tcplink.c src/protocols/icq/tcplink.h src/protocols/icq/timeout.c src/protocols/icq/timeout.h src/protocols/icq/udp.c src/protocols/icq/udp.h src/protocols/icq/udphandle.c src/protocols/icq/util.c src/protocols/icq/util.h src/protocols/oscar/oscar.c
diffstat 52 files changed, 16 insertions(+), 12834 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/icq/AUTHORS	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,13 +0,0 @@
-Core Developers
----------------
-Denis V. Dmitrienko <denix@kde.org>
-Bill Soudan <soudan@kde.org>
-
-Python Bindings
----------------
-Michael Hudson <mwh21@cam.ac.uk>
-
-Retired Developers and Contributors
------------------------------------
-Vadim Zaliva <lord@crocodile.org>
-Nikita I. Makeev <whale@nichego.net>
--- a/src/protocols/icq/CHANGES_SINCE_1.0	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-This file is intended to be a list of source incompatible changes 
-that have been made since icqlib-1.0.0.
-
-2000-12-19: ICQLINKs have been reworked.  Members that provide no useful 
-information to the library client have been moved to a private structure 
-attached to the public ICQLINK, ICQLINK_private.  See icqlib.h.  ICQLINK 
-memory management now must be performed by the library (which is probably 
-how it should have always been), with icq_ICQLINKNew and 
-icq_ICQLINKDelete.
-
-2000-12-19: Your application is no longer responsible for allocating and
-freeing the ICQLINK structure, rather, it is returned as the result of a
-icq_ICQLINKNew call.  icq_ICQLINKDelete will free an ICQLINK structure.
-
-2000-12-19: icq_Init and icq_Done have been removed.  Use icq_ICQLINKNew
-and icq_ICQLINKDelete instead.  In addition, icq_ICQLINKNew has gained an
-additional parameter: a flag to turn TCP on or off.
-
-2001-01-16: The chat and file request/session interface has been
-significantly reworked.  icq_RequestNotify now will return
-ICQ_NOTIFY_SUCCESS as soon as the file or chat *request* is complete, but
-not before returning a handle to an icq_ChatSession or icq_FileSession.  
-See ICQ_NOTIFY_CHATSESSION and ICQ_NOTIFY_FILESESSION.  All future
-operations on the chat or file session should be performed using this
-handle and the appropriate icq_ChatSession* or icq_FileSession* functions.
-
-Old function             New function
-
-icq_TCPCloseChat         icq_ChatSessionClose
-icq_TCPSendChatData      icq_ChatSessionSendData
-icq_TCPSendChatData_n    icq_ChatSessionSendData_n
-
-In addition, notification messages for chat and file sessions come back 
-through two new callbacks: icq_ChatNotify and icq_FileNotify.  
-icq_ChatSession has also been exposed in the public interface, as well as 
-a number of chat status constants.
-
-Old notification                       New notification
-
-icq_RequestNotify/ICQ_NOTIFY_CHAT      icq_ChatNotify/CHAT_NOTIFY_STATUS
-icq_RequestNotify/ICQ_NOTIFY_CHATDATA  icq_ChatNotify/CHAT_NOTIFY_DATA
-icq_RequestNotify/ICQ_NOTIFY_SUCCESS   icq_ChatNotify/CHAT_NOTIFY_CLOSE
-
-icq_RequestNotify/ICQ_NOTIFY_FILE      icq_FileNotify/FILE_NOTIFY_STATUS
-icq_RequestNotify/ICQ_NOTIFY_FILEDATA  icq_FileNotify/FILE_NOTIFY_DATAPACKET
-icq_RequestNotify/ICQ_NOTIFY_SUCCESS   icq_FileNotify/FILE_NOTIFY_CLOSE
-
-Finally, some fake file status values now come through separate 
-FILE_NOTIFY events, and one has been renamed:
-
-Old status                         New Notification/Status
-
-FILE_STATUS_NEW_SPEED              icq_FileNotify/FILE_NOTIFY_NEW_SPEED
-FILE_STATUS_STOP_FILE              icq_FileNotify/FILE_NOTIFY_STOP_FILE
-FILE_STATUS_INITIALIZED            FILE_STATUS_INITIALIZING
-
-2001-01-16: icqlib now reports when it needs read and write ready 
-notifications for sockets through icq_SocketNotify.  Install a callback 
-for the icq_SocketNotify function, which takes the following parameters:
-
-   void (*icq_SocketNotify)(int socket, int type, int status);
-
-socket will be the socket number, type will be either ICQ_SOCKET_READ or 
-ICQ_SOCKET_WRITE, and status will be either true or false, true indicating 
-icqlib now needs notification, and false indicating icqlib no longer needs 
-notification.  Your application should use this to install some sort of 
-socket notification object (e.g., in kicq, we use a QSocketNotifier).  
-When the socket is ready, you should invoke the new 
-icq_HandleReadySocket(socket, type) function.
-
-This mechanism is completely optional - you can simply set up a timer to 
-call icq_Main every 1/10 of a second or so.  This has the disadvantage of 
-wasting CPU cycles and poor TCP file transfer performance, though.
-
-2001-02-20: The icq_SetTimeout callback has been moved outside of the 
-ICQLINK structure, and icq_HandleTimeout no longer requires an ICQLINK 
-parameter.
-
-2001-03-03: ICQLINK is now icq_Link, to fit better with the icqlib
-naming conventions.  ICQLINK should be considered depreciated - it is 
-still supported for now, but may disappear in a future icqlib release.
--- a/src/protocols/icq/COPYING	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,339 +0,0 @@
-		    GNU GENERAL PUBLIC LICENSE
-		       Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
-                          675 Mass Ave, Cambridge, MA 02139, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
-			    Preamble
-
-  The licenses for most software are designed to take away your
-freedom to share and change it.  By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users.  This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it.  (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.)  You can apply it to
-your programs, too.
-
-  When we speak of free software, we are referring to freedom, not
-price.  Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
-  To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
-  For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have.  You must make sure that they, too, receive or can get the
-source code.  And you must show them these terms so they know their
-rights.
-
-  We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
-  Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software.  If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
-  Finally, any free program is threatened constantly by software
-patents.  We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary.  To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
-  The precise terms and conditions for copying, distribution and
-modification follow.
-
-		    GNU GENERAL PUBLIC LICENSE
-   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
-  0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License.  The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language.  (Hereinafter, translation is included without limitation in
-the term "modification".)  Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope.  The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
-  1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
-  2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
-    a) You must cause the modified files to carry prominent notices
-    stating that you changed the files and the date of any change.
-
-    b) You must cause any work that you distribute or publish, that in
-    whole or in part contains or is derived from the Program or any
-    part thereof, to be licensed as a whole at no charge to all third
-    parties under the terms of this License.
-
-    c) If the modified program normally reads commands interactively
-    when run, you must cause it, when started running for such
-    interactive use in the most ordinary way, to print or display an
-    announcement including an appropriate copyright notice and a
-    notice that there is no warranty (or else, saying that you provide
-    a warranty) and that users may redistribute the program under
-    these conditions, and telling the user how to view a copy of this
-    License.  (Exception: if the Program itself is interactive but
-    does not normally print such an announcement, your work based on
-    the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole.  If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works.  But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
-  3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
-    a) Accompany it with the complete corresponding machine-readable
-    source code, which must be distributed under the terms of Sections
-    1 and 2 above on a medium customarily used for software interchange; or,
-
-    b) Accompany it with a written offer, valid for at least three
-    years, to give any third party, for a charge no more than your
-    cost of physically performing source distribution, a complete
-    machine-readable copy of the corresponding source code, to be
-    distributed under the terms of Sections 1 and 2 above on a medium
-    customarily used for software interchange; or,
-
-    c) Accompany it with the information you received as to the offer
-    to distribute corresponding source code.  (This alternative is
-    allowed only for noncommercial distribution and only if you
-    received the program in object code or executable form with such
-    an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it.  For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable.  However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
-  4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License.  Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
-  5. You are not required to accept this License, since you have not
-signed it.  However, nothing else grants you permission to modify or
-distribute the Program or its derivative works.  These actions are
-prohibited by law if you do not accept this License.  Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
-  6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions.  You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
-  7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License.  If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all.  For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices.  Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
-  8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded.  In such case, this License incorporates
-the limitation as if written in the body of this License.
-
-  9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time.  Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number.  If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation.  If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
-  10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission.  For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this.  Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
-			    NO WARRANTY
-
-  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
-  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
-		     END OF TERMS AND CONDITIONS
-
-	Appendix: How to Apply These Terms to Your New Programs
-
-  If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
-  To do so, attach the following notices to the program.  It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-    <one line to give the program's name and a brief idea of what it does.>
-    Copyright (C) 19yy  <name of author>
-
-    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.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
-    Gnomovision version 69, Copyright (C) 19yy name of author
-    Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
-    This is free software, and you are welcome to redistribute it
-    under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License.  Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary.  Here is a sample; alter the names:
-
-  Yoyodyne, Inc., hereby disclaims all copyright interest in the program
-  `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
-  <signature of Ty Coon>, 1 April 1989
-  Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs.  If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library.  If this is what you want to do, use the GNU Library General
-Public License instead of this License.
--- a/src/protocols/icq/ChangeLog	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1375 +0,0 @@
-2001-06-11  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/filesession.c:
-	Applied patch #431942 which fixes Win32-specific typo.
-
-	* icqlib/tcp.c:
-	Applied patch #431945 which adds icq_TCPSendAwayMessageReq() function.
-
-	* icqlib/contacts.c:
-	Applied patch #431950 which fixes bug with invisibility to a random
-	set of buddies.
-
-2001-06-08  Denis V. Dmitrienko  <denix@kde.org>
-
-	* admin/acinclude.m4.in, admin/config.guess, admin/config.sub,
-	admin/install-sh, admin/libtool.m4.in, admin/ltcf-c.sh,
-	admin/ltcf-cxx.sh, admin/ltcf-gcj.sh, admin/ltconfig,
-	admin/ltmain.sh, admin/Makefile.am, admin/missing,
-	admin/mkinstalldirs, configure.in:
-	Updated autoconf/automake files from KDE to support autoconf 2.50
-
-	* doc/bindings/python/.cvsignore, doc/bindings/python/Makefile.am,
-	doc/bindings/.cvsignore, doc/bindings/Makefile.am, doc/.cvsignore,
-	doc/Makefile.am, bindings/python/.cvsignore,
-	bindings/python/Makefile.am, bindings/cpp/.cvsignore,
-	bindings/cpp/Makefile.am, bindings/.cvsignore,
-	bindings/Makefile.am, admin/.cvsignore, admin/Makefile.am,
-	configure.in, Makefile.am, README, VERSION:
-	Version bumped to 1.2.0
-
-	* icqlib/icqpacket.c, icqlib/list.c: Fixed Alpha-specific warnings.
-
-	* admin/icqlib.m4.in, icqlib.spec.in, icqlib-1.0.0.lsm, DEVEL,
-	AUTHORS:
-	Changed email address.
-
-	* icqlib/icqlib.c:
-	Added UpdateSuccess & UpdateFailure callacks initialization.
-
-2001-06-05  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/icqbyteorder.h, configure.in:
-	Applied patch by Lars Christensen <larsch@cs.auc.dk> to use portable
-	autoconf's endianness test.
-
-	* icqlib/icq.h.in, icqlib/udp.h, icqlib/udphandle.c:
-	Applied patch by Lars Christensen <larsch@cs.auc.dk> which adds 2 new
-	callbacks - icq_UpdateSuccess & icq_UpdateFailure
-
-2001-06-05  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/udphandle.c: Added code to send invisible list on login.
-
-	* AUTHORS: Added Michael Hudson.
-
-	* CHANGES_SINCE_0.1.3:
-	Added 0.1.3 -> 1.0.0 migration comments by Peter M. Lemmen
-	<pmlemmen@users.sourceforge.net>
-
-	* icqlib/icq.h.in, icqlib/contacts.c:
-	Changed parameter's name for readability.
-
-	* icqlib/icqlib.c, icqlib/tcp.c: Cleanups.
-
-	* CHANGES_SINCE_1.0: Spell-checked.
-
-2001-06-05  Michael Hudson  <mwh21@cam.ac.uk>
-
-	* bindings/python/icqlibmodule.c:
-	Whitespace prettyification; no functional changes.
-	These have been sitting around here for weeks!  Oops.
-
-2001-06-04  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/udphandle.c:
-	Make sure to send Acknowledgement packet before callback.
-
-	* icqlib/udp.c: Added use of ICQ_MAX_UDP_MESSAGE_SIZE constant.
-
-	* icqlib/icqpacket.c, icqlib/icqpacket.h, icqlib/udphandle.c:
-	Added handling for V3 Wrong Password packet.
-
-	* icqlib/proxy.c: "Do it right" fix for the previous one. ;)
-
-	* icqlib/icqtypes.h: More Win32 compatibility fixes.
-
-2001-06-04  Bill Soudan  <soudan@kde.org>
-
-	Applied patch via email from Richard Hughes <richard@rhughes.net>.
-	Applied sf patches #429108 and #429111 from Michael Möller
-	<mcmoe@users.sourceforge.net>.
-
-	* icqlib/filesession.c: win32 compatability fixes, bugfixes.
-
-	* icqlib/icq.h.in: add ICQ_MAX_* constants, away message request
-	and callback.
-
-	* icqlib/icqlib.c: fix crash in icq_LinkDestroy when tcp was
-	disabled, cleanups.
-
-	* icqlib/proxy.c: don't crash if NULL is passed in for pname and
-	ppass to icq_SetProxy
-
-	* icqlib/socketmanager.h, icqlib/tcplink.c: win32 compatability
-	fixes.
-
-	* icqlib/stdpackets.c, icqlib/stdpackets.h: added 
-	icq_TCPCreateAwayReqPacket
-
-	* icqlib/tcp.c: use ICQ_MAX_MESSAGE_SIZE constant, win32 fixes,
-	copy files array in icq_SendFileRequest, bugfix for file xfer.
-
-	* icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c: factoring
-
-	* icqlib/tcphandle.c: away message request support
-
-2001-05-28  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/contacts.c, icqlib/list.h, icqlib/queue.c, 
-	icqlib/socketmanager.c, icqlib/tcplink.c, icqlib/util.c:
-	fix typo, icq_LinkEnqueue->icq_ListEnqueue, icq_LinkDequeue->
-	icq_ListDequeue
-
-	* icqlib/timeout.c: fix icq_Link->icq_List typo, fix memory
-	leak in icq_HandleTimeout
-
-	* icqlib/list.c: don't delete list items if NULL is passed into
-	icq_ListDelete for item_free_f
-
-2001-05-24  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/udp.c:
-	Fixed memory leak - acknowledgement packet never been freed!!!
-
-2001-05-23  Denis V. Dmitrienko  <denix@kde.org>
-
-	* icqlib/icqlib.c, icqlib/udphandle.c:
-	UDP implementation of the Receive Contact List feature.
-
-	* icqlib/icqbyteorder.c, icqlib/icqbyteorder.h, configure.in:
-	Portability changes.
-
-	* icqlib/icqlib.h, CHANGES_SINCE_1.0: Cleanup.
-
-	* icqlib/cyrillic.c:
-	Applied koi8-u related patch by Kunytsa Olexander <xakep@snark.ukma.kiev.ua>
-
-2001-04-04  Bill Soudan  <soudan@kde.org>
-
-	Reverted my previous commit.
-
-2001-03-08  Bill Soudan  <soudan@kde.org>
-
-	First partial merge from patch by Jindrich Makovicka 
-	<makovick@KMLinux.fjfi.cvut.cz>: add support for czech encoding.
-	
-	* icqlib/cyrillic.c: renamed to encoding.c
-
-	* icqlib/encoding.c, icqlib/encoding.h: added
-
-	* icqlib/filesession.c, icqlib/icqpacket.c,
-	icqlib/icqpacket.h, icqlib/stdpackets.c, icqlib/stdpackets.h,
-	icqlib/tcp.c, icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c,
-	icqlib/tcphandle.c, icqlib/tcplink.c, icqlib/udp.c,
-	icqlib/udphandle.c: Generalized icq_RusConv function to
-	icq_Translate, moved encoding/decoding to icq_Packet abstraction.
-	Encoding/decoding now happens automatically when reading and
-	writing strings to packets.
-
-	* icqlib/icqlib.c, icqlib/icq.h.in: added icq_LinkSetEncoding
-	and new ICQ_ENCODING_NONE, ICQ_ENCODING_RUSSIAN, and
-	ICQ_ENCODING_CZECH constants.
-
-	* icqlib/Makefile.am: cyrillic.c -> encoding.c
-
-2001-03-07  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/*: More source cleanup - simplified dependencies.
-
-2001-03-06  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/*: Many source cleanups!
-
-	1. linked list functions and structures renamed to avoid symbol
-	clashes (from list * to icq_List*) with MySQL
-
-	2. ICQLINK renamed to icq_Link to match existing icqlib style
-	(Note ICQLINK is still defined in the headers to maintain
-	source compatability)
-
-	3. Standard GNU header added to all source files
-
-	4. Many, many --enable-strict cleanups.
-
-	5. new invoke_callback macro used to invoke icqlink callbacks.
-
-	* icqlib/icqlib.c, icqlib/icq.h.in: Added icq_LinkInit and 
-	icq_LinkDestroy functions, to support C++ bindings, removed
-	ICQLINK parameter from icq_Main.
-
-	* icqlib/timeout.c: fixed bug in icq_TimeoutDelete that resulted
-	in erroneous icq_SetTimeout calls
-
-2001-03-05  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/tcplink.c: applied patch from Eric Warmenhoven 
-	<warmenhoven@yahoo.com>, corrects TCP recv error bug that
-	causes 100% cpu usage
-
-	* bindings/cpp/build_icqlink.py, bindings/cpp/icqlink.h.tpl,
-	bindings/cpp/icqlink.cpp.tpl: added very beginnings of C++
-	bindings
-
-	* icqlib/icq.h.in: wrap callbacks with special begin and end
-	indicators for use with C++ bindings build script
-
-2001-03-03  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/chatsession.c, icqlib/filesession.c, icqlib/icq.h.in:
-	add user_data member to icq_ChatSession and icq_FileSession
-
-	* icqlib/icq.h.in, icqlib/tcplink.c: add compile fix for BeOS
-
-	* README.BeOS: added
-
-2001-03-01  Bill Soudan  <soudan@kde.org>
-
-	This should fix all problems introduced by my 02-22 commit.
-
-	* icqlib/icqlib.c: only initialize TCP subsystem when use_tcp is 
-	enabled
-
-	* icqlib/timeout.c: don't crash when timeouts are deleted during 
-	icq_HandleTimeout, send a zero-length icq_SetTimeout when
-	appropriate to clear current timeout request
-
-	* icqlib/udp.c: rewrote icq_UDPEncode and icq_UDPCheckCode
-	functions to do their work in a seperate buffer so original
-	icq_Packet isn't corrupted, fixed bug where UDP_CMD_ACKs were
-	being queued on the UDP packet queue
-
-2001-02-22  Bill Soudan  <soudan@kde.org>
-
-	Note the icq_SetTimeout callback has been moved outside of
-	the ICQLINK structure, and icq_HandleTimeout no longer 
-	requires an ICQLINK parameter.  TCP connect timeouts should
-	work once again.
-
-	* icqlib/filesession.c: fixed initialization bug that may
-	cause a crash on file session deletion
-
-	* icqlib/Makefile.am, icqlib/timeout.c, icqlib/timeout.h,
-	icqlib/icq.h.in, icqlib/icqlib.c: new timeout manager code,
-	correct compilation warnings
-
-	* icqlib/list.c, icqlib/list.h: added sorted list capability -
-	see list_insert_sorted and new compare_function list struct
-	member
-
-	* icqlib/queue.c, icqlib/queue.h, icqlib/tcp.c, icqlib/tcplink.c,
-	icqlib/tcplink.h, icqlib/udp.c, icqlib/udphandle.c:
-	port tcp connect timeout code and UDP queue to new timeout
-	manager
-
-	* icqlib/socketmanager.c: move icq_SocketHandler declaration
-	here, instead of declaring it in icqlib.c.  fix bug with
-	icq_SocketPoll/icq_SocketMain, as reported by Michael Hudson.
-
-	* bindings/python/icqlibmodule.c: ported to new timeout
-	interface - remove SetTimeout callback and HandleTimeout 
-	methods from PyICQLink class, add icqlib.InstallTimeoutHandler 
-	and icqlib.HandleTimeout methods.
-	
-2001-01-27  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/socketmanager.c, icqlib/socketmanager.h, 
-	icqlib/tcplink.c: fix bugs related to TCP and new socket manager:
-	implemented accepting TCP sockets, fixed crashes when sending
-	TCP messages.
-
-2001-01-24  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/stdpackets.c, icqlib/stdpackets.h, icqlib/tcphandle.c,
-	icqlib/icq.h.in: applied patch from Robin Ericsson 
-	(lobbin@localhost.nu) which implements receiving contact lists.  
-	See new icq_RecvContactList callback.
-	
-2001-01-20  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/chatsession.c, icqlib/icq.h.in: added documentation
-
-	* icqlib/icqbyteorder.h: applied patch from Eric Warmenhoven
-	to fix byte order on HP/UX.
-
-	* icqlib/tcplink.h: applied patch from Eric Warmenhoven to
-	fix compilation on FreeBSD.
-
-2001-01-16  Bill Soudan  <soudan@kde.org>
-
-	Phase 2 of my interface cleanups.  See CHANGES_SINCE_1.0 for
-	more details.  icqlib developers be sure to look at 
-	socketmanager.c - all future socket create/delete/handling needs 
-	to go through this code so the new icq_SocketNotify callback
-	works properly.
-
-	* icqlib/socketmanager.c, icqlib/socketmanager.h, 
-	icqlib/Makefile.am: added socketmanager.c & socketmanager.h
-
-	* icqlib/contacts.h, icqlib/list.h, icqlib/proxy.c: cleanup
-
-	* icqlib/chatsession.c, icqlib/chatsession.h, icqlib/filesession.c,
-	icqlib/icq.h.in, icqlib/icqevent.c, icqlib/icqevent.h, 
-	icqlib/icqlib.c, icqlib/icqlib.h, icqlib/tcp.c, 
-	icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c, 
-	icqlib/tcphandle.c, icqlib/tcplink.c, icqlib/tcplink.h:
-	Rework chat and file interfaces; implement socket notifications.
-
-	* VERSION: bumped to 1.1.5
-
-2001-01-16  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/contacts.c, icqlib/contacts.h, icqlib/icq.h.in, icqlib/udp.c:
-	Invisible list has been finished.
-
-2001-01-15  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/tcplink.c:
-	Applied patch from Ilya Melamed <ilya@ort.org.il> which fixes random
-	icq_TCPLinkAccept() fails.
-
-	* icqlib/udphandle.c:
-	Applied patch from Andrey Chernomyrdin <andrey@excom.spb.su> to
-	handle icq2000 specific "You've been added" packet.
-
-	* icqlib/icq.h.in:
-	Prototype for icq_SendInvisibleList() has been added.
-
-	* .cvsignore, icqlib.spec.in:
-	Applied patch from Ryan Weaver <ryanw@infohwy.com> for .spec file
-	generation.
-
-	* configure.in, Makefile.am, Makefile.cvs, admin/acinclude.m4.in,
-	admin/config.guess, admin/config.sub, admin/icqlib.m4.in,
-	admin/install-sh, admin/libtool.m4.in, admin/ltconfig,
-	admin/ltmain.sh, admin/missing, admin/mkinstalldirs,
-	acinclude.m4.in, am_edit, config.guess, config.sub, icqlib.m4.in,
-	install-sh, libtool.m4.in, ltconfig, ltmain.sh, missing,
-	mkinstalldirs:
-	autoconf/automake files have been moved to admin directory.
-
-	* TODO, icqlib/icqlib.c: Cleanup.
-
-2000-12-19  Bill Soudan  <wes0472@rit.edu>
-
-	* icqlib/chatsession.c, icqlib/contacts.c, icqlib/eventhandle.c,
-	icqlib/filesession.c, icqlib/icq.h.in, icqlib/icqlib.c,
-	icqlib/icqlib.h, icqlib/queue.c, icqlib/stdpackets.c,
-	icqlib/tcp.c, icqlib/tcplink.c icqlib/udp.c: moved some ICQLINK
-	members to ICQLINK_private structures, added icq_ICQLINKNew and
-	icq_ICQLINKDelete functions which replace icq_Init and icq_Done
-
-	* CHANGES_SINCE_1.0: lists source incompatable changes since
-	1.0 release.
-
-	* VERSION: bumped version number to 1.1
-
-2000-12-06  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/queue.c, icqlib/stdpackets.h, icqlib/tcp.h, icqlib/tcphandle.c:
-	Handling for mass TCP messages has been added based on patch by
-	Konstantin Klyagin <konst@konst.org.ua>
-
-2000-12-03  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/queue.c: fixed compilation with gcc-2.96
-
-	* icqlib/tcplink.c: fixed bug #105068
-
-2000-11-02  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/icq.h.in, icqlib/icqlib.c, icqlib/udp.c:
-	Ability to disable TCP protocol has been added.
-
-	* icqlib/udphandle.c: Do not ack unhandled protocol version.
-
-2000-08-13  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/tcphandle.c:
-	Cyrillic recoding on received URL description added.
-
-	* icqlib/icq.h.in, icqlib/util.c: icq_Genders[] array have been added.
-
-2000-08-13  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udp.c: Patch #101057 have been applied.
-
-2000-07-31  Denis V. Dmitrienko  <denis@null.net>
-
-	* .cvsignore, Makefile.am: Little modifications before releasing.
-
-2000-07-30  Denis V. Dmitrienko  <denis@null.net>
-
-	* ChangeLog, icqlib-0.2.0.lsm, icqlib-1.0.0.lsm, README, TODO,
-	VERSION, Win32.zip:
-	Updated version for 1.0.0 release.
-
-2000-07-25  Denis V. Dmitrienko  <denis@null.net>
-
-	* README: Description was changed a little.
-
-	* icqlib/icq.h.in: Cleanups.
-
-2000-07-23  Bill Soudan  <soudan@kde.org>
-
-	* README: added description
-
-	* icqlib/icq.h.in, icqlib/icqlib.c, icqlib/tcpchathandle.c,
-	icqlib/tcpfilehandle.c: added support for real nickname during
-	TCP transactions like file and chat, instead of using Bill
-	all the time (hmm, where'd I get that from? :)
-
-2000-07-22  Denis V. Dmitrienko  <denis@null.net>
-
-	* AUTHORS, DEVEL, icqlib-0.1.3.lsm, icqlib-0.2.0.lsm, README, TODO:
-	Text files in root directory were changed to reflect latest changes.
-
-2000-07-22  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/util.c: Trinidad and Tobago country was added.
-
-	* icqlib/icq.h.in: Cleanups.
-
-2000-07-21  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/util.c: All languages, possible in original icq were added.
-	Occupation array fixed.
-
-2000-07-20  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/util.c:
-	Occupation table corrected to comply with original ICQ.
-
-2000-07-09  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/list.c: added more trace messages, added list_remove_node
-	call in list_free... fixes list corruption bug introduced
-	during last commit
-
-	* icqlib/queue.c: added more trace messages, reworked packet
-	delete handling: now happens during _icq_UDEQueueItemFree rather
-	than during icq_UDPQueueDelSeq - fixes memory leak
-
-2000-07-09  Bill Soudan  <soudan@kde.org>
-
-	Cleanups, and nasty memory bug fixes.  Hopefully this will
-	correct the strange crashes Denis is having after the icq_Done
-	call!
-
-	The major problem was: icq_TCPLinkDelete and icq_FileSessionDelete
-	were calling list_remove to remove themselves from the global
-	TCPLink and FileSession lists kept in ICQLINK.  But, these
-	functions were being called from a list_delete call also,
-	in icq_TCPDone, so what was happening is the list_nodes were
-	getting free()ed twice!
-
-	This problem was circumvented by removing the list_remove
-	from the *Delete functions, and creating new Close functions
-	that do the list_remove and then call the corresponding 
-	Delete function.
-
-	* icqlib/chatsession.c, icqlib/chatsession.h, icqlib/filesession.c,
- 	icqlib/tcp.c, icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c,
-	icqlib/tcplink.c, icqlib/tcplink.h, icqlib/udp.c,
-	icqlib/stdpackets.h: adding new *Close functions, use *Close
-	functions instead of *Delete where correct, and misc cleanups
-
-	* icqlib/icq.h.in: removed unnecessary members from ICQLINK
-
-	* icqlib/icqlib.c, icqlib/icqlib.h: removed unnecessary
-	functions
-
-	* icqlib/list.c, icqlib/list.h: recoded list_free function - this
-	was working very incorrectly!  it was only freeing the first
-	node of the list, and then ending.  fixes a memory leak.
-
-	* icqlib/queue.c: use new list_free 
-
-	* icqlib/tcp.c: use Close functions, misc cleanups
-
-2000-07-09  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/icq.h.in: Cleanups.
-
-	* icqlib/icqlib.c:
-	Initial memset() in icq_Init() replaced by callback's clearance.
-
-	* icqlib/udp.c:
-	icq_UpdateNewUserInfo() now returns seq1 instead of seq2 since it
-	isn't META function.
-
-2000-07-07  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/icqpacket.c:
-	"icq_Packet data overflow" log message temporarily commented out.
-
-2000-07-04  Paul Cadach          <paul@odt.east.telecom.kz>
-	* icqlib/utilc:
-	icq_FmtLog() crashed when it receives NULL at link argument.
-
-2000-06-30  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/util.c: Slovak Republic country code fixed.
-
-2000-06-25  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udphandle.c:
-	icq_HandleMetaUserInfo() handles all (!) available in original icq2k
-	Meta User Info packets along with other useful Meta* packets. (WOW! ;)
-
-	* icqlib/icq.h.in:
-	New callbacks (we really need an event-driven model later):
-	icq_MetaUserFound, icq_MetaUserInfo, icq_MetaUserWork,
-	icq_MetaUserMore, icq_MetaUserAbout, icq_MetaUserInterests,
-	icq_MetaUserAffiliations, icq_MetaUserHomePageCategory
-	New functions-companions for Meta User Info:
-	icq_GetMetaOccupationName(), icq_GetMetaBackgroundName(),
-	icq_GetMetaAffiliationName(), icq_GetMetaLanguageName()
-	New function to request Meta User Info icq_SendMetaInfoReq()
-	COUNTRY_CODE was "generalized" to icq_ArrayType. Note: this is
-	source incompatible change!
-
-	* icqlib/util.c: icq_MetaOccupation[], icq_MetaPastBackgrounds[],
-	icq_MetaAffiliations[] and icq_MetaLanguages[] arrays were added along
-	with icq_GetMetaOccupationName(), icq_GetMetaBackgroundName(),
-	icq_GetMetaAffiliationName() and icq_GetMetaLanguageName() functions
-	to access them.
-
-	* icqlib/udp.h: Some META* defines changed/added.
-	USER_INFO structure which is never been used now removed.
-
-	* icqlib/udp.c: icq_SendMetaInfoReq() was added.
-	All icq_*Meta*() functions now returns sequence number 2 because their
-	replies from the server are synced with it.
-
-	* icqlib/tcphandle.c, icqlib/tcpfilehandle.c, icqlib/eventhandle.c:
-	'\n' was added at the end of log messages.
-
-	* icqlib/queue.c:
-	Some sanity checks were added to icq_UDPQueueDelete() and
-	icq_UDPQueueFree()
-
-	* icqlib/icqpacket.c: icq_PacketUDPDump() tweaked a little.
-
-2000-06-17  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/contacts.c, icqlib/icq.h.in:
-	New parameter was added in icq_ContactSetVis() for setting/resetting
-	'Visible to User' status.
-	Port's type was changed to unsigned short in icq_UserOnline callback.
-
-2000-06-15  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/icqevent.c, icqlib/icqevent.h, icqlib/eventhandle.c,
-	icqlib/eventhandle.h: committed for safekeeping, not used yet.
-	this code will soon replace stdpackets.c and tcphandle.c, as
-	well as reducing code duplication in many other places.  hopefully
-	it can eventually be extended to manage udp events as well, as
-	it's written in pseudo-object-oriented style.
-
-2000-06-14  Bill Soudan  <soudan@kde.org>
-
-	Bugfixes and code cleanups.
-
-	* icqlib/filesession.c, icqlib/filesession.h: added id arg to
-	icq_FindFileSession to allow searches for specific file session
-
-	* icqlib/icq.h.in: removed *Seq functions, renamed chat req functions
-	to be consistent with file req functions, added Cancel and Refuse
-	functions for chat and file reqs
-
-	* icqlib/queue.h: added proto for icq_UDPQueueInterval
-
-	* icqlib/stdpackets.c, icqlib/stdpackets.h: added creation
-	functions for cancel and refuse operations
-
-	* icqlib/tcp.c, icqlib/tcp.h: added Cancel and Refuse functions
-	for chat and file reqs, changed packet sending code to use new
-	icq_TCPLinkSendSeq function to elimitane duplicate code, removed
-	*Seq functions, renamed chat req functions
-
-	* icqlib/tcpfilehandle.c: fixed bug: sending file sessions would
-	freeze if remote side changed speed
-
-	* icqlib/tcplink.c, icqlib/tcplink.h: added icq_TCPLinkSendSeq
-	function
-
-	* icqlib/icqlib.c, icqlib/udp.c: removed *Seq functions
-
-2000-05-21  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/util.c: Bulgaria country code was added. Thanks to
-	"Napalm Death" <napalmbox@hotmail.com>
-
-	* icqlib/cyrillic.c: Applied patch for russian letters IO and io by
-	Vladimir Eltchinov <elik@design.ru>
-
-2000-05-10  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/icq.h.in, icqlib/icqlib.c, icqlib/queue.c,
-	icqlib/queue.h, icqlib/udp.c:
-	UDP outgoing packet queue was implemented.
-
-	* icqlib/udphandle.c, icqlib/proxy.c:
-	icq_Disconnect() now called before icq_Disconnected callback to
-	prevent high CPU usage in kicq's "reconnect on disconnect" code.
-
-	* icqlib/list.c, icqlib/list.h:
-	list_free() was added to free but do not dispose the list.
-	Memory leak with destroying the list was fixed.
-
-2000-05-05  Denis V. Dmitrienko  <denis@null.net>
-
-	* Win32.zip:
-	Automatically generated icq.h repackaged for Win32 portability.
-
-2000-05-04  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/tcp.h: undefined TCP debug trace constants in preparation
-	for release.
-
-	* icqlib/stdpackets.c: warning cleanups.
-
-	* icqlib/icq.h.in: changed FILE_STATUS_* defines, removed
-	many ICQ_NOTIFY_FILE* defines, added new direction member
-	to icq_FileSession, removed unnecessary uin arg from
-	icq_FileSessionSetSpeed.
-
-	* icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c, icqlib/tcphandle.c,
-	icqlib/tcplink.c, icqlib/filesession.c, icqlib/tcp.c:
-	Reworked file transfer notification, small bugfixes,
-	and cleanups.
-
-2000-05-03  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udp.c: icq_UpdateNewUserInfo() was added.
-	All icq_UpdateMetaInfo*() now return their sequence number.
-
-	* icqlib/chatsession.c, icqlib/filesession.c, icqlib/icq.h.in,
-	icqlib/Makefile.am, icqlib/proxy.c, icqlib/tcpchathandle.c,
-	icqlib/tcpfilehandle.c, icqlib/tcphandle.c, icqlib/tcplink.c,
-	icqlib/udphandle.c, icqlib/util.c, icqlib/callbacks.c:
-	Callbacks have been moved to the ICQLINK structure.
-
-	* icqlib/icqpacket.c, icqlib/icqpacket.h:
-	icq_PacketReadUDPInUIN() was added.
-
-	* icqlib/list.c: Bug with empty contact list was fixed.
-
-	* icqlib/icqlib.c: Unfinished UDP queue was commented out.
-
-2000-04-13  Denis V. Dmitrienko  <denis@null.net>
-
-	* README.Win32, VC5.zip, Win32.zip:
-	icq.h header file which is automatically generated on Unix is packaged
-	in Win32.zip archive along with the Visual C++ 5.0 project file.
-
-2000-04-10  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/chatsession.h, icqlib/filesession.h, icqlib/stdpackets.c,
-	icqlib/tcp.c, icqlib/tcpfilehandle.c, icqlib/tcplink.c:
-	ANSI cleanups.
-
-	* icqlib/filesession.c, icqlib/icqlib.c, icqlib/stdpackets.h,
-	icqlib/tcp.c, icqlib/tcpfilehandle.c, icqlib/tcp.h,
-	icqlib/tcplink.c, icqlib/udp.c, icqlib/udp.h, icqlib/util.c,
-	VC5.zip:
-	Some more Win32 compatibility from Guillaume Rosanis <grs@mail.com>
-
-2000-04-06  Herbert Valerio Riedel  <hvr@gnu.org>
-
-	* icqlib/icq.h.in, icqlib/udp.c (icq_KeepAlive,icq_SendAuthMsg):
-	return sequence number
-
-2000-04-06  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/icq.h.in, icqlib/icqlib.c, icqlib/stdpackets.c, icqlib/tcp.c:
-	icq_*Send*Seq() functions with specified sequence number were added.
-
-	* icqlib/udp.c:
-	So called "Online List problem" bug with Long Contact List was fixed.
-	icq_*Send*Seq() functions with specified sequence number were added.
-
-2000-04-05  Denis V. Dmitrienko  <denis@null.net>
-
-	* README.Win32, VC5.zip, icqlib/icqbyteorder.h, icqlib/icq.h.in,
-	icqlib/icqlib.c, icqlib/icqlib.h, icqlib/icqpacket.c,
-	icqlib/icqtypes.h, icqlib/proxy.c, icqlib/tcp.c,
-	icqlib/tcpchathandle.c, icqlib/tcpfilehandle.c,
-	icqlib/tcphandle.c, icqlib/tcplink.c, icqlib/tcplink.h,
-	icqlib/udp.c, icqlib/util.c, icqlib/util.h:
-	Applied patch from "Guillaume R." <grs@mail.com> for basic Win32
-	compatibility.
-
-2000-03-31  Igor S. Petrenko <nofate@europe.com>
-
-	* icqlib/util.c: remove static variable
-
-2000-03-30  Denis V. Dmitrienko  <denis@null.net>
-
-	* am_edit, configure.in, libtool.m4.in, ltconfig, ltmain.sh,
-	missing, mkinstalldirs, acinclude.m4.in, Makefile.cvs:
-	New autoconf/automake stuff from KDE2.
-
-	* icqlib/queue.c: Fixed FreeBSD warning about obsolete malloc.h
-	header.
-
-2000-02-14  Bill Soudan  <soudan@kde.org>
-
-	Applied patch from Paul Cadach <paul@odt.east.telecom.kz>.
-
-	* icqlib/icq.h.in: added icq_TCPSendChatData_n
-
-	* icqlib/tcp.c: use new icq_ChatRusConv_n function in
-	icq_TCPSendChatData, new icq_TCPSendChatData_n function
-
-	* icqlib/tcplink.c, tcplink.h: new icq_ChatRusConv_n function
-
-2000-02-06  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/tcpchathandle.c: warning cleanups.
-
-2000-02-06  Bill Soudan  <soudan@kde.org>
-
-	Applied patch from Paul Cadach <paul@odt.east.telecom.kz>.  
-	Thanks Paul!
-
-	Paul's change list:
-
-	1) Modified TCP link code to allow non-blocking TCP connects over 
-	SOCKS5 proxy
-	2) Added missed Cyrillic translating for Chat subject, URL subject, 
-	File transfer subject (both directions);    
-	3) Fix a bug in TCPLinkProxyConnect code (remote address was random 
-	due to using local variable instead of plink's remote_address).  
-
-	* icqlib/cyrillic.c, icqlib/icqlib.h: added icq_RusConv_n
-
-	* icqlib/stdpackets.c: slightly modified chat packets
-
-	* icqlib/tcp.c: new code for SOCKS connections, more cyrillic
-	translations
-
-	* icqlib/tcpchathandle.c: new code for special chat functions
-	(background, fonts, etc)
-
-	* icqlib/tcplink.c: implemented non-blocking TCP connects
-	over SOCKS, cyrillic translation for chat
-
-	* icqlib/tcplink.h: new defines for SOCKS5 code
-
-	* icqlib/udphandle.c: changed log message in HandleUserOnline
-	
-2000-02-03  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/icqlib.h: line 33, fixed minor compile bug, changed
-	u_int32_t declaration to unsigned long.  This was causing a 
-	problem compiling on SunOS, as reported by Longwen
-	<longwen@mail.com>
-
-2000-01-20  Bill Soudan  <soudan@kde.org>
-
-	Worked more on file send implementation.  icqlib will now also 
-	handle sending file requests to clients.
-
-	* icqlib/filesession.c, filesession.h, icq.h.in, stdpackets.c
-	stdpackets.h, tcp.c, tcpfilehandle.c, tcphandle.c:
-	first implementation of sending file requests
-
-	* icqlib/tcplink.c: fixed bug in icq_TCPLinkConnect that caused
-	file/chat connection attempts to go to the wrong port
-
-2000-01-16  Bill Soudan  <soudan@kde.org>
-
-	Exported icq_FileSession structure to library clients;
-	fixed a serious list bug.  Oops. :)
-
-	* icqlib/filesession.c, filesession.h: added new public functions,
-	icq_FileSessionSetSpeed, icq_FileSessionClose,
-	icq_FileSessionSetWorkingDir, moved icq_FileSession interface to
-	icq.h.in
-	
-	* icqlib/icq.h.in: added definition for icq_FileSession and new
-	public functions
-
-	* icqlib/list.c: fixed serious bug in list_remove
-
-	* icqlib/tcp.c: renamed icq_TCPAcceptFileReq to
-	icq_AcceptFileRequest, moved file request functions to new
-	file session code
-
-	* icqlib/tcpfilehandle.c: added code so icq_FileSessions now
-	keep track of the tcplink to which they are attached
-
-	* icqlib/tcplink.h: removed list_node from icq_TCPLink
-
-2000-01-15  Bill Soudan  <soudan@kde.org>
-
-	Reworked list routines so list_node's don't need to be
-	inside item structures.  Note this made the strlist code
-	unnecessary - strlist code was replaced with generic list
-	commands.
-
-	* icqlib/Makefile.am: strlist.c, strlist.h removed
-
-	* chatsession.c, chatsession.h, contacts.c, contacts.h,
-	filesession.c, filesession.h, icqlib.c, icqpacket.c, icqpacket.h,
-	list.c, list.h, queue.c, queue.h, tcp.c, tcplink.c, tcplink.h,
-	udphandle.c: reworked list code, removed strlist code
-
-	* strlist.c, strlist.h: removed
-
-1999-12-27  Bill Soudan  <soudan@kde.org>
-
-	* icqlib/icq.h.in: added proto for icq_TCPFileSetSpeed
-
-	* icqlib/icqlib.c: cleanups
-
-	* icqlib/tcp.c: fixed bug in icq_TCPAcceptFileReq, added
-	icq_TCPFileSetSpeed
-
-	* icqlib/tcplink.c: fixed bug in icq_TCPOnDataReceived,
-	removed flags variable ;) 
-
-1999-12-27  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udphandle.c, icqlib/udp.h, icqlib/udp.c, icqlib/icq.h.in:
-	icq_UpdateMetaInfoSecurity() added for setting "My authorization is
-	required", "Web Aware" and "IP Publishing".
-
-	* icqlib/tcplink.c: Unused "flags" variable commented out.
-
-1999-12-20  Bill Soudan  <soudan@kde.org>
-
-	Worked more on file transfer.  icqlib will now write received
-	files to disk, and handles all transfer details accordingly
-	after icq_TCPAcceptFileReq is called.  Note currently
-	files are always saved in current directory.  Receiving a
-	single file is working 100% as best I can tell - receiving
-	multiple files hasn't been tested well but should work.
-
-	Also reworked icq_TCPLinkOnDataRecevied to handle quick, large
-	streams of data (processing 1 packet every main loop call
-	just didn't cut it :), and at the same time fixed a bug where
-	received packets would not get processed if the remote end
-	closed the connection immediately after sending one.  This had
-	the result that the tcp sockets stay in non-blocking mode
-	for their entire life, instead of just during connect
-	as before.
-
-	Resume is currently off-by-one I think.  Don't rely on it.
-
-	* icqlib/filesession.[ch]: added file open/close logic, changed
-	icq_FileSession struct a bit
-
-	* icqlib/icq.h.in: removed unnecessary icq_TCPSendFile??Packet
-	functions, user programs do not use these
-
-	* icqlib/tcp.[ch]: moved _process_packet logic into tcplink::
-	icq_TCPLinkProcessReceived, removed unnecessary
-	icq_TCPSendFile??Packet functions
-
-	* icqlib/tcpfilehandle.c: added more file transfer logic to
-	write file to disk
-
-	* icqlib/tcplink.c: added icq_TCPLinkProcessReceived to
-	support processing receive queue before delete (packets used
-	to get dropped in this instance, oops), reworked 
-	icq_TCPLinkOnDataReceived to handle quick, large streams
-	of data, changed icq_TCPLinkOnConnect and *Accept to
-        make all sockets non-blocking.
-
-1999-12-13  Bill Soudan  <soudan@kde.org>
-
-	Implemeted SF task #10224, use real_ip when our IP and remote
-	IP are same, and task #10203, connect timeout for tcp requests.
-
-	Fixed bug #100312, double freeing of list item.
-
-	NOTE: masq hack in udphandle.c::icq_HandleUserOnline is now gone!
-        Updated connect logic _should_ automatically do that for us now.
-
-	* icqlib/contacts.h: added remote_real_ip member to icq_ContactItem 
-	struct 
-
-	* icqlib/tcp.c: fixed double delete bug in _handle_ready_sockets,
-	added code to implement connect timeout
-	
-	* icqlib/tcplink.c: icq_TCPLinkConnect now uses real_ip when
-	our IP is same as remote IP to make connection, added
-	code to implement connect timeout
-
-	* icqlib/tcplink.h: added TCP_LINK_CONNECT_TIMEOUT constant,
-	added connect_time to icq_TCPLink struct
-
-	* icqlib/udphandle.c: removed old real_ip->ip masq hack,
-        added store to remote_real_ip in icq_ContactItem 
-
-1999-12-12  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udphandle.c: Authorization Request packet handling fixed.
-
-	* Makefile.am: DEVEL file included
-
-1999-12-02  Bill Soudan  <soudan@kde.org>
-
-	commited missing filesession.c and filesession.h files.  Sorry
-	'bout that :)
-
-1999-11-30  Bill Soudan  <soudan@kde.org>
-
-	More file xfer support added.  icqlib tcp will now 'go through the
-	motions' for receiving a file.  file data is not written to 
-	disk, yet.
-	
-	* icqlib/Makefile.am: added filesession.[ch]
-
-	* icqlib/icq.h.in: new notify constant (ICQ_NOTIFY_FILE),
-	new icq_FileSessions member in icqlink struct, new AcceptFileReq
-	prototype
-
-	* icqlib/icqpacket.h: ICQ_PACKET_DATA_SIZE increased to 4096
-	to support file transfer packets
-
-	* icqlib/tcp.c: added file session logic
-
-	* icqlib/tcpfilehandle.c: added icq_HandleFileHello
-
-	* icqlib/tcphandle.c: more file xfer logic added
-
-	* icqlib/tcplink.c, tcplink.h: buffer overflow check added,
-	tcplinks will now close if buffer overflows.  increased
-	icq_TCPLinkBufferSize to 4096 to support file transfer packets
-
-1999-11-29  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib/udphandle.c: icq_DoMsg() redone using string lists.
-
-	* icqlib/strlist.c, icqlib/strlist.h:
-	General interface for string lists added.
-
-	* icqlib/tcplink.c: Absence of socklen_t type fixed.
-
-	* icqlib/icq.h.in, icqlib/callbacks.c:
-	icq_RecvMailExpress callback added.
-
-	* icqlib/Makefile.am: strlist.[ch] added.
-
-1999-10-14  Denis V. Dmitrienko  <denis@null.net>
-
-	* icq.h.in, udp.c: icq_UpdateMetaInfo* functions added.
-
-1999-10-07  Denis V. Dmitrienko  <denis@null.net>
-
-	* icq.h.in, tcp.h: Internal/external functions declarations
-	unified a little.
-
-	* kicq/Makefile.am, proxy.c, udp.c: proxy.h file removed.
-
-1999-10-06  Denis V. Dmitrienko  <denis@null.net>
-
-	* DEVEL: Added the "developers' hint guide". Please read it
-	carefully.
-
-1999-09-29  Bill Soudan  <soudan@kde.org>
-
-        Check out my spiffy new email address! :)
-
-        Renamed all tcp_link* functions to icq_TCPLink*.
-
-        Forgot to note: fixed memory leak in tcp.c (tcp packets were not
-        being deleted after use... oops :)
-
-	* chatsession.c, tcpchathandle.c, tcpfilehandle.c, tcphandle.c,
-        chatsession.h: reworked chat/file handling.  fixed chat. (it's
-        been broke since I put non-blocking connects in)
-
-        * Makefile.am: added new files
-
-        * icq.h.in: changed some notification values, added support for
-        chat sessions to icqlink
-
-        * icqlib.h, udp.h: moved a bunch of udp-only defines to udp.h
-
-	* icqpacket.c, list.c: cleanups
-
-        * tcp.c: cleanups, moved connect logic from _handle_ready_sockets
-        to icq_TCPLinkOnConnect, tcp_link->icq_TCPLink
-
-        * tcplink.c, tcplink.h: renamed tcp_link* to icq_TCPLink*.  many
-        cleanups, added icq_TCPLinkOnConnect
-
-        * stdpackets.c, stdpackets.h, tcp.h: tcp_link*->icq_TCPLink*
-
-	* udp.c: tcp port wasn't being sent properly in login packet
-
-1999-09-29  Denis V. Dmitrienko  <denis@null.net>
-
-	Show must go on! Hopefully fixed CVS problems.
-
-	* icqlib.c: Host/network/icq byteorder systemized.
-	icq_Init() cleaned up.
-
-	* acconfig.h, configure.in, icqlib.m4.in,
-	icqlib/icqbyteorder.[ch]: More optimized byteswap stuff.
-
-	* icqlib.h: LOGIN_*_TCP defines added.
-
-	* icqpacket.[ch]: icq_PacketAppend16n() added for network-ordered
-	word appending.
-
-	* queue.[ch]: ICQLINK compatibility added.
-
-	* stdpackets.c: Host/network byteorder cleanups.
-
-	* tcplink.c: TCP code SOCKS-ification. Not finished.
-
-	* udp.c: Webaware functions enabled without success even with
-	UDP v5 - need more investigations.
-
-	* udphandle.c: MailExpress message handler started.
-
-1999-07-18  Bill Soudan          <wes0472@rit.edu>
-
-	fixed tcp problems, changed icq_ContactItem structure to use
-	list.c and moved to contacts.c, removed old byte swap macros
-        in favor of new functions in icqbyteorder.c, and added better
-        log messages
-
-	* Makefile.am: added contacts.c, contacts.h
-
-	* contacts.c, contacts.h: added
-
-	* icq.h.in: moved icq_ContactItem struct to contacts.h,
-        removed old *Sok members, renamed icq_Cont* functions
-
-	* icqlib.c, icqlib.h: changed to use new byte-order functions &
-	contact list functions
-
-	* icqpacket.c: changed to use new byte-order functions
-
-	* tcp.c: added better log messages
-
-	* tcplink.c: fixed fail notification bug introduced during ICQLINK
-        changes, changed to use new byte-order functions & contact list
-        functions, added better log messages 
-
-	* udp.c: changed to use new byte-order functions &
-        contact list functions
-
-	* udphandle.c: fixed tcp port bug in icq_HandleUserOnline, changed
-        to use new byte-order & contact list functions
-
-	* util.c, util.h: removed old byte order and contact list
-        functions
-
-1999-07-16  Denis V. Dmitrienko  <denis@null.net>
-
-	Version changed to 0.2.0
-
-	* udp.c, udp.h, udphandle.c: ICQ UDP v5 implemented.
- 	Encription for ICQ UDP v5 implemented.
- 	icq_Packet* unified interface for UDP packets implemented.
-	Multipacket support of ICQ UDP v5 added.
-
-	* util.[ch]: Status support changed to support early unsupported
-	combined (ORed) statuses.
-
-	* Makefile.am, icqlib/Makefile.am: Remove automatically generated
-	files by "make maintainer-clean"
-
-1999-07-02  Vadim Zaliva  <lord@crocodile.org>
-
-	* icqlib/udphandle.c (icq_HandleUserOnline): using icqtohl macros
-	to convert parameters of callback (IP addresses, port #) to host
-	order.
-
-	* icqlib/icqbyteorder.h: added (per Bill suggestion) defenitions
-	of icqtohs, icqtons, ntociqs, htociqs macros.
-
-	* icqlib/tcppacket.c: some system header files included to avoid
-	compilation warnings.
-
-	* icqlib/tcplink.c: some system header files included to avoid
-	compilation warnings.
-
-	* icqlib/tcp.h: icq_TCPProcessFilePacket prototype added to avoid
-	compilation warnings.
-
-	* icqlib/tcp.c: add includes to avoid compilation warning for
-	getsockopt() and some other functions.
-
-	* configure.in: add detection of headers used on Solaris, Linux,
-	FreeBSD to detect edianness.
-
-	* icqlib/icqbyteorder.h: defenition of icqtohl, icqtonl, ntociql,
-	htociql macros.
-
-1999-07-02  Bill Soudan          <wes0472@rit.edu>
-
-	icq_SendMessage and icq_SendURL now accept a 3 choice thruSrv arg:
-        ICQ_SEND_THRUSERVER, ICQ_SEND_DIRECT, or ICQ_SEND_BESTWAY.
-        added support to icq_ContactItem structure and udphandle.c.
-
-	* icq.h: added new ICQ_SEND_* constants
-
-	* icqlib.c: added new code to support thruSrv arg to SendMessage
-	and SendURL
-
-	* util.h: added tcp_flag member to icq_ContactItem struct
-
-	* udphandle.c: added code to HandleUserOnline to update tcp_flag
-
-1999-06-30  Bill Soudan          <wes0472@rit.edu>
-
-	implemented non-blocking connects, including checking for failed
-        connects.  failed sends/other networking calls still to do.
-
-	* icq.h: renamed ICQ_NOTIFY_CONNECTFAILED to ICQ_NOTIFY_FAILED
-
-        * list.h, list.c: changed list_traverse to use va_list
-
-	* tcpprocess.c: cleanups
-
-	* tcp.c, tcplink.c, tcplink.h: implemented non-blocking connects
-c
-1999-05-03  Bill Soudan          <wes0472@rit.edu>
-
-	* tcplink.c: removed exit calls
-
-        * callbacks.c, icq.h, tcp.c, tcp.h, tcppackets.c, tcppackets.h,
-        tcpprocess.c: initial file xfer support added- untested
-
-1999-04-29  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib.h, udp.c, udp.h, udphandle.c: Unsuccessful attempt to
-	implement web presence (webaware) feature - doesn't seems to work
-	in ICQ v2.
-
-	* list.c, tcp.c, tcplink.c, tcpprocess.c: Cleanups, warning
-	removed
-
-	* Makefile.in, acinclude.m4, aclocal.m4, config.h.in, configure,
-	stamp-h.in, icqlib/Makefile.in: Removed automake/autoconf
-	generated tools from CVS - "make -f Makefile.cvs" to generate them 
-	after checkout.
-
-1999-04-17  Bill Soudan          <wes0472@rit.edu>
-
-	reworked tcp system significantly- tcp links are now kept as a
-        seperate list instead of in icq_ContactItem.  chat requests can now be
-        both sent and received successfully.
-
-	* util.c, util.h, udphandle.c: removed *_link entries from
-        icq_ContactItem, including cleaup/init code
-
-	* icqlib.c, icq.h: modified Send* functions to return DWORD
-        instead of WORD
-
-	* tcp.c: _major_ restructuring.  all tcp sockets (including 
-        listening sockets) are kept in global linked list, icq_TCPLinks.
-        accept and listen functions moved to tcplink.c.  changed return
-        values of Send* functions to DWORD.
-
-	* tcp.h: changed return values of Send* functions to DWORD.
-
-	* tcplink.c, tcplink.h: fixed bug in tcp_link_on_data_received,
-        multiple packets that come in on one recv call are now handled
-        correctly.  added tcp_link_accept and tcp_link_listen.  started
-        using mode and type structure entries.  added icq_TCPLinks list
-        and find_tcp_link function.  changed received_queue and send_queue
-        to lists.
-
-	* tcppacket.c, tcppacket.h: added tcp_packet_node_delete function
-        and changed structure to include list_node for new list routines.
-
-	* tcppackets.c, tcppackets.h: added new functions to create
-        chat packets. removed unnecessary code.  added new function to
-        create URL ack packet.
-
-	* tcpprocess.c: reworked code to use tcp_links instead of
-        icq_ContactItem entries.  modified ProcessChatPacket to negotiate
-        both sending and receiving chat requests properly.
-
-	* list.c, list.h: new list functions- replaces packetqueue
-        and handles new list of tcp_links
-
-	* packetqueue.c, packetqueue.h: removed, list.c now used for
-	queues
-
-	* Makefile.am: removed packetqueue.c, added list.c
-
-1999-04-14  Denis V. Dmitrienko  <denis@null.net>
-
-	* tcpprocess.c: icq_ContactItem parameter added to function
-	icq_TCPOnMessageReceived(). Segfault fixed on spoofed messages.
-
-	* icqlib.c, proxy.c, packetqueue.c, icqlib.h, tcp.c, tcp.h,
-	tcplink.c, udp.c, udp.h, udphandle.c, util.c, util.h, tcppacket.c,
-	tcppackets.c, tcpprocess.c, tcppackets.h: Cleanups for "strict"
-	compiling (-ansi -pedantic)
-
-	* icqlib.c, proxy.c, udp.c, udphandle.c, cyrillic.c: Switched from
-	icq_Log callback to icq_FmtLog function.
-
-	* tcp.h: Some declarations added
-
-	* tcp.c: Parameter port added to icq_TCPCreateListeningSocket()
-	function.
-
-	* icq.h: Added icq_FmtLog()
-
-	* configure: Added AC_CHECK_COMPILERS to allow --enable-debug and
-	--enable-strict configure options.
-
-1999-04-05  Bill Soudan          <wes0472@rit.edu>
-
-        icqlib will now create and listen on the chat socket when
-        necessary, and will perform negotiation for _receiving_ remote
-        chat requests only.          
-
-	* callbacks.c icq.h tcp.c tcp.h tcplink.c tcplink.h tcppacket.c       
-        tcppackets.c tcppackets.h tcpprocess.c udphandle.c util.c
-        util.h: added initial chat support
-
-1999-04-05  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib.c: Send messages and URLs to 'not in list' users fixed.
-
-1999-03-30  Bill Soudan           <wes0472@rit.edu>
-
-        tcp messages and urls completely functional!
-        unsuccessful connects not handled yet, however, plus connect
-        is currently blocking (yuck)
-
-	* util.c: cleaned up old TCPLog function
-	* udphandle.c: added tcpflag handling to UserOnline
-	* icq.h: added icq_TCPSendURL and modified icq_UserOnline to
-          handle tcpflag
-	* icqlib.c: added tcp support to SendURL
-	* icqlib.h: modified LOGIN_X2_DEF to 0x04 instead of 0x06- we're
-          ready to accept tcp packets now!  removed duplicate LOGIN_X*
-          definitions
-	* packetqueue.c tcp.c tcp.h tcplink.c tcppacket.c tcppackets.c
-	  tcppackets.h tcpprocess.c: wrapped up many tcp details-  code
-	  now handles incoming and outgoing tcp messages and urls!
-
-1999-03-30  Vadim Zaliva  <lorda@crocodile.org>
-
-	* icqlib/util.c (icq_GetCountryName): function prototype now takes
-	'unsigned short' as country code.
-	Country codes list now prorerly sorted, thus no need to sort it
-	using qsort.
-
-1999-03-29  Vadim Zaliva  <lord@crocodile.org>
-
-	* icqlib/util.c (icq_ConvertStatus2Str): this function now accepts
-	ulong as sttatus argument, since we use unsigned long for status
-	everywhere.
-	(icq_TCPXlateStatus): This function now use unsigned long as
-	'udp_status' parameter type.
-	(icq_GetCountryName): Optimized country code search.
-	(icq_TCPXlateStatus): cleanup.
-
-	* icqlib/icq.h: Change state constants to long.
-
-1999-03-27  Bill Soudan          <wes0472@rit.edu>
-
-        preliminary tcp support added and functional!
-        tcp messages will send to and from remote client when kicq
-        initiates the connection- remote clients will not try a tcp
-        connection to kicq yet
-
-	* icq.h: added extern TCP function prototypes
-        * icqlib.c: added TCP support to icq_SendMessage
-	* packetqueue.c: cleaned up, fixed bugs, finished packet_queue_dump
-	* tcp.c: added icq_TCPSendMessage and socket close/process logic
-	* tcplink.c: fixed tcp_link_connect so it really connects to
-          remote client instead of always to my local test computer O:)
-	* tcppacket.c: added code to handle null string in 
-          tcp_packet_append_string
-	* tcppackets.c,h: CreateStdPacket actually puts IP and port info
-	  in now, added CreateStdAck and CreateMessageAck
-	* udphandle.c: fixed bug in HandleUserOnline (remote_ip and
-          remote_real_ip were not evaluating correctly), added hack
-          so I can test using local network, fixed function names
-          so icqlib compiles
-	* tcpprocess.c: added code to handle received messages,
-          finished process ack function
-	* util.c: removed static from Country_Codes so regwin.cpp
-          from kicq can use it
-
-1999-03-26  Bill Soudan          <wes0472@rit.edu>
-
-	* tcp.c, tcp.h: finished select logic
-	* tcplink.c: fixed C++ comments, cleaned up
-	* tcpprocess.c: added icq_TCPProcessHello
-	* packetqueue.c: moved packet_queue_find_queue from tcp.c
-	* util.c: rewrote icq_TCPLog
-
-1999-03-25  Bill Soudan          <wes0472@rit.edu>
-
-	* tcplink.c, tcplink.h: added
-	* Makefile.am: added tcplink.c
-	* icqlib.c: added #include "util.h"
-	* tcp.c, tcp.h: moved many functions into tcplink.c
-	* tcpprocess.c: changed types to standard
-	* udphandle.c: modified HandleUserOnline & Offline for new message_link
-	* util.c: ContItem functions modified for message_link
-	* util.h: message_link added to ContactItem struct, moved types to
-          seperate file
-	* icqtypes.h: added
-	* tcppacket.h: cleaned up
-
-1999-03-24  Denis V. Dmitrienko  <denis@null.net>
-
-	* Makefile.am, Makefile.in, callbacks.c, cyrillic.c, icq.h,
-	icqlib.c, icqlib.h, packetqueue.c, packetqueue.h, proxy.c,
-	proxy.h, tcp.c, tcp.h, tcppacket.c, tcppacket.h, tcppackets.c,
-	tcppackets.h, tcpprocess.c, udp.c, udp.h, udphandle.c, util.c,
-	util.h:
- 	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.
-
-	* Makefile.cvs, Makefile.in, acconfig.h, acinclude.m4,
-	acinclude.m4.in, aclocal.m4, config.guess, config.h.in,
-	config.sub, configure, configure.in, install-sh, libtool.m4.in,
-	ltconfig, ltmain.sh, mkinstalldirs, stamp-h.in: Updated
-	autoconf/automake/libtool configuration tools
-
-1999-03-22  Bill Soudan          <wes0472@rit.edu>
-
-	* Makefile.am: added new files
-
-	* icqlib.h, icqlib.c: added additional struct entries in
-          icq_ContactItem for tcp code, added code in
-	  icq_HandleUserOnline and icq_HandleUserOffline for setup/cleanup
-
-	* added many files for tcp implementation:
-	  icq_tcp.c icq_tcp.h icq_tcp_packets.c icq_tcp_packets.h
-          icq_tcp_process.c packet_queue.c packet_queue.h
-          tcp_packet.c tcp_packet.h util.c
-
-1999-03-05  Denis V. Dmitrienko  <denis@null.net>
-
-	* icqlib.h, icqlib.c, icq.h: Some cosmetic changes...
-
-Version 0.1.3 (08 Dec 1998)
-  SOCKS5 proxy support.
-  icq_RecvMessage now returns sending message time not receiving.
-  Visible list support changed.
-  Handle icq99a statuses.
-
-Version 0.1.2 (05 Oct 1998)
-  Search by UIN added.
-  SunOS port (Thanks to Joe Avila <joe@avilate.com>).
-
-Version 0.1.1 (21 Sep 1998)
-  Renamed from libicq to icqlib - there is another libicq on the net.
-  Little changes to allow UI call select() itself.
-
-Version 0.1.0 (18 Sep 1998)
-  Initial public version.
--- a/src/protocols/icq/INSTALL	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,167 +0,0 @@
-Basic Installation
-==================
-
-   These are generic installation instructions.
-
-   The `configure' shell script attempts to guess correct values for
-various system-dependent variables used during compilation.  It uses
-those values to create a `Makefile' in each directory of the package.
-It may also create one or more `.h' files containing system-dependent
-definitions.  Finally, it creates a shell script `config.status' that
-you can run in the future to recreate the current configuration, a file
-`config.cache' that saves the results of its tests to speed up
-reconfiguring, and a file `config.log' containing compiler output
-(useful mainly for debugging `configure').
-
-   If you need to do unusual things to compile the package, please try
-to figure out how `configure' could check whether to do them, and mail
-diffs or instructions to the address given in the `README' so they can
-be considered for the next release.  If at some point `config.cache'
-contains results you don't want to keep, you may remove or edit it.
-
-   The file `configure.in' is used to create `configure' by a program
-called `autoconf'.  You only need `configure.in' if you want to change
-it or regenerate `configure' using a newer version of `autoconf'.
-
-The simplest way to compile this package is:
-
-  1. `cd' to the directory containing the package's source code and type
-     `./configure' to configure the package for your system.  If you're
-     using `csh' on an old version of System V, you might need to type
-     `sh ./configure' instead to prevent `csh' from trying to execute
-     `configure' itself.
-
-     Running `configure' takes a while.  While running, it prints some
-     messages telling which features it is checking for.
-
-  2. Type `make' to compile the package.
-
-  3. Type `make install' to install the programs and any data files and
-     documentation.
-
-  4. You can remove the program binaries and object files from the
-     source code directory by typing `make clean'.  
-
-Compilers and Options
-=====================
-
-   Some systems require unusual options for compilation or linking that
-the `configure' script does not know about.  You can give `configure'
-initial values for variables by setting them in the environment.  Using
-a Bourne-compatible shell, you can do that on the command line like
-this:
-     CC=c89 CFLAGS=-O2 LIBS=-lposix ./configure
-
-Or on systems that have the `env' program, you can do it like this:
-     env CPPFLAGS=-I/usr/local/include LDFLAGS=-s ./configure
-
-Compiling For Multiple Architectures
-====================================
-
-   You can compile the package for more than one kind of computer at the
-same time, by placing the object files for each architecture in their
-own directory.  To do this, you must use a version of `make' that
-supports the `VPATH' variable, such as GNU `make'.  `cd' to the
-directory where you want the object files and executables to go and run
-the `configure' script.  `configure' automatically checks for the
-source code in the directory that `configure' is in and in `..'.
-
-   If you have to use a `make' that does not supports the `VPATH'
-variable, you have to compile the package for one architecture at a time
-in the source code directory.  After you have installed the package for
-one architecture, use `make distclean' before reconfiguring for another
-architecture.
-
-Installation Names
-==================
-
-   By default, `make install' will install the package's files in
-`/usr/local/bin', `/usr/local/man', etc.  You can specify an
-installation prefix other than `/usr/local' by giving `configure' the
-option `--prefix=PATH'.
-
-   You can specify separate installation prefixes for
-architecture-specific files and architecture-independent files.  If you
-give `configure' the option `--exec-prefix=PATH', the package will use
-PATH as the prefix for installing programs and libraries.
-Documentation and other data files will still use the regular prefix.
-
-   If the package supports it, you can cause programs to be installed
-with an extra prefix or suffix on their names by giving `configure' the
-option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
-
-Optional Features
-=================
-
-   Some packages pay attention to `--enable-FEATURE' options to
-`configure', where FEATURE indicates an optional part of the package.
-They may also pay attention to `--with-PACKAGE' options, where PACKAGE
-is something like `gnu-as' or `x' (for the X Window System).  The
-`README' should mention any `--enable-' and `--with-' options that the
-package recognizes.
-
-   For packages that use the X Window System, `configure' can usually
-find the X include and library files automatically, but if it doesn't,
-you can use the `configure' options `--x-includes=DIR' and
-`--x-libraries=DIR' to specify their locations.
-
-Specifying the System Type
-==========================
-
-   There may be some features `configure' can not figure out
-automatically, but needs to determine by the type of host the package
-will run on.  Usually `configure' can figure that out, but if it prints
-a message saying it can not guess the host type, give it the
-`--host=TYPE' option.  TYPE can either be a short name for the system
-type, such as `sun4', or a canonical name with three fields:
-     CPU-COMPANY-SYSTEM
-
-See the file `config.sub' for the possible values of each field.  If
-`config.sub' isn't included in this package, then this package doesn't
-need to know the host type.
-
-   If you are building compiler tools for cross-compiling, you can also
-use the `--target=TYPE' option to select the type of system they will
-produce code for and the `--build=TYPE' option to select the type of
-system on which you are compiling the package.
-
-Sharing Defaults
-================
-
-   If you want to set default values for `configure' scripts to share,
-you can create a site shell script called `config.site' that gives
-default values for variables like `CC', `cache_file', and `prefix'.
-`configure' looks for `PREFIX/share/config.site' if it exists, then
-`PREFIX/etc/config.site' if it exists.  Or, you can set the
-`CONFIG_SITE' environment variable to the location of the site script.
-A warning: not all `configure' scripts look for a site script.
-
-Operation Controls
-==================
-
-   `configure' recognizes the following options to control how it
-operates.
-
-`--cache-file=FILE'
-     Use and save the results of the tests in FILE instead of
-     `./config.cache'.  Set FILE to `/dev/null' to disable caching, for
-     debugging `configure'.
-
-`--help'
-     Print a summary of the options to `configure', and exit.
-
-`--quiet'
-`--silent'
-`-q'
-     Do not print messages saying which checks are being made.
-
-`--srcdir=DIR'
-     Look for the package's source code in directory DIR.  Usually
-     `configure' can determine that directory automatically.
-
-`--version'
-     Print the version of Autoconf used to generate the `configure'
-     script, and exit.
-
-`configure' also accepts some other, not widely useful, options.
-
--- a/src/protocols/icq/Makefile.am	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,69 +0,0 @@
-EXTRA_DIST = \
-	AUTHORS \
-	COPYING \
-	ChangeLog \
-	INSTALL \
-	README \
-	VERSION
-
-pkgdir = $(libdir)/gaim
-
-ICQSOURCES = \
-	chatsession.c \
-	chatsession.h \
-	contacts.c \
-	contacts.h \
-	cyrillic.c \
-	eventhandle.c \
-	eventhandle.h \
-	filesession.c \
-	filesession.h \
-	icq.h \
-	icqbyteorder.c \
-	icqbyteorder.h \
-	icqevent.c \
-	icqevent.h \
-	icqlib.c \
-	icqlib.h \
-	icqpacket.c \
-	icqpacket.h \
-	icqtypes.h \
-	list.c \
-	list.h \
-	proxy.c \
-	queue.c \
-	queue.h \
-	socketmanager.c \
-	socketmanager.h \
-	stdpackets.c \
-	stdpackets.h \
-	tcp.c \
-	tcp.h \
-	tcpchathandle.c \
-	tcpfilehandle.c \
-	tcphandle.c \
-	tcplink.c \
-	tcplink.h \
-	timeout.c \
-	timeout.h \
-	udp.c \
-	udp.h \
-	udphandle.c \
-	util.c \
-	util.h \
-	gaim_icq.c
-
-AM_CFLAGS = $(st)
-
-libicq_la_LDFLAGS =	-module -avoid-version
-
-st =
-pkg_LTLIBRARIES = libicq.la
-
-libicq_la_SOURCES =	$(ICQSOURCES)
-
-AM_CPPFLAGS = \
-	-I$(top_srcdir)c \
-	-I$(top_srcdir)/src \
-	$(DEBUG_CFLAGS) \
-	$(GLIB_CFLAGS)
--- a/src/protocols/icq/README	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-icqlib v1.2.0
-Denis V. Dmitrienko <denix@kde.org>
-Bill Soudan <soudan@kde.org>
-
-DESCRIPTION
------------
-icqlib is the most feature complete, open source, library implementation
-of Mirabilis' ICQ protocol available on the Internet. icqlib currently
-supports approximately 90% of the ICQ UDP v5 protocol and 80% of the
-ICQ TCP v2 protocol, including new UIN registration, chat, and file
-transfer.
-
-Features:
-* written in C for portability - compiles on most Unices
-* supports multiple simultaneous connections to ICQ servers - more
-  than one UIN can log in and receive events
-* SOCKS5 firewall support for both UDP and TCP protocols
-* event driven, non-blocking interface
-* supports Russian language - automatically performs conversion from
-  Windows 1251 encoding to unix koi8 encoding
-
-DOWNLOAD
---------
-Home page:
-      http://kicq.sourceforge.net/icqlib.shtml
-Direct download:
-      http://download.sourceforge.net/icqlib/icqlib-1.2.0.tar.gz
-      ftp://ftp.kde.org/pub/kde/unstable/apps/network/icqlib-1.2.0.tar.gz
-
-INSTALL
--------
-This is very basic:
-      ./configure
-      make
-      su -c "make install"
-
-If you want to install in other place:
-      ./configure --prefix=/place/to/install/icqlib
-      make
-      make install
-
-You should have permissions to write in /place/to/install/icqlib or should
-install it from root:
-      su -c "make install"
-
-For more details read INSTALL file.
-
-BUGS
-----
-If you find one that isn't listed, submit your bugreport here:
-http://sourceforge.net/bugs/?group_id=384
-And if you have a fix for it, so much the better! Submit your patch
-here:
-http://sourceforge.net/patch/?group_id=384
-
-PARTICIPATION
--------------
-You can participate in icqlib project in any way here:
-http://sourceforge.net/projects/icqlib
-Send your feature requests here:
-http://sourceforge.net/support/?group_id=384
-
-Please try to avoid abusing developers with direct email messages,
-especially if your question could be already answered somewhere in
-the project forums or mailing lists. Please use provided above web
-forms to submit your reports and requests. And of course, any kind of
-contributions and propositions are very appreciated and welcomed, and
-could be sent directly. Thank you for your understanding and patience.
-
-THANKS
-------
-To
-- Matthew Smith, Magnus Ihse, Jeremy Wise, Henrik Isaksson and other
-  people from ICQDev <icq-devel@lists.realminfo.com> and
-  micq <micq@phantom.iquest.net> mailing lists for their contribution
-  in icq protocol research
-- K Desktop Environment developers
-- icqlib and kicq users
-
-And finally
-- Linus Torvalds, Alan Cox and other Linux programmers for great OS
-
---
-Enjoy!
-icqlib development team.
--- a/src/protocols/icq/VERSION	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-1.2.0
--- a/src/protocols/icq/chatsession.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,147 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: chatsession.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-#include "tcp.h"
-
-#include "chatsession.h"
-
-icq_ChatSession *icq_ChatSessionNew(icq_Link *icqlink) 
-{
-  icq_ChatSession *p=(icq_ChatSession *)malloc(sizeof(icq_ChatSession));
-
-  if (p)
-  {
-    p->status=0;
-    p->id=0L;
-    p->icqlink=icqlink;
-    p->tcplink=NULL;
-    p->user_data=NULL;
-    icq_ListInsert(icqlink->d->icq_ChatSessions, 0, p);
-  }
-	
-  return p;
-}
-
-void icq_ChatSessionDelete(void *p)
-{
-  icq_ChatSession *pchat = (icq_ChatSession *)p;
-  invoke_callback(pchat->icqlink, icq_ChatNotify)(pchat, CHAT_NOTIFY_CLOSE,
-    0, NULL);
-  
-  free(p);
-}
-
-int _icq_FindChatSession(void *p, va_list data)
-{
-  DWORD uin=va_arg(data, DWORD);
-  return (((icq_ChatSession *)p)->remote_uin == uin);
-}
-
-icq_ChatSession *icq_FindChatSession(icq_Link *icqlink, DWORD uin)
-{
-  return icq_ListTraverse(icqlink->d->icq_ChatSessions,
-    _icq_FindChatSession, uin);
-}
-
-void icq_ChatSessionSetStatus(icq_ChatSession *p, int status)
-{
-  p->status=status;
-  if(p->id)
-    invoke_callback(p->icqlink, icq_ChatNotify)(p, CHAT_NOTIFY_STATUS,
-      status, NULL);
-}
-
-/* public */
-
-/** Closes a chat session. 
- * @param session desired icq_ChatSession
- * @ingroup ChatSession
- */
-void icq_ChatSessionClose(icq_ChatSession *session)
-{
-  icq_TCPLink *tcplink = session->tcplink;
-
-  /* if we're attached to a tcplink, unattach so the link doesn't try
-   * to close us, and then close the tcplink */
-  if (tcplink)
-  {
-    tcplink->session=NULL;
-    icq_TCPLinkClose(tcplink);
-  }
-  
-  icq_ChatSessionDelete(session);
-
-  icq_ListRemove(session->icqlink->d->icq_ChatSessions, session);
-}
-
-/** Sends chat data to the remote uin.
- * @param session desired icq_ChatSession
- * @param data pointer to data buffer, null-terminated
- * @ingroup ChatSession
- */
-void icq_ChatSessionSendData(icq_ChatSession *session, const char *data)
-{
-  icq_TCPLink *tcplink = session->tcplink;
-  int data_length = strlen(data);
-  char *buffer;
-
-  if(!tcplink)
-    return;
-
-  buffer = (char *)malloc(data_length);
-  strcpy(buffer, data);
-  icq_ChatRusConv_n("kw", buffer, data_length);
-  
-  send(tcplink->socket, buffer, data_length, 0);  
-  
-  free(buffer);
-}
-
-/** Sends chat data to the remote uin.
- * @param session desired icq_ChatSession
- * @param data pointer to data buffer
- * @param length length of data
- * @ingroup ChatSession
- */
-void icq_ChatSessionSendData_n(icq_ChatSession *session, const char *data,
-  int length)
-{
-  icq_TCPLink *tcplink = session->tcplink;
-  char *buffer;
-
-  if(!tcplink)
-    return;
-  
-  buffer = (char *)malloc(length);
-  memcpy(buffer, data, length);
-  icq_ChatRusConv_n("kw", buffer, length);
-    
-  send(tcplink->socket, buffer, length, 0);
-
-  free(buffer);
-}
-
--- a/src/protocols/icq/chatsession.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: chatsession.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _CHAT_SESSION_H
-#define _CHAT_SESSION_H
-
-#include "icq.h"
-#include "icqtypes.h"
-
-/* chat session states:
-
-   accepting chat request 
-	 
-   1. remote user initiates chat by sending chat request to message listen 
-	    port
-	 2. local user accepts chat, ack packet sent back to remote user and
-	    chat listen port opened
-			* chat session created on local side with ID of ack packet
-			  LISTENING
-			* remote chat session created with ID of ack packet
-			  CONNECTING
-	 3. remote client connects to local chat listen port, sends hello and
-	    sends info packet with name and colors
-			* local chat session associated with new icq_TCPLink according to uin
-	 4.	local client sends back big info packet with name, colors, and font
-		  
-	 5. remote client sends font packet, connection is considered established
-	 
-	 sending chat request
-	 
-	 1. local user initiates chat by sending chat request to remote message
-	    listen port
-	 2. remote user accepts chat, ack packet received from remote client and
-	    remote client opens chat listen port
-	 3. local client connects to remote chat listen port, sends hello and
-	    sends info packet with name and colors
-	 4. remote client sends back big info packet with name, colors, and font
-	 5. local client sends font packet, connection is considered established
-
-   1. icq_RecvChatRequest - provides session ID (same as packet sequence)
-	 2. icq_SendChatAck - pass session ID
-	     ICQ_NOTIFY_CONNECTED
-			 ICQ_NOTIFY_SENT
-			 ICQ_NOTIFY_CHAT, CHAT_STATUS_LISTENING
-   3. ICQ_NOTIFY_CHAT, CHAT_STATUS_WAIT_NAME
-	 4. ICQ_NOTIFY_CHAT, CHAT_STATUS_WAIT_FONT
-	 5. ICQ_NOTIFY_CHAT, CHAT_STATUS_CONNECTED
-	    ICQ_NOTIFY_CHATDATA, ....
-			ICQ_NOTIFY_SUCCESS
-*/
-
-icq_ChatSession *icq_ChatSessionNew(icq_Link *);
-void icq_ChatSessionDelete(void *);
-void icq_ChatSessionSetStatus(icq_ChatSession *, int);
-icq_ChatSession *icq_FindChatSession(icq_Link *, DWORD);
-
-#endif
--- a/src/protocols/icq/contacts.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,113 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: contacts.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-
-#include "contacts.h"
-
-icq_ContactItem *icq_ContactNew(icq_Link *icqlink)
-{
-  icq_ContactItem *pcontact=
-    (icq_ContactItem *)malloc(sizeof(icq_ContactItem));
-
-  if(pcontact)
-    pcontact->icqlink=icqlink;
-
-  return pcontact;
-}
-
-void icq_ContactDelete(void *p)
-{
-  free(p);
-}
-
-void icq_ContactAdd(icq_Link *icqlink, DWORD cuin)
-{
-  icq_ContactItem *p = icq_ContactNew(icqlink);
-  p->uin = cuin;
-  p->vis_list = FALSE;
-  p->invis_list = FALSE;
-
-  icq_ListEnqueue(icqlink->d->icq_ContactList, p);
-}
-
-void icq_ContactRemove(icq_Link *icqlink, DWORD cuin)
-{
-  icq_ContactItem *pcontact=icq_ContactFind(icqlink, cuin);
-
-  if (pcontact)
-  {
-    icq_ListRemove(icqlink->d->icq_ContactList, pcontact);
-    icq_ContactDelete(pcontact);
-  }
-}
-
-void icq_ContactClear(icq_Link *icqlink)
-{
-  icq_ListDelete(icqlink->d->icq_ContactList, icq_ContactDelete);
-  icqlink->d->icq_ContactList=icq_ListNew();
-}
-
-int _icq_ContactFind(void *p, va_list data)
-{
-  DWORD uin=va_arg(data, DWORD);
-
-  return (((icq_ContactItem *)p)->uin == uin);
-}
-
-icq_ContactItem *icq_ContactFind(icq_Link *icqlink, DWORD cuin)
-{
-  return icq_ListTraverse(icqlink->d->icq_ContactList, _icq_ContactFind, cuin);
-}
-
-void icq_ContactSetVis(icq_Link *icqlink, DWORD cuin, BOOL on)
-{
-  icq_ContactItem *p = icq_ContactFind(icqlink, cuin);
-  if(p)
-    p->vis_list = on;
-}
-
-void icq_ContactSetInvis(icq_Link *icqlink, DWORD cuin, BOOL on)
-{
-  icq_ContactItem *p = icq_ContactFind(icqlink, cuin);
-  if(p)
-    p->invis_list = on;
-}
-
-icq_ContactItem *icq_ContactGetFirst(icq_Link *icqlink)
-{
-  return icq_ListFirst(icqlink->d->icq_ContactList);
-}
-
-icq_ContactItem *icq_ContactGetNext(icq_ContactItem *pcontact)
-{
-  icq_ListNode *p=icq_ListFind(pcontact->icqlink->d->icq_ContactList, pcontact);
-
-  if (p && p->next)
-    return p->next->item;
-  else
-    return 0L;
-}
--- a/src/protocols/icq/contacts.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,49 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: contacts.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _CONTACTS_H
-#define _CONTACTS_H
-
-#include "icq.h"
-#include "icqtypes.h"
-
-typedef struct icq_ContactItem_s
-{
-  icq_Link *icqlink;
-  unsigned long uin;
-  int vis_list;
-  int invis_list;
-  unsigned long remote_ip;
-  unsigned long remote_real_ip;
-  unsigned long remote_port;
-  unsigned char tcp_flag;
-} icq_ContactItem;  
-
-icq_ContactItem *icq_ContactNew(icq_Link *icqlink);
-void icq_ContactDelete(void *pcontact);
-icq_ContactItem *icq_ContactFind(icq_Link *icqlink, DWORD cuin);
-icq_ContactItem *icq_ContactGetFirst(icq_Link *icqlink);
-icq_ContactItem *icq_ContactGetNext(icq_ContactItem *pcontact);
-
-#endif /* _CONTACTS_H */
--- a/src/protocols/icq/cyrillic.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,123 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: cyrillic.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include "icq.h"
-#include "icqlib.h"
-
-BYTE kw[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-             144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
-             160,161,162,184,186,165,179,191,168,169,170,171,172,180,174,175,
-             176,177,178,168,170,181,178,175,184,185,170,187,188,165,190,169,
-             254,224,225,246,228,229,244,227,245,232,233,234,235,236,237,238,
-             239,255,240,241,242,243,230,226,252,251,231,248,253,249,247,250,
-             222,192,193,214,196,197,212,195,213,200,201,202,203,204,205,206,
-             207,223,208,209,210,211,198,194,220,219,199,216,221,217,215,218};
-
-BYTE wk[] = {128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,
-             144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,
-             160,161,162,163,164,189,166,167,179,191,180,171,172,173,174,183,
-             176,177,182,166,173,181,182,183,163,185,164,187,188,189,190,167,
-             225,226,247,231,228,229,246,250,233,234,235,236,237,238,239,240,
-             242,243,244,245,230,232,227,254,251,253,255,249,248,252,224,241,
-             193,194,215,199,196,197,214,218,201,202,203,204,205,206,207,208,
-             210,211,212,213,198,200,195,222,219,221,223,217,216,220,192,209};
-
-/********************************************************
-Russian language ICQ fix.
-Usual Windows ICQ users do use Windows 1251 encoding but
-unix users do use koi8 encoding, so we need to convert it.
-This function will convert string from windows 1251 to koi8
-or from koi8 to windows 1251.
-Andrew Frolov dron@ilm.net
-*********************************************************/
-
-extern int icq_Russian;
-
-void icq_RusConv(const char to[4], char *t_in)
-{
-  BYTE *table;
-  int i;
-
-/* 6-17-1998 by Linux_Dude
- * Moved initialization of table out front of 'if' block to prevent compiler
- * warning. Improved error message, and now return without performing string
- * conversion to prevent addressing memory out of range (table pointer would
- * previously have remained uninitialized (= bad)).
- */
-
-  table = wk;
-  if(strcmp(to, "kw") == 0)
-    table = kw;
-  else if(strcmp(to, "wk") != 0)
-  {
-    icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n");
-    return;
-  }
-      
-/* End Linux_Dude's changes ;) */
-
-  if(icq_Russian)
-  {
-    for(i=0;t_in[i]!=0;i++)
-    {
-      t_in[i] &= 0377;
-      if(t_in[i] & 0200)
-        t_in[i] = table[t_in[i] & 0177];
-    }
-  }
-}
-
-void icq_RusConv_n(const char to[4], char *t_in, int len)
-{
-  BYTE *table;
-  int i;
-
-/* 6-17-1998 by Linux_Dude
- * Moved initialization of table out front of 'if' block to prevent compiler
- * warning. Improved error message, and now return without performing string
- * conversion to prevent addressing memory out of range (table pointer would
- * previously have remained uninitialized (= bad)).
- */
-
-  table = wk;
-  if(strcmp(to, "kw") == 0)
-    table = kw;
-  else if(strcmp(to, "wk") != 0)
-  {
-    icq_FmtLog(NULL, ICQ_LOG_ERROR, "Unknown option in call to Russian Convert\n");
-    return;
-  }
-      
-/* End Linux_Dude's changes ;) */
-
-  if(icq_Russian)
-  {
-    for(i=0;i < len;i++)
-    {
-      t_in[i] &= 0377;
-      if(t_in[i] & 0200)
-        t_in[i] = table[t_in[i] & 0177];
-    }
-  }
-}
--- a/src/protocols/icq/eventhandle.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: eventhandle.c 2509 2001-10-13 00:06:18Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <time.h>
-
-#ifndef _WIN32
-#include <unistd.h>
-#endif
-
-#include "icqevent.h"
-#include "icqpacket.h"
-#include "tcplink.h"
-#include "chatsession.h"
-#include "filesession.h"
-
-#include "eventhandle.h"
-
-void icq_TCPProcessPacket2(icq_Packet *p, icq_TCPLink *tcplink)
-{
-  icq_MessageEvent *pevent=(icq_MessageEvent *)icq_ParsePacket(p);
-  icq_Event *pbase=(icq_Event *)pevent;
-
-  icq_Link *icqlink=tcplink->icqlink;
-
-  if (pbase->uin != tcplink->remote_uin)
-  {
-    /* TODO: spoofed packet! */
-  }
-
-  pbase->handleEvent(pbase, icqlink);
-
-  /* notify library client than the ack was received from remote client */
-  if (pbase->subtype==ICQ_EVENT_ACK)
-  {
-    icq_FmtLog(tcplink->icqlink, ICQ_LOG_MESSAGE, "received ack %d\n", p->id);
-    if(icqlink->icq_RequestNotify)
-    {
-      (*icqlink->icq_RequestNotify)(icqlink, pbase->id,
-        ICQ_NOTIFY_ACK, pevent->status, (void *)pevent->message);
-      (*icqlink->icq_RequestNotify)(icqlink, pbase->id,
-        ICQ_NOTIFY_SUCCESS, 0, 0);
-    }
-  }    
-}
-
-void icq_HandleMessageEvent(icq_Event *pbase, icq_Link *icqlink)
-{
-  icq_MessageEvent *pevent=(icq_MessageEvent *)pbase;
-  struct tm *ptime=localtime(&(pbase->time));
-
-  if (pbase->subtype==ICQ_EVENT_MESSAGE && icqlink->icq_RecvMessage)
-  {
-    (*icqlink->icq_RecvMessage)(icqlink, pbase->uin, ptime->tm_hour,
-      ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1,
-      ptime->tm_year+1900, pevent->message);
-    /* TODO: send ack */
-  }
-
-}
-
-void icq_HandleURLEvent(icq_Event *pbase, icq_Link *icqlink) 
-{
-  icq_URLEvent *pevent=(icq_URLEvent *)pbase;
-  struct tm *ptime=localtime(&(pbase->time));
-
-  if (pbase->subtype==ICQ_EVENT_MESSAGE && icqlink->icq_RecvURL)
-  {
-    (*icqlink->icq_RecvURL)(icqlink, pbase->uin, ptime->tm_hour,
-      ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1,
-      ptime->tm_year+1900, pevent->url, pevent->message);
-    /* TODO: send ack */
-  }
-}
-
-void icq_HandleChatRequestEvent(icq_Event *pbase, icq_Link *icqlink)
-{
-  icq_MessageEvent *pmsgevent=(icq_MessageEvent *)pmsgevent;
-
-  struct tm *ptime=localtime(&(pbase->time));
-
-  switch(pbase->subtype)
-  {
-    case ICQ_EVENT_MESSAGE:
-      if (icqlink->icq_RecvChatReq)
-        (*icqlink->icq_RecvChatReq)(icqlink, pbase->uin,
-          ptime->tm_hour, ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1,
-          ptime->tm_year+1900, pmsgevent->message, pbase->id);
-      /* don't send an ack to the remote client!  library client is
-       * responsible for sending the ack once the user accepts
-       * or denies the request */
-      break;
-    case ICQ_EVENT_ACK:
-      icq_HandleChatRequestAck(pbase, icqlink);
-      break;
-    case ICQ_EVENT_CANCEL:
-      /* TODO */
-      break;
-    default:
-      /* TODO */
-      break;
-  }
-}
-
-void icq_HandleChatRequestAck(icq_Event *pbase, icq_Link *icqlink)
-{
-  icq_ChatRequestEvent *pevent=(icq_ChatRequestEvent *)pbase;
-  icq_TCPLink *pchatlink;
-  icq_ChatSession *pchat;
-  icq_Packet *p2;
-
-  /* once a chat request acknowledgement has been received, the remote
-   * client opens up a listening port for us.  we need to connect to
-   * this port and all chat session communication takes place over
-   * this new tcp link */
-  pchatlink=icq_TCPLinkNew(icqlink);
-  pchatlink->type=TCP_LINK_CHAT;
-  pchatlink->id=pbase->id;
-
-  /* create a new chat session to manage the communication, and link
-   * it to the tcp link */
-  pchat=icq_ChatSessionNew(icqlink);
-  pchat->id=pbase->id;
-  pchat->remote_uin=pbase->uin;
-  pchatlink->session=pchat;
-
-  icq_ChatSessionSetStatus(pchat, CHAT_STATUS_CONNECTING);
-
-  /* initiate the connection to the remote client's chat session 
-   * port, which was specified in the ack event they sent */
-  icq_TCPLinkConnect(pchatlink, pbase->uin, pevent->port);
-
-  /* send off chat init event */
-  p2=icq_TCPCreateChatInfoPacket(pchatlink, icqlink->icq_Nick, 0x00ffffff,
-    0x00000000);
-  icq_TCPLinkSend(pchatlink, p2);  
-}
-
-
-void icq_HandleFileRequestEvent(icq_Event *pbase, icq_Link *icqlink)
-{
-  icq_FileRequestEvent *pevent=(icq_FileRequestEvent *)pbase;
-  icq_MessageEvent *pmsgevent=(icq_MessageEvent *)pmsgevent;
-  struct tm *ptime=localtime(&(pbase->time));
-
-  switch(pbase->subtype)
-  {
-    case ICQ_EVENT_MESSAGE:
-      if (icqlink->icq_RecvFileReq)
-        (*icqlink->icq_RecvFileReq)(icqlink, pbase->uin,
-          ptime->tm_hour, ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1,
-          ptime->tm_year+1900, pmsgevent->message, pevent->filename,
-          pevent->filesize, pbase->id);
-      /* don't send an ack to the remote client!  library client is
-       * responsible for sending the ack once the user accepts
-       * or denies the request */
-      break;
-    case ICQ_EVENT_ACK:
-      icq_HandleFileRequestAck(pbase, icqlink);
-      break;
-    case ICQ_EVENT_CANCEL:
-      break;
-    default:
-      /* TODO */
-      break;
-  }
-}
-
-void icq_HandleFileRequestAck(icq_Event *pbase, icq_Link *icqlink)
-{
-  icq_FileRequestEvent *pevent=(icq_FileRequestEvent *)pbase;
-  icq_TCPLink *pfilelink;
-  icq_FileSession *pfile;
-  icq_Packet *p2;
-
-  /* once a file request acknowledgement has been received, the remote
-   * client opens up a listening port for us.  we need to connect to
-   * this port and all file transfer communication takes place over
-   * this new tcp link */
-  pfilelink=icq_TCPLinkNew(icqlink);
-  pfilelink->type=TCP_LINK_FILE;
-
-  /* a file session was created when the request was initially sent,
-   * but it wasn't attached to a tcp link because one did not exist. 
-   * find the file sesion now and link it to the new tcp link */
-  pfile=icq_FindFileSession(icqlink, pbase->uin, 
-    pbase->id); /* TODO: make sure find session succeeded */
-  pfile->tcplink=pfilelink;
-  pfilelink->id=pfile->id;
-  pfilelink->session=pfile;
-
-  /* notify the library client of the created file session */
-  if (icqlink->icq_RequestNotify)
-    (*icqlink->icq_RequestNotify)(icqlink, pfile->id,
-      ICQ_NOTIFY_FILESESSION, sizeof(icq_FileSession), pfile);
-  icq_FileSessionSetStatus(pfile, FILE_STATUS_CONNECTING);
-
-  /* initiate the connection to the remote client's file session 
-   * port, which was specified in the ack event they sent */
-  icq_TCPLinkConnect(pfilelink, pbase->uin, pevent->port);
-
-  /* send off the file transfer init event */
-  /* TODO: convert file packets to events */
-  p2=icq_TCPCreateFile00Packet( pfile->total_files,
-    pfile->total_bytes, pfile->current_speed, icqlink->icq_Nick);
-  icq_TCPLinkSend(pfilelink, p2); 
-}
-
-
-/*
-icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown message type %d!\n", type);
-icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown packet command %d!\n",
- command); 
-
- TODO: conversion
-    strncpy(data,message,512) ;
-    icq_RusConv("wk",data) ;
-
-
- TODO: ack code
-
-    if(plink)
-    {
-      pack=icq_TCPCreateMessageAck(plink,0);
-      icq_PacketAppend32(pack, id);
-      icq_PacketSend(pack, plink->socket);
-      icq_PacketDelete(pack);
-    }
-*/
--- a/src/protocols/icq/eventhandle.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: eventhandle.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _EVENTHANDLE_H
-#define _EVENTHANDLE_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-void icq_HandleMessageEvent(icq_Event *pevent, icq_Link *icqlink);
-void icq_HandleURLEvent(icq_Event *pevent, icq_Link *icqlink);
-void icq_HandleChatRequestEvent(icq_Event *base, icq_Link *icqlink);
-void icq_HandleFileRequestEvent(icq_Event *base, icq_Link *icqlink);
-
-void icq_HandleChatRequestAck(icq_Event *pevent, icq_Link *icqlink);
-void icq_HandleFileRequestAck(icq_Event *pevent, icq_Link *icqlink);
-
-#endif /* _EVENTHANDLE_H */
--- a/src/protocols/icq/filesession.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,293 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: filesession.c 2509 2001-10-13 00:06:18Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-#ifdef _MSVC_
-#include <io.h>
-#define open _open
-#define close _close
-#define read _read
-#define write _write
-#endif
-
-#include "icqlib.h"
-#include "filesession.h"
-#include "stdpackets.h"
-#include "socketmanager.h"
-
-icq_FileSession *icq_FileSessionNew(icq_Link *icqlink)
-{
-  icq_FileSession *p=(icq_FileSession *)malloc(sizeof(icq_FileSession));
-
-  if (p)
-  {
-    p->status=0;
-    p->id=0L;
-    p->icqlink=icqlink;
-    p->tcplink=NULL;
-    p->current_fd=-1;
-    p->current_file_num=0;
-    p->current_file_progress=0;
-    p->current_file_size=0;
-    p->files=0L;
-    p->current_speed=100;
-    p->total_bytes=0;
-    p->total_files=0;
-    p->total_transferred_bytes=0;
-    p->working_dir[0]=0;
-    p->user_data=NULL;
-    icq_ListInsert(icqlink->d->icq_FileSessions, 0, p);
-  }
-	
-  return p;
-}
-
-void icq_FileSessionDelete(void *pv)
-{
-  icq_FileSession *p=(icq_FileSession *)pv;
-
-  invoke_callback(p->icqlink, icq_FileNotify)(p, FILE_NOTIFY_CLOSE, 0, 
-    NULL);
-
-  if(p->files) {
-    char **p2=p->files;
-    while(*p2)
-      free(*(p2++));
-    free(p->files);
-    p->files=NULL;
-  }
-
-  if (p->current_fd > -1 ) {
-     close(p->current_fd);
-     p->current_fd=-1;
-  }
-
-  free(p);
-}
-
-int _icq_FindFileSession(void *p, va_list data)
-{
-  icq_FileSession *psession=(icq_FileSession *)p;
-  DWORD uin=va_arg(data, DWORD);
-  unsigned long id=va_arg(data, unsigned long);
-  
-  return (psession->remote_uin == uin) && ( id ? (psession->id == id) : 1 );
-
-}
-
-icq_FileSession *icq_FindFileSession(icq_Link *icqlink, DWORD uin,
-  unsigned long id)
-{
-  return icq_ListTraverse(icqlink->d->icq_FileSessions, _icq_FindFileSession, 
-    uin, id);
-}
-
-void icq_FileSessionSetStatus(icq_FileSession *p, int status)
-{
-  if(status!=p->status)
-  {
-    p->status=status;
-    if(p->id)
-      invoke_callback(p->icqlink, icq_FileNotify)(p, FILE_NOTIFY_STATUS,
-        status, NULL);
-    if (status == FILE_STATUS_SENDING)
-      icq_SocketSetHandler(p->tcplink->socket, ICQ_SOCKET_WRITE,
-        (icq_SocketHandler)icq_FileSessionSendData, p);
-    else
-      icq_SocketSetHandler(p->tcplink->socket, ICQ_SOCKET_WRITE, NULL, NULL);
-  }
-}
-
-void icq_FileSessionSetHandle(icq_FileSession *p, const char *handle)
-{
-  strncpy(p->remote_handle, handle, 64);
-}
-
-void icq_FileSessionSetCurrentFile(icq_FileSession *p, const char *filename)
-{
-#ifdef _WIN32
-  struct _stat file_status;
-#else
-  struct stat file_status;
-#endif
-  char file[1024];
-
-  strcpy(file, p->working_dir);
-  strcat(file, filename);
-
-  if (p->current_fd>-1) {
-    close(p->current_fd);
-    p->current_fd=-1;
-  }
-
-  strncpy(p->current_file, file, 64);
-  p->current_file_progress=0;
-
-  /* does the file already exist? */
-#ifdef _WIN32
-  if (_stat(file, &file_status)==0) {
-#else
-  if (stat(file, &file_status)==0) {
-#endif
-    p->current_file_progress=file_status.st_size;
-    p->total_transferred_bytes+=file_status.st_size;
-#ifdef _WIN32
-    p->current_fd=open(file, _O_WRONLY | _O_APPEND | _O_BINARY);
-#else
-    p->current_fd=open(file, O_WRONLY | O_APPEND);
-#endif
-  } else {
-#ifdef _WIN32
-    p->current_fd=open(file, _O_WRONLY | _O_CREAT | _O_BINARY, 
-      _S_IREAD|_S_IWRITE);
-#else
-    p->current_fd=open(file, O_WRONLY | O_CREAT, S_IRWXU);
-#endif
-  }
-
-  /* make sure we have a valid filehandle */
-  if (p->current_fd == -1)
-    perror("couldn't open file: ");
-      
-}
-
-void icq_FileSessionPrepareNextFile(icq_FileSession *p)
-{
-  int i=0;
-  char **files=p->files;
-
-  p->current_file_num++;
-
-  while(*files) {
-    i++;
-    if(i==p->current_file_num)
-      break;
-    else
-      files++;
-  }
-
-  if(*files) {
-#ifdef _WIN32
-    struct _stat file_status;
-#else
-    struct stat file_status;
-#endif
-
-    if (p->current_fd>-1) {
-       close(p->current_fd);
-       p->current_fd=-1;
-    }
-
-#ifdef _WIN32
-    if (_stat(*files, &file_status)==0) {
-       char *basename=*files;
-       char *pos=strrchr(basename, '\\');
-#else
-    if (stat(*files, &file_status)==0) {
-       char *basename=*files;
-       char *pos=strrchr(basename, '/');
-#endif
-       if(pos) basename=pos+1;
-       strncpy(p->current_file, basename, 64);
-       p->current_file_progress=0;
-       p->current_file_size=file_status.st_size;
-#ifdef _WIN32
-       p->current_fd=open(*files, _O_RDONLY | _O_BINARY);
-#else
-       p->current_fd=open(*files, O_RDONLY);
-#endif
-    }
-
-    /* make sure we have a valid filehandle */
-    if (p->current_fd == -1)
-       perror("couldn't open file: ");
-  }     
-}        
-
-void icq_FileSessionSendData(icq_FileSession *p)
-{
-  /* for now just send a packet at a time */
-  char buffer[2048];
-  int count=read(p->current_fd, buffer, 2048);
-
-  if(count>0) {
-      icq_Packet *p2=icq_TCPCreateFile06Packet(count, buffer);
-      icq_TCPLinkSend(p->tcplink, p2);
-      p->total_transferred_bytes+=count;
-      p->current_file_progress+=count;
-      icq_FileSessionSetStatus(p, FILE_STATUS_SENDING);
-
-      invoke_callback(p->icqlink, icq_FileNotify)(p, FILE_NOTIFY_DATAPACKET,
-        count, buffer);
-  }
-
-  /* done transmitting if read returns less that 2048 bytes */
-  if(count<2048)
-      icq_FileSessionClose(p);
-
-  return;
-}
-
-/* public */
-
-void icq_FileSessionSetSpeed(icq_FileSession *p, int speed)
-{
-  icq_Packet *packet=icq_TCPCreateFile05Packet(speed);
-
-  icq_TCPLinkSend(p->tcplink, packet);
-}
-
-void icq_FileSessionClose(icq_FileSession *p)
-{
-  icq_TCPLink *plink=p->tcplink;
-
-  /* TODO: handle closing already unallocated filesession? */
-
-  /* if we're attached to a tcplink, unattach so the link doesn't try
-   * to close us, and then close the tcplink */
-  if (plink)
-  {
-    plink->session=0L;
-    icq_TCPLinkClose(plink);
-  }
-
-  icq_ListRemove(p->icqlink->d->icq_FileSessions, p);
-  icq_FileSessionDelete(p);
-}   
-
-void icq_FileSessionSetWorkingDir(icq_FileSession *p, const char *dir)
-{
-  int length = sizeof(p->working_dir);
-  strncpy(p->working_dir, dir, length);
-  p->working_dir[length-1]='\0';
-}  
-
-void icq_FileSessionSetFiles(icq_FileSession *p, char **files)
-{
-  p->files=files;
-}
-
--- a/src/protocols/icq/filesession.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,40 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: filesession.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _FILE_SESSION_H
-#define _FILE_SESSION_H
-
-#include "icq.h"
-#include "icqtypes.h"
-
-icq_FileSession *icq_FileSessionNew(icq_Link *);
-void icq_FileSessionDelete(void *);
-void icq_FileSessionSetStatus(icq_FileSession *, int);
-icq_FileSession *icq_FindFileSession(icq_Link *, unsigned long, unsigned long);
-void icq_FileSessionSetHandle(icq_FileSession *, const char *);
-void icq_FileSessionSetCurrentFile(icq_FileSession *, const char *);
-void icq_FileSessionPrepareNextFile(icq_FileSession *);
-void icq_FileSessionSendData(icq_FileSession *);
-
-#endif
--- a/src/protocols/icq/gaim_icq.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,515 +0,0 @@
-#include <string.h>
-#include <stdlib.h>
-#include "icq.h"   /* well, we're doing ICQ, right? */
-#include "gaim.h"  /* needed for every other damn thing */
-#include "prpl.h"  /* needed for prpl */
-#include "proxy.h"
-
-#define USEROPT_NICK 0
-
-static struct prpl *my_protocol = NULL;
-
-struct icq_data {
-	icq_Link *link;
-	int cur_status;
-	gboolean connected;
-};
-
-static guint ack_timer = 0;
-
-static void icq_do_log(icq_Link *link, time_t time, unsigned char level, const char *log) {
-	debug_printf("ICQ debug %d: %s", level, log);
-}
-
-GList *sockets = NULL;
-struct gaim_sock {
-	int socket;
-	int type;
-	gint inpa;
-};
-
-static void gaim_icq_handler(gpointer data, gint source, GaimInputCondition cond) {
-	if (cond & GAIM_INPUT_READ)
-		icq_HandleReadySocket(source, ICQ_SOCKET_READ);
-	if (cond & GAIM_INPUT_WRITE)
-		icq_HandleReadySocket(source, ICQ_SOCKET_WRITE);
-}
-
-static void icq_sock_notify(int socket, int type, int status) {
-	struct gaim_sock *gs = NULL;
-	if (status) {
-		GaimInputCondition cond;
-		if (type == ICQ_SOCKET_READ)
-			cond = GAIM_INPUT_READ;
-		else
-			cond = GAIM_INPUT_WRITE;
-		gs = g_new0(struct gaim_sock, 1);
-		gs->socket = socket;
-		gs->type = type;
-		gs->inpa = gaim_input_add(socket, cond, gaim_icq_handler, NULL);
-		sockets = g_list_append(sockets, gs);
-		debug_printf("Adding socket notifier: %d %d (%d)\n", socket, type, gs->inpa);
-	} else {
-		GList *m = sockets;
-		while (m) {
-			gs = m->data;
-			if ((gs->socket == socket) && (gs->type == type))
-				break;
-			m = g_list_next(m);
-		}
-		if (m) {
-			gaim_input_remove(gs->inpa);
-			sockets = g_list_remove(sockets, gs);
-			debug_printf("Removing socket notifier: %d %d (%d)\n", socket, type, gs->inpa);
-			g_free(gs);
-		}
-	}
-}
-
-static void icq_online(icq_Link *link) {
-	struct gaim_connection *gc = link->icq_UserData;
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	debug_printf("%s is now online.\n", gc->username);
-	if (!id->connected) {
-		account_online(gc);
-		serv_finish_login(gc);
-		icq_ChangeStatus(id->link, STATUS_ONLINE);
-		id->connected = TRUE;
-	}
-}
-
-static void icq_logged_off(icq_Link *link) {
-	struct gaim_connection *gc = link->icq_UserData;
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-
-	if (!id->connected) {
-		gaim_connection_error(gc, "Unable to connect");
-		signoff(gc);
-		return;
-	}
-
-	if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) {
-		gaim_connection_error(gc, "Unable to connect");
-		signoff(gc);
-		return;
-	}
-
-	icq_Login(link, id->cur_status);
-}
-
-static void icq_msg_incoming(icq_Link *link, unsigned long uin, unsigned char hour, unsigned char minute,
-			unsigned char day, unsigned char month, unsigned short year, const char *data) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char buf[256], *tmp = g_malloc(BUF_LONG);
-	g_snprintf(tmp, BUF_LONG, "%s", data);
-	g_snprintf(buf, sizeof buf, "%lu", uin);
-	strip_linefeed(tmp);
-	serv_got_im(gc, buf, tmp, 0, time(NULL), -1);
-	g_free(tmp);
-}
-
-static void icq_user_online(icq_Link *link, unsigned long uin, unsigned long st,
-				unsigned long ip, unsigned short port, unsigned long real_ip,
-				unsigned char tcp_flags) {
-	struct gaim_connection *gc = link->icq_UserData;
-	guint status;
-	char buf[256];
-
-	g_snprintf(buf, sizeof buf, "%lu", uin);
-	status = (st == STATUS_ONLINE) ? 0 : UC_UNAVAILABLE | (st << 1);
-	serv_got_update(gc, buf, TRUE, 0, 0, 0, status);
-}
-
-static void icq_user_offline(icq_Link *link, unsigned long uin) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char buf[256]; g_snprintf(buf, sizeof buf, "%lu", uin);
-	serv_got_update(gc, buf, FALSE, 0, 0, 0, 0);
-}
-
-static void icq_user_status(icq_Link *link, unsigned long uin, unsigned long st) {
-	struct gaim_connection *gc = link->icq_UserData;
-	guint status;
-	char buf[256];
-
-	g_snprintf(buf, sizeof buf, "%lu", uin);
-	status = (st == STATUS_ONLINE) ? 0 : UC_UNAVAILABLE | (st << 1);
-	serv_got_update(gc, buf, TRUE, 0, 0, 0, status);
-}
-
-static gboolean icq_set_timeout_cb(gpointer data) {
-	icq_HandleTimeout();
-	ack_timer = 0;
-	return FALSE;
-}
-
-static void icq_set_timeout(long interval) {
-	debug_printf("icq_SetTimeout: %ld\n", interval);
-	if (interval > 0 && ack_timer == 0)
-		ack_timer = gaim_timeout_add(interval * 1000, icq_set_timeout_cb, NULL);
-	else if (ack_timer > 0) {
-		gaim_timeout_remove(ack_timer);
-		ack_timer = 0;
-	}
-}
-
-static void icq_url_incoming(icq_Link *link, unsigned long uin, unsigned char hour,
-				unsigned char minute, unsigned char day, unsigned char month,
-				unsigned short year, const char *url, const char *descr) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char *msg = g_malloc(BUF_LONG), buf[256];
-	g_snprintf(msg, BUF_LONG, "<A HREF=\"%s\">%s</A>", url, descr);
-	g_snprintf(buf, 256, "%lu", uin);
-	serv_got_im(gc, buf, msg, 0, time(NULL), -1);
-	g_free(msg);
-}
-
-static void icq_wrong_passwd(icq_Link *link) {
-	struct gaim_connection *gc = link->icq_UserData;
-	gaim_connection_error(gc, "Invalid password.");
-	signoff(gc);
-}
-
-static void icq_invalid_uin(icq_Link *link) {
-	struct gaim_connection *gc = link->icq_UserData;
-	gaim_connection_error(gc, "Invalid UIN.");
-	signoff(gc);
-}
-
-static void icq_info_reply(icq_Link *link, unsigned long uin, const char *nick,
-			const char *first, const char *last, const char *email, char auth) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char buf[16 * 1024];
-	char who[16];
-
-	g_snprintf(who, sizeof who, "%lu", uin);
-	g_snprintf(buf, sizeof buf,
-		   "<B>UIN:</B> %lu<BR>"
-		   "<B>Nick:</B> %s<BR>"
-		   "<B>Name:</B> %s %s<BR>"
-		   "<B>Email:</B> %s\n",
-		   uin,
-		   nick,
-		   first, last,
-		   email);
-	g_show_info_text(gc, who, 2, buf, NULL);
-}
-
-static void icq_web_pager(icq_Link *link, unsigned char hour, unsigned char minute,
-		unsigned char day, unsigned char month, unsigned short year, const char *nick,
-		const char *email, const char *msg) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char *who = g_strdup_printf("ICQ Web Pager: %s (%s)", nick, email);
-	char *what = g_malloc(BUF_LONG);
-	g_snprintf(what, BUF_LONG, "%s", msg);
-	serv_got_im(gc, who, what, 0, time(NULL), -1);
-	g_free(who);
-	g_free(what);
-}
-
-static void icq_mail_express(icq_Link *link, unsigned char hour, unsigned char minute,
-		unsigned char day, unsigned char month, unsigned short year, const char *nick,
-		const char *email, const char *msg) {
-	struct gaim_connection *gc = link->icq_UserData;
-	char *who = g_strdup_printf("ICQ Mail Express: %s (%s)", nick, email);
-	char *what = g_malloc(BUF_LONG);
-	g_snprintf(what, BUF_LONG, "%s", msg);
-	serv_got_im(gc, who, what, 0, time(NULL), -1);
-	g_free(who);
-	g_free(what);
-}
-
-static void icq_req_not(icq_Link *link, unsigned long id, int type, int arg, void *data) {
-	if (type == ICQ_NOTIFY_FAILED)
-		do_error_dialog(_("Gaim encountered an error communicating with the ICQ server."), NULL, GAIM_ERROR);
-	return;
-}
-
-static void icq_recv_add(icq_Link *link, unsigned long id, unsigned char hour, unsigned char minute,
-		unsigned char day, unsigned char month, unsigned short year, const char *nick,
-		const char *first, const char *last, const char *email)
-{
-	char uin[16];
-	g_snprintf(uin, sizeof(uin), "%ld", id);
-	show_got_added(link->icq_UserData, NULL, uin, nick, NULL);
-}
-
-struct icq_auth {
-	icq_Link *link;
-	char *nick;
-	unsigned long uin;
-	struct gaim_connection *gc;
-};
-
-static void icq_den_auth(struct icq_auth *iq)
-{
-	g_free(iq->nick);
-	g_free(iq);
-}
-
-static void icq_add_after_auth(struct icq_auth *iq)
-{
-	if (g_slist_find(connections, iq->gc)) {
-		char uin[16];
-		g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
-		show_add_buddy(iq->gc, uin, NULL, iq->nick);
-	}
-	icq_den_auth(iq);
-}
-
-static void icq_acc_auth(struct icq_auth *iq)
-{
-	if (g_slist_find(connections, iq->gc)) {
-		char msg[1024];
-		char uin[16];
-		struct icq_auth *iqnew;
-
-		icq_SendAuthMsg(iq->link, iq->uin);
-
-		g_snprintf(uin, sizeof(uin), "%ld", iq->uin);
-		if (gaim_find_buddy(iq->gc->account, uin))
-			return;
-
-		iqnew = g_memdup(iq, sizeof(struct icq_auth));
-		iqnew->nick = g_strdup(iq->nick);
-
-		g_snprintf(msg, sizeof(msg), "Add %ld to your buddy list?", iq->uin);
-		do_ask_dialog(msg, NULL, iqnew, _("Add"), icq_add_after_auth, _("Cancel"), icq_den_auth, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
-	}
-
-	icq_den_auth(iq);
-}
-
-static void icq_auth_req(icq_Link *link, unsigned long uin, unsigned char hour, unsigned char minute,
-		unsigned char day, unsigned char month, unsigned short year, const char *nick,
-		const char *first, const char *last, const char *email, const char *reason)
-{
-	char msg[8192];
-	struct icq_auth *iq = g_new0(struct icq_auth, 1);
-	iq->link = link;
-	iq->nick = g_strdup(nick);
-	iq->uin = uin;
-	iq->gc = link->icq_UserData;
-
-	g_snprintf(msg, sizeof(msg), _("The user %s (%s%s%s%s%s) wants you to authorize them."),
-			nick, first ? first : "", first && last ? " " : "", last ? last : "",
-			(first || last) && email ? ", " : "", email ? email : "");
-	do_ask_dialog(msg, NULL, iq, _("Authorize"), icq_acc_auth, _("Deny"), icq_den_auth, my_protocol->plug ? my_protocol->plug->handle : NULL, FALSE);
-}
-
-static void icq_login(struct gaim_account *account) {
-	struct gaim_connection *gc = new_gaim_conn(account);
-	struct icq_data *id = gc->proto_data = g_new0(struct icq_data, 1);
-	struct gaim_proxy_info *gpi = account->gpi;
-	icq_Link *link;
-	char ps[9];
-
-	if(!gpi)
-		gpi = &global_proxy_info;
-
-	gc->checkbox = _("Send message through server");
-
-	icq_LogLevel = ICQ_LOG_MESSAGE;
-
-	g_snprintf(ps, sizeof(ps), "%s", account->password);
-	link = id->link = icq_ICQLINKNew(atol(account->username), ps,
-			  account->proto_opt[USEROPT_NICK][0] ? account->proto_opt[USEROPT_NICK] : "gaim user",
-			  TRUE);
-	g_snprintf(gc->displayname, sizeof(gc->displayname), "%s", account->proto_opt[USEROPT_NICK]);
-
-	link->icq_Logged = icq_online;
-	link->icq_Disconnected = icq_logged_off;
-	link->icq_RecvMessage = icq_msg_incoming;
-	link->icq_RecvURL = icq_url_incoming;
-	link->icq_RecvWebPager = icq_web_pager;
-	link->icq_RecvMailExpress = icq_mail_express;
-	link->icq_RecvAdded = icq_recv_add;
-	link->icq_RecvAuthReq = icq_auth_req;
-	link->icq_UserOnline = icq_user_online;
-	link->icq_UserOffline = icq_user_offline;
-	link->icq_UserStatusUpdate = icq_user_status;
-	link->icq_InfoReply = icq_info_reply;
-	link->icq_WrongPassword = icq_wrong_passwd;
-	link->icq_InvalidUIN = icq_invalid_uin;
-	link->icq_Log = icq_do_log;
-	link->icq_RequestNotify = icq_req_not;
-	link->icq_UserData = gc;
-
-	if (gpi->proxytype == PROXY_SOCKS5)
-		icq_SetProxy(link, gpi->proxyhost, gpi->proxyport, gpi->proxyuser[0], gpi->proxyuser, gpi->proxypass);
-
-	icq_ContactClear(id->link);
-
-	if (icq_Connect(link, "icq.mirabilis.com", 4000) < 1) {
-		gaim_connection_error(gc, _("Unable to connect."));
-		signoff(gc);
-		return;
-	}
-
-	id->cur_status = STATUS_ONLINE;
-	icq_Login(link, STATUS_ONLINE);
-
-	gaim_connection_update_progress(gc, _("Connecting..."), 0, 2);
-}
-
-static void icq_close(struct gaim_connection *gc) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-
-	icq_Logout(id->link);
-	icq_Disconnect(id->link);
-	icq_ICQLINKDelete(id->link);
-	g_free(id);
-}
-
-static int icq_send_msg(struct gaim_connection *gc, const char *who, const char *msg, int len, int flags) {
-	if (!(flags & IM_FLAG_AWAY) && (strlen(msg) > 0)) {
-		struct icq_data *id = (struct icq_data *)gc->proto_data;
-		long w = atol(who);
-		icq_SendMessage(id->link, w, msg,
-				(flags & IM_FLAG_CHECKBOX) ? ICQ_SEND_THRUSERVER : ICQ_SEND_BESTWAY);
-	}
-	return 1;
-}
-
-static void icq_keepalive(struct gaim_connection *gc) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	icq_KeepAlive(id->link);
-}
-
-static void icq_add_buddy(struct gaim_connection *gc, GaimBuddy *buddy) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	icq_ContactAdd(id->link, atol(buddy->name));
-	icq_ContactSetVis(id->link, atol(buddy->name), TRUE);
-}
-
-static void icq_add_buddies(struct gaim_connection *gc, GList *buddies) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	while (buddies) {
-		Gaimbuddy *buddy = buddies->data;
-		icq_ContactAdd(id->link, atol(buddy->name));
-		icq_ContactSetVis(id->link, atol(buddy->name), TRUE);
-		buddies = buddies->next;
-	}
-}
-
-static void icq_rem_buddy(struct gaim_connection *gc, char *who, char *group) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	icq_ContactRemove(id->link, atol(who));
-}
-
-static void icq_set_away(struct gaim_connection *gc, char *state, char *msg) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-
-	if (gc->away) {
-		g_free(gc->away);
-		gc->away = NULL;
-	}
-
-	if (!strcmp(state, "Online"))
-		icq_ChangeStatus(id->link, STATUS_ONLINE);
-	else if (!strcmp(state, "Away")) {
-		icq_ChangeStatus(id->link, STATUS_AWAY);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Do Not Disturb")) {
-		icq_ChangeStatus(id->link, STATUS_DND);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Not Available")) {
-		icq_ChangeStatus(id->link, STATUS_NA);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Occupied")) {
-		icq_ChangeStatus(id->link, STATUS_OCCUPIED);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Free For Chat")) {
-		icq_ChangeStatus(id->link, STATUS_FREE_CHAT);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, "Invisible")) {
-		icq_ChangeStatus(id->link, STATUS_INVISIBLE);
-		gc->away = g_strdup("");
-	} else if (!strcmp(state, GAIM_AWAY_CUSTOM)) {
-		if (msg) {
-			icq_ChangeStatus(id->link, STATUS_NA);
-			gc->away = g_strdup("");
-		} else {
-			icq_ChangeStatus(id->link, STATUS_ONLINE);
-		}
-	}
-}
-
-static const char *icq_list_icon(struct gaim_account *a, struct buddy *b) {
-	return "icq";
-}
-
-/*	guint status;
-	if (uc == 0)
-		return icon_online_xpm;
-	status = uc >> 1;
-	if (status & STATUS_NA)
-		return icon_na_xpm;
-	if (status & STATUS_DND)
-		return icon_dnd_xpm;
-	if (status & STATUS_OCCUPIED)
-		return icon_occ_xpm;
-	if (status & STATUS_AWAY)
-		return icon_away_xpm;
-	if (status & STATUS_FREE_CHAT)
-		return icon_ffc_xpm;
-	if (status & STATUS_INVISIBLE)
-		return NULL;
-	return icon_online_xpm;
-	}*/
-
-static void icq_get_info(struct gaim_connection *gc, const char *who) {
-	struct icq_data *id = (struct icq_data *)gc->proto_data;
-	icq_SendInfoReq(id->link, atol(who));
-}
-
-static GList *icq_away_states(struct gaim_connection *gc) {
-	GList *m = NULL;
-
-	m = g_list_append(m, "Online");
-	m = g_list_append(m, "Away");
-	m = g_list_append(m, "Do Not Disturb");
-	m = g_list_append(m, "Not Available");
-	m = g_list_append(m, "Occupied");
-	m = g_list_append(m, "Free For Chat");
-	m = g_list_append(m, "Invisible");
-
-	return m;
-}
-
-void icq_init(struct prpl *ret) {
-	struct proto_user_opt *puo;
-	ret->protocol = PROTO_ICQ;
-	ret->name = g_strdup("ICQ");
-	ret->list_icon = icq_list_icon;
-	ret->away_states = icq_away_states;
-	ret->buddy_menu = NULL;
-	ret->login = icq_login;
-	ret->close = icq_close;
-	ret->send_im = icq_send_msg;
-	ret->add_buddy = icq_add_buddy;
-	ret->add_buddies = icq_add_buddies;
-	ret->remove_buddy = icq_rem_buddy;
-	ret->get_info = icq_get_info;
-	ret->set_away = icq_set_away;
-	ret->keepalive = icq_keepalive;
-
-	puo = g_new0(struct proto_user_opt, 1);
-	puo->label = g_strdup(_("Nick:"));
-	puo->def = g_strdup(_("Gaim User"));
-	puo->pos = USEROPT_NICK;
-	ret->user_opts = g_list_append(ret->user_opts, puo);
-
-	my_protocol = ret;
-
-	icq_SocketNotify = icq_sock_notify;
-	icq_SetTimeout = icq_set_timeout;
-}
-
-#ifndef STATIC
-
-G_MODULE_EXPORT void gaim_prpl_init(struct prpl *prpl)
-{
-	icq_init(prpl);
-	prpl->plug->desc.api_version = GAIM_PLUGIN_API_VERSION;
-}
-#endif
--- a/src/protocols/icq/icq.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,666 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icq.h 8967 2004-02-12 19:54:18Z hermanator $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQ_H_
-#define _ICQ_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <sys/time.h>
-#include <sys/types.h>
-#include <unistd.h>
-#else
-#include "libc_interface.h"
-#endif /* _WIN32 */
-
-#ifdef __BEOS__
-#include <socket.h>
-#endif
-
-#include <time.h>
-
-/* ICQLIB version defines */
-#define ICQLIBVER   0x010200
-#define ICQLIBMAJOR 1
-#define ICQLIBMINOR 2
-#define ICQLIBMICRO 0
-
-
-#define ICQ_LOG_OFF     0
-#define ICQ_LOG_FATAL   1
-#define ICQ_LOG_ERROR   2
-#define ICQ_LOG_WARNING 3
-#define ICQ_LOG_MESSAGE 4
-
-#define STATUS_OFFLINE     (-1L)
-#define STATUS_ONLINE      0x0000L
-#define STATUS_AWAY        0x0001L
-#define STATUS_DND         0x0002L /* 0x13L */
-#define STATUS_NA          0x0004L /* 0x05L */
-#define STATUS_OCCUPIED    0x0010L /* 0x11L */
-#define STATUS_FREE_CHAT   0x0020L
-#define STATUS_INVISIBLE   0x0100L
-
-#define ICQ_SEND_THRUSERVER       0
-#define ICQ_SEND_DIRECT           1
-#define ICQ_SEND_BESTWAY          2
-
-#define ICQ_NOTIFY_SUCCESS        0
-#define ICQ_NOTIFY_FAILED         1
-#define ICQ_NOTIFY_CONNECTING     2
-#define ICQ_NOTIFY_CONNECTED      3
-#define ICQ_NOTIFY_SENT           4
-#define ICQ_NOTIFY_ACK            5
-
-#define ICQ_NOTIFY_CHATSESSION    7
-#define ICQ_NOTIFY_FILESESSION    8
-
-#define ICQ_MAX_MESSAGE_SIZE     1024
-#define ICQ_MAX_UDP_MESSAGE_SIZE 480
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-typedef struct
-{
-  const char *name;
-  unsigned short code;
-} icq_ArrayType;
-
-/* dummy forward declarations */
-typedef struct icq_LinkPrivate_s icq_LinkPrivate;
-typedef struct icq_TCPLink_s icq_TCPLink;
-typedef struct icq_FileSession_s icq_FileSession;
-typedef struct icq_ChatSession_s icq_ChatSession;
-typedef struct icq_Link_s icq_Link;
-
-/* Legacy compatibility - remove for icqlib 2.0.0 */
-typedef struct icq_Link_s ICQLINK;
-#define icq_ICQLINKNew icq_LinkNew
-#define icq_ICQLINKDelete icq_LinkDelete
-
-/**
- * The icq_Link structure represents a single connection to the ICQ servers.
- * It is returned as the result of an icq_ICQLINKNew function, and contains
- * connection-specific parameters such as uin, sockets, current status, etc.
- *
- * This structure should be considered read-only.  Modifying it will cause
- * undefined results.
- */
-struct icq_Link_s
-{
-  /* General parameters */
-  
-  /** User Identification Number.  This is your ICQ 'account' number. */
-  unsigned long icq_Uin;
-  
-  /** Our IP as understood by the ICQ server.  This will be set once an
-   * UDP_SRV_LOGIN_REPLY has been received from the ICQ servers, in host
-   * byteorder.  Note this may be different from the actual IP in cases
-   * such as firewalls, ip masquerading, etc. */
-  unsigned long icq_OurIP; 
-  
-  /** The UDP port used to connect to the ICQ server, in host byteorder.  */
-  unsigned short icq_OurPort;
-
-  /** Our current ICQ status: one of the STATUS_* defines.
-   * @see icq_StatusUpdate */
-  unsigned long icq_Status;
-  
-  /** The password used to log into the ICQ server. */  
-  char *icq_Password;
-  
-  /** The user's desired nickname. */
-  char *icq_Nick;
-
-  /* UDP stuff */
-
-  /** socket used to send and received UDP messages */
-  int icq_UDPSok;
-
-  /** Time, in seconds, that a sent UDP message can go without an ACK from the
-   * server before being retransmitted. */
-  int icq_UDPExpireInterval;
-
-  /* TCP stuff */
-
-  /** TCP listen port, in host byte order.  The TCP implementation will listen
-   * here for new connections from other clients.  This is transmitted as
-   * part of the ICQ login process. */
-  unsigned short icq_TCPSrvPort;
-  
-  /** Has TCP been enabled for this connection?
-   * @see icq_Newicq_Link */
-  unsigned char icq_UseTCP;
-  
-  /* SOCKS5 Proxy stuff */
-  
-  /** Should all network traffic be redirected through a proxy? 
-   * @see icq_SetProxy */
-  unsigned char icq_UseProxy;
-  
-  /** Hostname of the SOCKS5 proxy to use. */
-  char *icq_ProxyHost;
-  
-  /** IP Address of the SOCKS5 proxy after DNS resolution, in host byteorder. */
-  unsigned long icq_ProxyIP;
-  
-  /** Port of the SOCKS5 proxy to use, in host byteorder. */
-  unsigned short icq_ProxyPort;
-  
-  /** What's this? :) */
-  int icq_ProxyAuth;
-  
-  /** Username used when logging into the proxy. */
-  char *icq_ProxyName;
-  
-  /** Password used when logging into the proxy. */
-  char *icq_ProxyPass;
-  
-  /** TCP socket used to communicate with the proxy. */
-  int icq_ProxySok;
-    
-  unsigned short icq_ProxyOurPort;  /* HOST byteorder */
-  unsigned long icq_ProxyDestIP;    /* HOST byteorder */
-  unsigned short icq_ProxyDestPort; /* HOST byteorder */
-
-  /* Begin Callbacks */
-  void (*icq_Logged)(icq_Link *icqlink);
-  void (*icq_Disconnected)(icq_Link *icqlink);
-  void (*icq_RecvMessage)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *msg);
-  void (*icq_RecvURL)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *url,
-       const char *descr);
-  void (*icq_RecvContactList)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, int nr,
-       const char **contact_uin, const char **contact_nick);
-  void (*icq_RecvWebPager)(icq_Link *icqlink,unsigned char hour,
-       unsigned char minute, unsigned char day, unsigned char month,
-       unsigned short year, const char *nick, const char *email,
-       const char *msg);
-  void (*icq_RecvMailExpress)(icq_Link *icqlink,unsigned char hour,
-       unsigned char minute, unsigned char day, unsigned char month,
-       unsigned short year, const char *nick, const char *email,
-       const char *msg);
-  void (*icq_RecvChatReq)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *descr,
-       unsigned long seq);
-  void (*icq_RecvFileReq)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *descr,
-       const char *filename, unsigned long filesize, unsigned long seq);
-  void (*icq_RecvAdded)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *nick,
-       const char *first, const char *last, const char *email);
-  void (*icq_RecvAuthReq)(icq_Link *icqlink, unsigned long uin,
-       unsigned char hour, unsigned char minute, unsigned char day,
-       unsigned char month, unsigned short year, const char *nick,
-       const char *first, const char *last, const char *email,
-       const char *reason);
-  void (*icq_UserFound)(icq_Link *icqlink, unsigned long uin,
-       const char *nick, const char *first, const char *last,
-       const char *email, char auth);
-  void (*icq_SearchDone)(icq_Link *icqlink);
-  void (*icq_UpdateSuccess)(icq_Link *icqlink);
-  void (*icq_UpdateFailure)(icq_Link *icqlink);
-  void (*icq_UserOnline)(icq_Link *icqlink, unsigned long uin,
-       unsigned long status, unsigned long ip, unsigned short port,
-       unsigned long real_ip, unsigned char tcp_flag );
-  void (*icq_UserOffline)(icq_Link *icqlink, unsigned long uin);
-  void (*icq_UserStatusUpdate)(icq_Link *icqlink, unsigned long uin,
-       unsigned long status);
-  void (*icq_RecvAwayMsg)(icq_Link *icqlink, unsigned long id,
-       const char *msg);
-  void (*icq_InfoReply)(icq_Link *icqlink, unsigned long uin,
-       const char *nick, const char *first, const char *last,
-       const char *email, char auth);
-  void (*icq_ExtInfoReply)(icq_Link *icqlink, unsigned long uin,
-       const char *city, unsigned short country_code, char country_stat,
-       const char *state, unsigned short age, char gender,
-       const char *phone, const char *hp, const char *about);
-  void (*icq_WrongPassword)(icq_Link *icqlink);
-  void (*icq_InvalidUIN)(icq_Link *icqlink);
-  void (*icq_Log)(icq_Link *icqlink, time_t log_time, unsigned char level,
-       const char *str);
-  void (*icq_SrvAck)(icq_Link *icqlink, unsigned short seq);
-  void (*icq_RequestNotify)(icq_Link *icqlink, unsigned long id, 
-       int type, int arg, void *data);
-  void (*icq_FileNotify)(icq_FileSession *session, int type, int arg,
-       void *data);
-  void (*icq_ChatNotify)(icq_ChatSession *session, int type, int arg,
-       void *data);
-  void (*icq_NewUIN)(icq_Link *icqlink, unsigned long uin);
-  void (*icq_MetaUserFound)(icq_Link *icqlink, unsigned short seq2,
-       unsigned long uin, const char *nick, const char *first,
-       const char *last, const char *email, char auth);
-  void (*icq_MetaUserInfo)(icq_Link *icqlink, unsigned short seq2,
-       const char *nick, const char *first, const char *last,
-       const char *pri_eml, const char *sec_eml, const char *old_eml,
-       const char *city, const char *state, const char *phone, const char *fax,
-       const char *street, const char *cellular, unsigned long zip,
-       unsigned short country, unsigned char timezone, unsigned char auth,
-       unsigned char webaware, unsigned char hideip);
-  void (*icq_MetaUserWork)(icq_Link *icqlink, unsigned short seq2,
-       const char *wcity, const char *wstate, const char *wphone,
-       const char *wfax, const char *waddress, unsigned long wzip,
-       unsigned short wcountry, const char *company, const char *department,
-       const char *job, unsigned short occupation, const char *whomepage);
-  void (*icq_MetaUserMore)(icq_Link *icqlink, unsigned short seq2,
-       unsigned short age, unsigned char gender, const char *homepage,
-       unsigned char byear, unsigned char bmonth, unsigned char bday,
-       unsigned char lang1, unsigned char lang2, unsigned char lang3);
-  void (*icq_MetaUserAbout)(icq_Link *icqlink, unsigned short seq2,
-       const char *about);
-  void (*icq_MetaUserInterests)(icq_Link *icqlink, unsigned short seq2,
-       unsigned char num, unsigned short icat1, const char *int1,
-       unsigned short icat2, const char *int2, unsigned short icat3,
-       const char *int3, unsigned short icat4, const char *int4);
-  void (*icq_MetaUserAffiliations)(icq_Link *icqlink, unsigned short seq2,
-       unsigned char anum, unsigned short acat1, const char *aff1,
-       unsigned short acat2, const char *aff2, unsigned short acat3,
-       const char *aff3, unsigned short acat4, const char *aff4,
-       unsigned char bnum, unsigned short bcat1, const char *back1,
-       unsigned short bcat2, const char *back2, unsigned short bcat3,
-       const char *back3, unsigned short bcat4, const char *back4);
-  void (*icq_MetaUserHomePageCategory)(icq_Link *icqlink,
-       unsigned short seq2, unsigned char num, unsigned short hcat1,
-       const char *htext1);
-  /* End Callbacks */
-       
-  /** Private data pointer. */
-  icq_LinkPrivate *d;
-  
-  /** Space for user data */
-  void *icq_UserData;
-};
-
-extern int icq_Russian;
-extern unsigned char icq_LogLevel;
-extern icq_ArrayType icq_Countries[];
-extern icq_ArrayType icq_Genders[];
-
-icq_Link *icq_LinkNew(unsigned long uin, const char *password,
-  const char *nick, unsigned char useTCP);
-void icq_LinkInit(icq_Link *icqlink, unsigned long uin, const char *password,
-  const char *nick, unsigned char useTCP);
-void icq_LinkDestroy(icq_Link *icqlink);
-void icq_LinkDelete(icq_Link *icqlink);
-
-void icq_Main(void);
-const char *icq_GetCountryName(unsigned short code);
-const char *icq_GetMetaOccupationName(unsigned short code);
-const char *icq_GetMetaBackgroundName(unsigned short code);
-const char *icq_GetMetaAffiliationName(unsigned short code);
-const char *icq_GetMetaLanguageName(unsigned short code);
-
-/* Begin icq_Link methods */  
-void icq_SetProxy(icq_Link *icqlink, const char *phost, unsigned short pport,
-     int pauth, const char *pname, const char *ppass);
-void icq_UnsetProxy(icq_Link *icqlink);
-
-int icq_Connect(icq_Link *icqlink, const char *hostname, int port);
-void icq_Disconnect(icq_Link *icqlink);
-int icq_GetSok(icq_Link *icqlink);
-int icq_GetProxySok(icq_Link *icqlink);
-void icq_HandleServerResponse(icq_Link *icqlink);
-void icq_HandleProxyResponse(icq_Link *icqlink);
-unsigned short icq_KeepAlive(icq_Link *icqlink);
-void icq_Login(icq_Link *icqlink, unsigned long status);
-void icq_Logout(icq_Link *icqlink);
-void icq_SendContactList(icq_Link *icqlink);
-void icq_SendVisibleList(icq_Link *icqlink);
-void icq_SendInvisibleList(icq_Link *icqlink);
-void icq_SendNewUser(icq_Link *icqlink, unsigned long uin);
-unsigned long icq_SendMessage(icq_Link *icqlink, unsigned long uin,
-     const char *text, unsigned char thruSrv);
-unsigned long icq_SendURL(icq_Link *icqlink, unsigned long uin, const char *url,
-     const char *descr, unsigned char thruSrv);
-void icq_ChangeStatus(icq_Link *icqlink, unsigned long status);
-unsigned short icq_SendInfoReq(icq_Link *icqlink, unsigned long uin);
-unsigned short icq_SendExtInfoReq(icq_Link *icqlink, unsigned long uin);
-unsigned short icq_SendAuthMsg(icq_Link *icqlink, unsigned long uin);
-void icq_SendSearchReq(icq_Link *icqlink, const char *email, const char *nick,
-     const char* first, const char* last);
-void icq_SendSearchUINReq(icq_Link *icqlink, unsigned long uin);
-
-void icq_RegNewUser(icq_Link *icqlink, const char *pass);
-unsigned short icq_UpdateUserInfo(icq_Link *icqlink, const char *nick,
-     const char *first, const char *last, const char *email);
-unsigned short icq_UpdateAuthInfo(icq_Link *icqlink, unsigned long auth);
-unsigned short icq_UpdateMetaInfoSet(icq_Link *icqlink, const char *nick,
-     const char *first, const char *last, const char *email,
-     const char *email2, const char *email3, const char *city,
-     const char *state, const char *phone, const char *fax, const char *street,
-     const char *cellular, unsigned long zip, unsigned short cnt_code,
-     unsigned char cnt_stat, unsigned char emailhide);
-unsigned short icq_UpdateMetaInfoHomepage(icq_Link *icqlink, unsigned char age,
-     const char *homepage, unsigned char year, unsigned char month,
-     unsigned char day, unsigned char lang1, unsigned char lang2,
-     unsigned char lang3);
-unsigned short icq_UpdateMetaInfoAbout(icq_Link *icqlink, const char *about);
-unsigned short icq_UpdateMetaInfoSecurity(icq_Link *icqlink, unsigned char reqauth,
-     unsigned char webpresence, unsigned char pubip);
-unsigned short icq_UpdateNewUserInfo(icq_Link *icqlink, const char *nick,
-     const char *first, const char *last, const char *email);
-unsigned short icq_SendMetaInfoReq(icq_Link *icqlink, unsigned long uin);
-
-void icq_FmtLog(icq_Link *icqlink, int level, const char *fmt, ...);
-
-void icq_ContactAdd(icq_Link *icqlink, unsigned long cuin);
-void icq_ContactRemove(icq_Link *icqlink, unsigned long cuin);
-void icq_ContactClear(icq_Link *icqlink );
-void icq_ContactSetVis(icq_Link *icqlink, unsigned long cuin, unsigned char on);
-void icq_ContactSetInvis(icq_Link *icqlink, unsigned long cuin, unsigned char on);
-
-/*** TCP ***/
-void icq_TCPMain(icq_Link *icqlink);
-
-void icq_TCPProcessReceived(icq_Link *icqlink);
-
-unsigned long icq_TCPSendMessage(icq_Link *icqlink, unsigned long uin,
-     const char *message);
-unsigned long icq_TCPSendURL(icq_Link *icqlink, unsigned long uin,
-     const char *message, const char *url);
-unsigned long icq_TCPSendAwayMessageReq(icq_Link *icqlink, unsigned long
-     uin, int status);
-unsigned long icq_SendChatRequest(icq_Link *icqlink, unsigned long uin,
-     const char *message);
-void icq_AcceptChatRequest(icq_Link *icqlink, unsigned long uin, unsigned long seq);
-
-void icq_CancelChatRequest(icq_Link *icqlink, unsigned long uin, 
-     unsigned long sequence);
-void icq_RefuseChatRequest(icq_Link *icqlink, unsigned long uin,
-     unsigned long sequence, const char *reason);
-
-/* End icq_Link Methods */
-
-/*** TCP ***/
-
-/** \defgroup ChatSession Chat Session Documentation
- * icqlib's 'Chat Session' abstraction represents ICQ's 'chat' function
- * between two participants.  Multi-party chat is not yet supported.
- *
- * An icq_ChatSession is instantiated when a 'Chat Request' event is
- * accepted.  Upon receipt of a 'Chat Accept' event or a call to
- * icq_AcceptChatRequest, icqlib will create a new chat session and pass the
- * new chat session pointer back to the library client through the
- * icq_RequestNotify / ICQ_NOTIFY_CHATSESSION callback.  This pointer should
- * be stored by the library client, as multiple chat sessions may be in
- * progress at any given time.  The icq_ChatSession pointer is used as a key
- * for all future communication between the library and the library client to
- * indicate which icq_ChatSession is currently being dealt with.
- *
- * icqlib communicates chat session events through use of the icq_ChatNotify
- * callback, such as the CHAT_NOTIFY_DATA event.  The library client
- * can perform operations on a chat session by use of the icq_ChatSession*
- * functions, such as sending data to the remote uin by using the
- * icq_ChatSessionSendData function.  
- *
- * A new chat session must first undergo an initialization sequence before is
- * ready to transmit and receive data.  As this initialization is in progress
- * the chat session will transition through various statuses depending on
- * whether icqlib sent the accept event or it received the accept event.
- * Each change in chat session status will be reported to the library
- * client through use of the icq_ChatNotify callback, with a @type parameter
- * of CHAT_NOTIFY_STATUS and an @a arg parameter of the status value.
- *
- * Once the chat session initialization is complete, both sides will enter
- * the CHAT_STATUS_READY state, indicating that the chat session is
- * ready to send and receive data.  Received data is reported through the
- * icq_ChatNotify callback, with a @type of CHAT_NOTIFY_DATA.  The library
- * client can send data using icq_ChatSessionSendData or
- * icq_ChatSessionSendData_n.
- *
- * Chat sessions may be terminated at any time, by either side.  The library
- * client may terminate a chat session by using icq_ChatSessionClose, or 
- * the remote uin may terminate a chat session.  In either instance, a
- * CHAT_STATUS_CLOSE event will be reported through the icq_ChatNotify
- * callback.  Once this callback is complete (e.g. your application's
- * callback handler returns), the icq_ChatSession will be deleted by icqlib 
- * and the session pointer becomes invalid.
- */
-
-/** @name Type Constants
- * @ingroup ChatSession
- * These values are used as the @a type parameter in the icq_ChatNotify
- * callback to indicate the type of chat session event that has occured.
- * The remaining @a arg and @a data parameters passed by the callback
- * are specific to each event;  see the documentation for each type
- * constant.
- */
-
-/*@{*/
-
-/** Status has changed.
- * @param arg new session status - one of the CHAT_STATUS_* defines
- * @param data unused.
- * @ingroup ChatSession
- */
-#define CHAT_NOTIFY_STATUS       1
-
-/** Data has been received from a chat participant.
- * @param arg length of data received
- * @param data pointer to buffer containing received data
- * @ingroup ChatSession
- */
-#define CHAT_NOTIFY_DATA         2
-
-/** Session has been closed, either automatically by icqlib or
- * explicitly by a call to icq_ChatSessionClose.
- * @param arg unused
- * @param data unused
- * @ingroup ChatSession
- */ 
-#define CHAT_NOTIFY_CLOSE        3
-
-/*@}*/
-
-/** @name Status Constants
- * @ingroup ChatSession
- * These constants are used as the @a arg parameter during in the
- * icq_ChatNotify/CHAT_NOTIFY_STATUS callback to indicate the
- * new status of the chat session.
- */
-
-/*@{*/
-
-/** icqlib is listening for a chat connection from the remote uin.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_LISTENING    1
-
-/** A connection has been established with the remote uin.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_CONNECTED    3
-
-/** icqlib is currently waiting for the remote uin to send the chat
- * initialization packet which contains the remote uin's chat handle.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_WAIT_NAME    4
-
-/** icqlib is currently waiting for the remote uin to send the chat
- * initialization packet which contains the remote uin's font information.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_WAIT_FONT    6
-
-/** A connection to the chat session port of the remote uin is in 
- * progress.
- * @ingroup ChatSession
- */
-/* chat session statuses - request sender */
-#define CHAT_STATUS_CONNECTING   2
-
-/** icqlib is currently waiting for the remote uin to send the chat
- * initialization packet which contains the remote uin's chat handle
- * and font information.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_WAIT_ALLINFO 5
-
-/** Chat session initialization has completed successfully.  The session
- * is now fully established - both sides can begin to send data and
- * should be prepared to accept data.
- * @ingroup ChatSession
- */
-#define CHAT_STATUS_READY        7
-
-/*@}*/
-
-/** Chat Session state structure.  This structure is used internally by
- * icqlib to maintain state information about each chat session.  All
- * members should be considered read-only!  Use the appropriate 
- * icq_ChatSession* function to change the state of a chat session,
- * results are undefined if your application attempts to manipulate this
- * structure itself.
- */
-struct icq_ChatSession_s {        
-
-  /** For internal icqlib use only. */
-  unsigned long id;
-  
-  /** Current status of the chat session.  See 'Status Constants' group. */
-  int status;
-  
-  /** ICQLINK that spawned this chat session. */
-  icq_Link *icqlink;
-  
-  /** For internal icqlib use only. */
-  icq_TCPLink *tcplink;
-
-  /** Remote uin number. */
-  unsigned long remote_uin;
-  
-  /** Remote uin's chat handle. */
-  char remote_handle[64];
-
-  /** Space for user data */
-  void *user_data; 
-};
-
-void icq_ChatSessionClose(icq_ChatSession *session);
-void icq_ChatSessionSendData(icq_ChatSession *session, const char *data);
-void icq_ChatSessionSendData_n(icq_ChatSession *session, const char *data,
-  int length);
-
-
-/* FileNotify constants */
-#define FILE_NOTIFY_DATAPACKET   1
-#define FILE_NOTIFY_STATUS       2
-#define FILE_NOTIFY_CLOSE        3
-#define FILE_NOTIFY_NEW_SPEED    4
-#define FILE_NOTIFY_STOP_FILE    5
-
-/* file session statuses- request receiver */
-#define FILE_STATUS_LISTENING    1
-#define FILE_STATUS_CONNECTED    3
-
-/* file session statuses- request sender */
-#define FILE_STATUS_CONNECTING   2
-
-#define FILE_STATUS_INITIALIZING 4
-
-#define FILE_STATUS_NEXT_FILE    5
-
-/* once negotiation is complete, file session enters proper state */
-#define FILE_STATUS_SENDING      6
-#define FILE_STATUS_RECEIVING    7  
-
-struct icq_FileSession_s {
-
-  unsigned long id;
-  int status;
-  icq_Link *icqlink;
-  icq_TCPLink *tcplink;
-
-  int direction;
-
-  unsigned long remote_uin;
-  char remote_handle[64];
-
-  char **files;
-  int total_files;
-  int current_file_num;
-  unsigned long total_bytes;
-  unsigned long total_transferred_bytes;
-
-  char working_dir[512];
-  char current_file[64];
-  int current_fd;
-  unsigned long current_file_size;
-  unsigned long current_file_progress;
-
-  int current_speed;
-
-  /** Space for user data */
-  void *user_data;
-};
-          
-icq_FileSession *icq_AcceptFileRequest(icq_Link *icqlink, unsigned long uin,
-                 unsigned long sequence);
-unsigned long icq_SendFileRequest(icq_Link *icqlink, unsigned long uin,
-              const char *message, char **files);
-void icq_CancelFileRequest(icq_Link *icqlink, unsigned long uin, 
-     unsigned long sequence);
-void icq_RefuseFileRequest(icq_Link *icqlink, unsigned long uin,
-     unsigned long sequence, const char *reason);
-
-void icq_FileSessionSetSpeed(icq_FileSession *p, int speed);
-void icq_FileSessionClose(icq_FileSession *p);
-void icq_FileSessionSetWorkingDir(icq_FileSession *p, const char *dir);
-void icq_FileSessionSetFiles(icq_FileSession *p, char **files);
-
-/* Socket Manager */
-
-#define ICQ_SOCKET_READ  0
-#define ICQ_SOCKET_WRITE 1
-#define ICQ_SOCKET_MAX   2
-
-extern void (*icq_SocketNotify)(int socket_fd, int type, int status);
-
-void icq_HandleReadySocket(int socket_fd, int type);
-
-/* Timeout Manager */
-
-extern void (*icq_SetTimeout)(long interval);
-
-void icq_HandleTimeout(void);
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* _ICQ_H_ */
--- a/src/protocols/icq/icqbyteorder.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/*
- * $Id: icqbyteorder.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * This header defines macros to handle ICQ protocol byte order conversion.
- *
- * Vadim Zaliva <lord@crocodile.org>
- * http://www.crocodile.org/
- * 
- * Copyright (C) 1999 Vadim Zaliva
- * 
- * 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.
- *
- */
-
-/*
- * I am really trying to use builtin optimized byte swap routines.
- * they are highly optimised on some platforms.
- * But as last resort this simple code is used.
- */
-
-#ifndef HAVE_BYTESWAP_H
-# ifndef bswap_32
-unsigned long bswap_32(unsigned long v)
-{
-  unsigned char c,*x=(unsigned char *)&v;
-  c=x[0];x[0]=x[3];x[3]=c;
-  c=x[1];x[1]=x[2];x[2]=c;
-  return v;
-}
-# endif
-
-# ifndef bswap_16
-unsigned short bswap_16(unsigned short v)
-{
-  unsigned char c,*x=(unsigned char *)&v;
-  c=x[0];x[0]=x[1];x[1]=c;
-  return v;
-}
-# endif
-#endif
--- a/src/protocols/icq/icqbyteorder.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,70 +0,0 @@
-/*
- * $Id: icqbyteorder.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * This header defines macros to handle ICQ protocol byte order conversion.
- *
- * Vadim Zaliva <lord@crocodile.org>
- * http://www.crocodile.org/
- * 
- * Copyright (C) 1999 Vadim Zaliva
- * 
- * 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.
- *
- */
-
-/*
- * From ICQ protocol description:
- * "Integers consisting of more than one byte is stored
- * with the least significant byte first, and the most significant byte last
- * (as is usual on the PC/Intel architecture)".
- *
- * whereas the network byte order, as used on the
- * Internet, is Most Significant Byte first. (aka. Big Endian)
- */
-
-#ifndef ICQ_BYTEORDER_H_FLAG
-#define ICQ_BYTEORDER_H_FLAG
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif         
-
-/*
- * I am really trying to use builtin optimized byte swap routines.
- * they are highly optimised on some platforms.
- * But as last resort this simple code is used.
- */
-#ifndef HAVE_BYTESWAP_H
-# ifndef bswap_32
-extern unsigned long bswap_32(unsigned long v);
-# endif
-# ifndef bswap_16
-extern unsigned short bswap_16(unsigned short v);
-# endif
-#endif
-
-#ifdef WORDS_BIGENDIAN
-# define htoicql(x)   bswap_32(x)
-# define icqtohl(x)   bswap_32(x)
-# define htoicqs(x)   bswap_16(x)
-# define icqtohs(x)   bswap_16(x)
-#else
-# define htoicql(x)   (x)
-# define icqtohl(x)   (x)
-# define htoicqs(x)   (x)
-# define icqtohs(x)   (x)
-#endif
-
-#endif
--- a/src/protocols/icq/icqevent.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,475 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqevent.c 2509 2001-10-13 00:06:18Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h" /* for icqbyteorder.h ?! */
-#include "icqbyteorder.h"
-#include "icqevent.h"
-
-#ifdef EVENT_DEBUG
-#include <string.h>
-#include <stdio.h>
-#endif
-
-#define new_event(x, y)   y * x = ( y * )malloc(sizeof(y))
-
-/* generic Event - 'header' for each tcp packet */
-
-void icq_EventInit(icq_Event *p, int type, int subtype, unsigned long uin, 
-  int version)
-{
-  if (!p)
-    return;
-
-  p->uin=uin;
-  p->version=version;
-  p->type=type;
-  p->subtype=subtype;
-  p->direction=ICQ_EVENT_OUTGOING;
-}
-
-icq_Packet *icq_EventCreatePacket(icq_Event *pbase)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  /* create header for tcp packet */
-  icq_PacketAppend32(p, pbase->uin);
-  icq_PacketAppend16(p, pbase->version);
-  icq_PacketAppend16(p, pbase->subtype);
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend32(p, pbase->uin);
-  icq_PacketAppend32(p, pbase->type);
-
-  return p;
-}
-
-void icq_EventParsePacket(icq_Event *pevent, icq_Packet *p)
-{
-  /* parse header of tcp packet */
-  icq_PacketBegin(p);
-  (void)icq_PacketRead32(p);             /* uin */
-  pevent->version=icq_PacketRead16(p);   /* max supported tcp version */
-  pevent->subtype=icq_PacketRead16(p);   /* event subtype */
-  (void)icq_PacketRead16(p);             /* 0x0000 */
-  pevent->uin=icq_PacketRead32(p);       /* uin */
-  pevent->type=icq_PacketRead16(p);      /* event type */
-}
-
-/* Message Event - extends generic Event */
-
-icq_MessageEvent *icq_CreateMessageEvent(int subtype, unsigned long uin, 
-  const char *message) 
-{
-  new_event(p, icq_MessageEvent);
-  icq_Event *pbase=(icq_Event *)p;
-  icq_MessageEventInit(p, ICQ_TCP_MSG_MSG, subtype, uin,
-    ICQ_TCP_MSG_REAL, message);
-
-  pbase->createPacket=icq_MessageCreatePacket;
-
-#ifdef EVENT_DEBUG
-  pbase->eventName=icq_MessageEventName;
-  pbase->eventDump=icq_MessageEventDump;
-#endif
-
-  return p;
-}
-
-void icq_MessageEventInit(icq_MessageEvent *p, int type, int subtype, 
-  unsigned long uin, int msgtype, const char *message)
-{
-  icq_EventInit((icq_Event *)p, type, subtype, uin, ICQ_TCP_VER);
-  p->type=msgtype;
-  p->message=(char *)message;
-  p->status=0; /* FIXME */
-}
-
-icq_Packet *icq_MessageCreatePacket(icq_Event *pbase, icq_TCPLink *plink)
-{
-  icq_MessageEvent *pevent=(icq_MessageEvent *)pbase;
-
-  /* create header */
-  icq_Packet *p=icq_EventCreatePacket(pbase);
-
-  /* append data specific to message event */
-  icq_PacketAppendString(p, (char*)pevent->message);
-  icq_PacketAppend32(p, plink->socket_address.sin_addr.s_addr);
-  /* FIXME: should be RealIp */
-  icq_PacketAppend32(p, htonl(plink->icqlink->icq_OurIP));
-  icq_PacketAppend32(p, plink->socket_address.sin_port);
-  icq_PacketAppend8(p, 0x04);
-  icq_PacketAppend16(p, pevent->status);
-  icq_PacketAppend16(p, pevent->type);
-
-  return p;
-}
-
-void icq_MessageParsePacket(icq_Event *pbase, icq_Packet *p)
-{
-  icq_MessageEvent *pevent=(icq_MessageEvent *)pbase;
-
-  /* parse message event data from packet */
-  pevent->message=(char *)icq_PacketReadString(p);    /* message text */
-  (void)icq_PacketRead32(p);                  /* remote ip */
-  (void)icq_PacketRead32(p);                  /* remote real ip */
-  (void)icq_PacketRead32(p);                  /* remote message port */
-  (void)icq_PacketRead8(p);                   /* tcp flag */
-  pevent->status=icq_PacketRead16(p);         /* remote user status */
-  pevent->type=icq_PacketRead16(p);           /* message type */
-}
-
-#ifdef EVENT_DEBUG
-const char *icq_MessageEventName(icq_Event *p)
-{
-  if (p->type==ICQ_EVENT_MESSAGE)
-    return "message";
-  else if (p->type==ICQ_EVENT_ACK)
-    return "message ack";
-
-  return "message cancel";
-}
-
-const char *icq_MessageEventDump(icq_Event *p)
-{
-  static char buf[255];
-  icq_MessageEvent *pevent=(icq_MessageEvent *)p;
-
-  sprintf(buf, ", type=%x, message=\"%10s...\", status=%x",
-    pevent->type, pevent->message, pevent->status);
-
-  return buf;
-}
-#endif
-
-/* URL Event - extends message Event */
-
-icq_URLEvent *icq_CreateURLEvent(int subtype, unsigned long uin,
-  const char *message, const char *url)
-{
-  char *str=(char *)malloc(strlen(message)+strlen(url)+2);
-  icq_Event *pbase;
-  icq_URLEvent *p;
-
-  strcpy((char*)str, message);
-  *(str+strlen(message))=0xFE;
-  strcpy((char*)(str+strlen(message)+1), url);
-
-  /* TODO: make sure create message event copies message */
-  pbase=(icq_Event *)icq_CreateMessageEvent(subtype, uin, str);
-  p=(icq_URLEvent *)pbase;
-
-  free(str);
-
-  *(p->message+strlen(message))=0x00;
-  p->url=p->message+strlen(message)+1;
-
-  pbase->createPacket=icq_URLCreatePacket;
-
-#ifdef EVENT_DEBUG
-  pbase->eventName=icq_URLEventName;
-  pbase->eventDump=icq_URLEventDump;
-#endif
-
-  return p;
-
-}
-
-icq_Packet *icq_URLCreatePacket(icq_Event *pbase, icq_TCPLink *plink)
-{
-  icq_URLEvent *pevent=(icq_URLEvent *)pbase;
-  icq_Packet *p;
-
-  /* hack message string to include url */
-  *(pevent->message+strlen(pevent->message))=0xFE;
-
-  /* create packet */
-  p=icq_MessageCreatePacket(pbase, plink);
-
-  /* hack message string to seperate url */
-  *(pevent->message+strlen(pevent->message))=0x00;
-
-  return p;
-}
-
-void icq_URLParsePacket(icq_Event *pbase, icq_Packet *p)
-{
-  char *pfe;
-  icq_URLEvent *pevent=(icq_URLEvent *)pbase;
-
-  /* TODO: make sure messageparsepacket allocates message string
-   *       and add a delete event function */
-  icq_MessageParsePacket(pbase, p);
-
-  /* hack message string to seperate url */
-  pfe=strchr(pevent->message, '\xFE');
-  *pfe=0;
-  
-  /* set url */
-  pevent->url=pfe+1;
-
-}
-
-#ifdef EVENT_DEBUG
-const char *icq_URLEventName(icq_Event *p)
-{
-  if (p->type==ICQ_EVENT_MESSAGE)
-    return "url";
-  else if (p->type==ICQ_EVENT_ACK)
-    return "url ack";
-
-  return "url cancel";
-}
-
-const char *icq_URLEventDump(icq_Event *p)
-{
-  static char buf[255];
-  icq_MessageEvent *pevent=(icq_MessageEvent *)p;
-
-  sprintf(buf, ", type=%x, message=\"%10s...\", url=\"%10s...\" status=%x",
-    pevent->type, pevent->message, pevent->url, pevent->status);
-
-  return buf;
-}
-#endif
-
-
-/* Chat Request Event - extends Message Event */
-
-icq_ChatRequestEvent *icq_ChatRequestEventNew(int subtype,
-  unsigned long uin, const char *message, int port)
-{
-  new_event(p, icq_ChatRequestEvent);
-  icq_Event *pbase=(icq_Event *)p;
-  icq_MessageEventInit((icq_MessageEvent *)p, ICQ_TCP_MSG_CHAT, subtype,
-    uin, ICQ_TCP_MSG_REAL, message);
-  p->port=port;
-
-  pbase->createPacket=icq_ChatRequestCreatePacket;
-
-#ifdef EVENT_DEBUG
-  pbase->eventName=icq_ChatRequestEventName;
-  pbase->eventDump=icq_ChatRequestEventDump;
-#endif
-
-  return p;
-}
-
-icq_Packet *icq_ChatRequestCreatePacket(icq_Event *pbase, 
-  icq_TCPLink *plink)
-{
-  icq_ChatRequestEvent *pevent=(icq_ChatRequestEvent *)pbase;
-
-  /* create header and message data */
-  icq_Packet *p=icq_MessageCreatePacket(pbase, plink);
-
-  /* append data specific to chat event */
-  icq_PacketAppendString(p, 0);
-  icq_PacketAppend32(p, htonl(pevent->port));
-  icq_PacketAppend32(p, htoicql(pevent->port));  
-
-  return p;
-}
-
-void icq_ChatParsePacket(icq_Event *pbase, icq_Packet *p)
-{
-  icq_ChatRequestEvent *pevent=(icq_ChatRequestEvent *)pbase;
-  int port;
-
-  /* parse header and message event data */
-  icq_MessageParsePacket(pbase, p);
-
-  /* parse chat event data */
-  (void)icq_PacketReadString(p);      /* null string */
-  port=icq_PacketRead32(p);           /* chat listen port, network order */
-  (void)icq_PacketRead32(p);          /* chat listen port, intel order */
-
-  pevent->port=ntohl(port);
-}
-
-#ifdef EVENT_DEBUG
-const char *icq_ChatRequestEventName(icq_Event *p)
-{
-  if (p->type==ICQ_EVENT_MESSAGE)
-    return "chat request";
-  else if (p->type==ICQ_EVENT_ACK) {
-    icq_MessageEvent *pevent=(icq_MessageEvent *)p;
-    if (pevent->status==ICQ_TCP_STATUS_REFUSE)
-      return "chat request refuse";
-    else
-      return "chat request ack";
-  } else if (p->type==ICQ_EVENT_CANCEL) 
-    return "chat request cancel";
-
-  return "unknown chat request";
-}
-
-const char *icq_ChatRequestEventDump(icq_Event *p)
-{
-  static char buf[255];
-  static char buf2[255];
-  icq_ChatRequestEvent *pevent=(icq_ChatRequestEvent *)p;
-
-  strcpy(buf, icq_MessageEventDump(p));
-  sprintf(buf2, ", port=%d", pevent->port);
-  strcat(buf, buf2);
-
-  return buf;
-}
-#endif
-
-/* File Request Event - builds on Message Event */
-
-icq_FileRequestEvent *icq_FileRequestEventNew(int subtype,
-  unsigned long uin,  const char *message, const char *filename,
-  unsigned long filesize)
-{
-  new_event(p, icq_FileRequestEvent);
-  icq_Event *pbase=(icq_Event *)p;
-  icq_MessageEventInit((icq_MessageEvent *)p, ICQ_TCP_MSG_FILE, subtype,
-    uin, ICQ_TCP_MSG_REAL, message);
-  p->filename=filename;
-  p->filesize=filesize;
-
-  pbase->createPacket=icq_FileRequestCreatePacket;
-
-#ifdef EVENT_DEBUG
-  pbase->eventName=icq_FileRequestEventName;
-  pbase->eventDump=icq_FileRequestEventDump;
-#endif
-
-  return p;
-}
-
-icq_Packet *icq_FileRequestCreatePacket(icq_Event *pbase, 
-  icq_TCPLink *plink)
-{
-  icq_FileRequestEvent *pevent=(icq_FileRequestEvent *)pbase;
-
-  /* create header and message data */
-  icq_Packet *p=icq_MessageCreatePacket(pbase, plink);
-
-  /* append file event data */
-  icq_PacketAppend32(p, htonl(pevent->port));
-  icq_PacketAppendString(p, pevent->filename);
-  icq_PacketAppend32(p, pevent->filesize);
-  icq_PacketAppend32(p, htoicql(pevent->port));
-
-  return p;
-}
-
-void icq_FileParsePacket(icq_Event *pbase, icq_Packet *p)
-{
-  icq_FileRequestEvent *pevent=(icq_FileRequestEvent *)pbase;
-
-  /* parse header and message data */
-  icq_MessageParsePacket(pbase, p);
-
-  /* parse file event data */
-  pevent->port=ntohl(icq_PacketRead32(p));  /* file listen port, network */
-  pevent->filename=icq_PacketReadString(p); /* filename text */
-  pevent->filesize=icq_PacketRead32(p);     /* total size */
-  (void)icq_PacketRead32(p);                /* file listen port, intel */
-}
-
-#ifdef EVENT_DEBUG
-const char *icq_FileRequestEventName(icq_Event *p)
-{
-  if (p->type==ICQ_EVENT_MESSAGE)
-    return "file request";
-  else if (p->type==ICQ_EVENT_ACK) {
-    icq_MessageEvent *pevent=(icq_MessageEvent *)p;
-    if (pevent->status==ICQ_TCP_STATUS_REFUSE)
-      return "file request refuse";
-    else
-      return "file request ack";
-  } else if (p->type==ICQ_EVENT_CANCEL) 
-    return "file request cancel";
-
-  return "unknown file request";
-}
-
-const char *icq_FileRequestEventDump(icq_Event *p)
-{
-  static char buf[255];
-  static char buf2[255];
-  icq_FileRequestEvent *pevent=(icq_FileRequestEvent *)p;
-
-  strcpy(buf, icq_MessageEventDump(p));
-  sprintf(buf2, ", port=%d, filename=\"%s\", filesize=%ld", pevent->port,
-    pevent->filename, pevent->filesize);
-  strcat(buf, buf2);
-
-  return buf;
-}
-#endif
-
-/* main packet parser */
-
-icq_Event *icq_ParsePacket(icq_Packet *p)
-{
-  /* FIXME */
-  icq_Event *pevent=(icq_Event *)malloc(sizeof(icq_FileRequestEvent));
-  pevent->direction=ICQ_EVENT_INCOMING;
-  pevent->time=time(0);
-
-  icq_EventParsePacket(pevent, p);
-
-  switch(pevent->type) {
-
-    case ICQ_TCP_MSG_MSG:
-      icq_MessageParsePacket(pevent, p);
-      break;
-    case ICQ_TCP_MSG_URL:
-      icq_URLParsePacket(pevent, p);
-      break;
-    case ICQ_TCP_MSG_CHAT:
-      icq_ChatParsePacket(pevent, p);
-      break;
-    case ICQ_TCP_MSG_FILE:
-      icq_FileParsePacket(pevent, p);
-      break;
-    default:
-      /* FIXME: log */
-      free(pevent);
-      pevent=0;
-      break;
-  }
-
-  /* FIXME: ensure no bytes are remaining */
-
-  return pevent;
-}
-
-#ifdef EVENT_DEBUG
-const char *icq_EventDump(icq_Event *pevent)
-{
-  static char buf[255];
-
-  sprintf("%s event sent to uin %ld { %s }", (pevent->eventName)(pevent),
-    pevent->uin, (pevent->eventDump)(pevent) );
-
-  return buf;
-}
-#endif
--- a/src/protocols/icq/icqevent.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,151 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqevent.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQEVENT_H
-#define _ICQEVENT_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-
-#include "icqpacket.h"
-#include "tcplink.h"
-#include "stdpackets.h"
-
-#define EVENT_DEBUG
-
-#define ICQ_EVENT_MESSAGE                ICQ_TCP_MESSAGE
-#define ICQ_EVENT_ACK                    ICQ_TCP_ACK
-#define ICQ_EVENT_CANCEL                 ICQ_TCP_CANCEL
-
-#define ICQ_EVENT_INCOMING               1
-#define ICQ_EVENT_OUTGOING               2
-
-typedef struct icq_Event_s {
-
-  unsigned long version;
-  unsigned long id;
-  unsigned long uin;
-
-  int type;         /* chat, file, message, url */
-  int subtype;      /* message, ack, or cancel */
-
-  int direction;  
-  time_t time;
-
-  icq_Packet *(*createPacket)(struct icq_Event_s *, icq_TCPLink *);
-  void *(*parsePacket)(struct icq_Event_s *, icq_Packet *);
-  void (*handleEvent)(struct icq_Event_s *, icq_Link *);
-
-#ifdef EVENT_DEBUG
-  const char *(*eventName)(struct icq_Event_s *);
-  const char *(*eventDump)(struct icq_Event_s *);
-#endif
-
-} icq_Event;
-
-typedef struct icq_MessageEvent_s {
-
-  icq_Event event;
-
-  char *message;  /* must be non-const for url hack */
-  char *url;      /* hack so we can use same structure for url */
-  int status;
-  int type;
-
-} icq_MessageEvent;
-
-typedef struct icq_MessageEvent_s icq_URLEvent;
-
-typedef struct icq_ChatRequestEvent_s {
-
-  icq_MessageEvent message_event;
-
-  int port;
-
-} icq_ChatRequestEvent;
-
-typedef struct icq_FileRequestEvent_s {
-
-  icq_MessageEvent message_event;
-
-  const char *filename;
-  unsigned long filesize;
-  int port;
-
-} icq_FileRequestEvent;
-
-/* generic event functions */
-void icq_EventInit(icq_Event *p, int type, int subtype, unsigned long uin,
-  int version);
-icq_Packet *icq_EventCreatePacket(icq_Event *pbase);
-void icq_EventParsePacket(icq_Event *pevent, icq_Packet *p);
-
-/* message event functions */
-icq_MessageEvent *icq_CreateMessageEvent(int subtype, unsigned long uin, 
-  const char *message);
-void icq_MessageEventInit(icq_MessageEvent *p, int type, int subtype, 
-  unsigned long uin, int msgtype, const char *message);
-icq_Packet *icq_MessageCreatePacket(icq_Event *pbase, icq_TCPLink *plink);
-void icq_MessageParsePacket(icq_Event *pbase, icq_Packet *p);
-
-/* url event functions */
-icq_URLEvent *icq_CreateURLEvent(int subtype, unsigned long uin, 
-  const char *message, const char *url);
-icq_Packet *icq_URLCreatePacket(icq_Event *pbase, icq_TCPLink *plink);
-void icq_URLParsePacket(icq_Event *pbase, icq_Packet *p);
-
-/* chat request event functions */
-icq_ChatRequestEvent *icq_ChatRequestEventNew(int subtype, 
-  unsigned long uin, const char *message, int port);
-icq_Packet *icq_ChatRequestCreatePacket(icq_Event *pbase,
-  icq_TCPLink *plink);
-void icq_ChatParsePacket(icq_Event *pbase, icq_Packet *p);
-
-/* file request event functions */
-icq_FileRequestEvent *icq_FileRequestEventNew(int subtype,
-  unsigned long uin, const char *message, const char *filename,
-  unsigned long filesize);
-icq_Packet *icq_FileRequestCreatePacket(icq_Event *pbase,
-  icq_TCPLink *plink);
-void icq_FileParsePacket(icq_Event *pbase, icq_Packet *p);
-
-/* main packet parser */
-icq_Event *icq_ParsePacket(icq_Packet *p);
-
-#ifdef EVENT_DEBUG
-const char *icq_MessageEventName(icq_Event *p);
-const char *icq_MessageEventDump(icq_Event *p);
-const char *icq_URLEventName(icq_Event *p);
-const char *icq_URLEventDump(icq_Event *p);
-const char *icq_ChatRequestEventName(icq_Event *p);
-const char *icq_ChatRequestEventDump(icq_Event *p);
-const char *icq_FileRequestEventName(icq_Event *p);
-const char *icq_FileRequestEventDump(icq_Event *p);
-const char *icq_EventDump(icq_Event *p);
-#endif
-
-#endif /* _ICQEVENT_H */
--- a/src/protocols/icq/icqlib.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,529 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqlib.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include "icqlib.h"
-
-#include <stdlib.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#else
-#include <netdb.h>
-#include <sys/socket.h>
-#endif
-
-#include <sys/stat.h>
-
-#include "util.h"
-#include "icq.h"
-#include "udp.h"
-#include "tcp.h"
-#include "queue.h"
-#include "socketmanager.h"
-#include "contacts.h"
-
-int icq_Russian = FALSE;
-BYTE icq_LogLevel = 0;
-
-DWORD icq_SendMessage(icq_Link *icqlink, DWORD uin, const char *text, 
-  BYTE thruSrv)
-{
-  if(thruSrv==ICQ_SEND_THRUSERVER)
-    return icq_UDPSendMessage(icqlink, uin, text);
-  else if(thruSrv==ICQ_SEND_DIRECT)
-    return icq_TCPSendMessage(icqlink, uin, text);
-  else if(thruSrv==ICQ_SEND_BESTWAY)
-  {
-    icq_ContactItem *pcontact=icq_ContactFind(icqlink, uin);
-    if(pcontact)
-    {
-      if(pcontact->tcp_flag == 0x04)
-        return icq_TCPSendMessage(icqlink, uin, text);
-      else
-        return icq_UDPSendMessage(icqlink, uin, text);
-    }
-    else
-    {
-      return icq_UDPSendMessage(icqlink, uin, text);
-    }
-  }
-  return 0;
-}
-
-DWORD icq_SendURL(icq_Link *icqlink, DWORD uin, const char *url, 
-  const char *descr, BYTE thruSrv)
-{
-  if(thruSrv==ICQ_SEND_THRUSERVER)
-    return icq_UDPSendURL(icqlink, uin, url, descr);
-  else if(thruSrv==ICQ_SEND_DIRECT)
-    return icq_TCPSendURL(icqlink, uin, descr, url);
-  else if(thruSrv==ICQ_SEND_BESTWAY)
-  {
-    icq_ContactItem *pcontact=icq_ContactFind(icqlink, uin);
-    if(pcontact)
-    {
-      if(pcontact->tcp_flag == 0x04)
-        return icq_TCPSendURL(icqlink, uin, descr, url);
-      else
-        return icq_UDPSendURL(icqlink, uin, url, descr);
-    }
-    else
-    {
-      return icq_UDPSendURL(icqlink, uin, url, descr);
-    }
-  }
-  return 0;
-}
-
-static int icqlib_initialized = 0;
-
-void icq_LibInit()
-{
-  srand(time(0L));
-
-  /* initialize internal lists, if necessary */
-  if (!icq_SocketList)
-    icq_SocketList = icq_ListNew();
-
-  if (!icq_TimeoutList)
-  {
-    icq_TimeoutList = icq_ListNew();
-    icq_TimeoutList->compare_function =
-      (icq_ListCompareFunc)icq_TimeoutCompare;
-  }
-
-  icqlib_initialized = 1;
-}
-
-icq_Link *icq_LinkNew(DWORD uin, const char *password, const char *nick,
-                        unsigned char useTCP)
-{
-  icq_Link *icqlink = (icq_Link *)malloc(sizeof(icq_Link));
-
-  icq_LinkInit(icqlink, uin, password, nick, useTCP);
-
-  return icqlink;
-}
-
-void icq_LinkInit(icq_Link *icqlink, DWORD uin, const char *password, 
-  const char *nick, unsigned char useTCP)
-{
-  icqlink->d = (icq_LinkPrivate *)malloc(sizeof(icq_LinkPrivate));
-
-  if (!icqlib_initialized)
-    icq_LibInit();
-
-  /* Initialize all callbacks */
-  icqlink->icq_Logged = 0L;
-  icqlink->icq_Disconnected = 0L;
-  icqlink->icq_RecvMessage = 0L;
-  icqlink->icq_RecvURL = 0L;
-  icqlink->icq_RecvContactList = 0L;
-  icqlink->icq_RecvWebPager = 0L;
-  icqlink->icq_RecvMailExpress = 0L;
-  icqlink->icq_RecvChatReq = 0L;
-  icqlink->icq_RecvFileReq = 0L;
-  icqlink->icq_RecvAdded = 0L;
-  icqlink->icq_RecvAuthReq = 0L;
-  icqlink->icq_UserFound = 0L;
-  icqlink->icq_SearchDone = 0L;
-  icqlink->icq_UpdateSuccess = 0L;
-  icqlink->icq_UpdateFailure = 0L;
-  icqlink->icq_UserOnline = 0L;
-  icqlink->icq_UserOffline = 0L;
-  icqlink->icq_UserStatusUpdate = 0L;
-  icqlink->icq_InfoReply = 0L;
-  icqlink->icq_ExtInfoReply = 0L;
-  icqlink->icq_WrongPassword = 0L;
-  icqlink->icq_InvalidUIN = 0L;
-  icqlink->icq_Log = 0L;
-  icqlink->icq_SrvAck = 0L;
-  icqlink->icq_RequestNotify = 0L;
-  icqlink->icq_NewUIN = 0L;
-  icqlink->icq_MetaUserFound = 0L;
-  icqlink->icq_MetaUserInfo = 0L;
-  icqlink->icq_MetaUserWork = 0L;
-  icqlink->icq_MetaUserMore = 0L;
-  icqlink->icq_MetaUserAbout = 0L;
-  icqlink->icq_MetaUserInterests = 0L;
-  icqlink->icq_MetaUserAffiliations = 0L;
-  icqlink->icq_MetaUserHomePageCategory = 0L;
-
-  /* General stuff */
-  icqlink->icq_Uin = uin;
-  icqlink->icq_Password = strdup(password);
-  icqlink->icq_Nick = strdup(nick);
-  icqlink->icq_OurIP = -1;
-  icqlink->icq_OurPort = 0;
-  icqlink->d->icq_ContactList = icq_ListNew();
-  icqlink->icq_Status = -1;
-  icqlink->icq_UserData = 0L;
-
-  /* UDP stuff */
-  icqlink->icq_UDPSok = -1;
-  memset(icqlink->d->icq_UDPServMess, FALSE, 
-    sizeof(icqlink->d->icq_UDPServMess));
-  icqlink->d->icq_UDPSeqNum1 = 0;
-  icqlink->d->icq_UDPSeqNum2 = 0;
-  icqlink->d->icq_UDPSession = 0;
-  icq_UDPQueueNew(icqlink);
-
-  /* TCP stuff */
-  icqlink->icq_UseTCP = useTCP;
-  if (useTCP)
-    icq_TCPInit(icqlink);
-
-  /* Proxy stuff */
-  icqlink->icq_UseProxy = 0;
-  icqlink->icq_ProxyHost = 0L;
-  icqlink->icq_ProxyIP = -1;
-  icqlink->icq_ProxyPort = 0;
-  icqlink->icq_ProxyAuth = 0;
-  icqlink->icq_ProxyName = 0L;
-  icqlink->icq_ProxyPass = 0L;
-  icqlink->icq_ProxySok = -1;
-  icqlink->icq_ProxyOurPort = 0;
-  icqlink->icq_ProxyDestIP = -1;
-  icqlink->icq_ProxyDestPort = 0;
-}
-
-void icq_LinkDestroy(icq_Link *icqlink)
-{
-  if(icqlink->icq_UseTCP)
-    icq_TCPDone(icqlink);
-  if(icqlink->icq_Password)
-    free(icqlink->icq_Password);
-  if(icqlink->icq_Nick)
-    free(icqlink->icq_Nick);
-  if(icqlink->d->icq_ContactList)
-    icq_ListDelete(icqlink->d->icq_ContactList, icq_ContactDelete);
-  icq_UDPQueueDelete(icqlink);
-  free(icqlink->d);
-}
-
-void icq_LinkDelete(icq_Link *icqlink)
-{
-  icq_LinkDestroy(icqlink);
-  free(icqlink);
-}
-
-/******************************
-Main function connects gets icq_Uin
-and icq_Password and logins in and sits
-in a loop waiting for server responses.
-*******************************/
-void icq_Main()
-{
-  icq_SocketPoll();
-}
-
-/**********************************
-Connects to hostname on port port
-hostname can be DNS or nnn.nnn.nnn.nnn
-write out messages to the FD aux
-***********************************/
-int icq_Connect(icq_Link *icqlink, const char *hostname, int port)
-{
-  char buf[1024]; /*, un = 1;*/
-/*  char tmpbuf[256], our_host[256]*/
-  int conct, res;
-  unsigned int length;
-  struct sockaddr_in saddr, prsin;  /* used to store inet addr stuff */
-  struct hostent *host_struct; /* used in DNS llokup */
-
-  /* create the unconnected socket*/
-  icqlink->icq_UDPSok = icq_SocketNew(AF_INET, SOCK_DGRAM, 0);
-
-  if(icqlink->icq_UDPSok == -1)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_FATAL, "Socket creation failed\n");
-    return -1;
-  }
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Socket created attempting to connect\n");
-  saddr.sin_addr.s_addr = INADDR_ANY;
-  saddr.sin_family = AF_INET; /* we're using the inet not appletalk*/
-  saddr.sin_port = 0;
-  if(bind(icqlink->icq_UDPSok, (struct sockaddr*)&saddr, sizeof(struct sockaddr))<0)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_FATAL, "Can't bind socket to free port\n");
-    icq_SocketDelete(icqlink->icq_UDPSok);
-    icqlink->icq_UDPSok = -1;
-    return -1;
-  }
-  length = sizeof(saddr);
-  getsockname(icqlink->icq_UDPSok, (struct sockaddr*)&saddr, &length);
-  icqlink->icq_ProxyOurPort = ntohs(saddr.sin_port);
-  if(icqlink->icq_UseProxy)
-  {
-    int hasName = icqlink->icq_ProxyName && strlen(icqlink->icq_ProxyName);
-    int hasPass = icqlink->icq_ProxyPass && strlen(icqlink->icq_ProxyPass);
-    int authEnabled = icqlink->icq_ProxyAuth && hasName && hasPass;
-
-    icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "[SOCKS] Trying to use SOCKS5 proxy\n");
-    prsin.sin_addr.s_addr = inet_addr(icqlink->icq_ProxyHost);
-    if(prsin.sin_addr.s_addr  == (unsigned long)-1) /* name isn't n.n.n.n so must be DNS */
-    {
-      host_struct = gethostbyname(icqlink->icq_ProxyHost);
-      if(host_struct == 0L)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Can't find hostname: %s\n", icqlink->icq_ProxyHost);
-        return -1;
-      }
-      prsin.sin_addr = *((struct in_addr*)host_struct->h_addr);
-    }
-    icqlink->icq_ProxyIP = ntohl(prsin.sin_addr.s_addr);
-    prsin.sin_family = AF_INET; /* we're using the inet not appletalk*/
-    prsin.sin_port = htons(icqlink->icq_ProxyPort); /* port */
-
-    /* create the unconnected socket*/
-    icqlink->icq_ProxySok = icq_SocketNew(AF_INET, SOCK_STREAM, 0);
-
-    if(icqlink->icq_ProxySok == -1)
-    {
-      icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Socket creation failed\n");
-      return -1;
-    }
-    icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "[SOCKS] Socket created attempting to connect\n");
-    conct = connect(icqlink->icq_ProxySok, (struct sockaddr *) &prsin, sizeof(prsin));
-    if(conct == -1) /* did we connect ?*/
-    {
-      icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection refused\n");
-      return -1;
-    }
-    buf[0] = 5; /* protocol version */
-    buf[1] = 1; /* number of methods */
-    buf[2] = authEnabled ? 2 : 0; /* authentication method */
-
-#ifdef _WIN32
-    send(icqlink->icq_ProxySok, buf, 3, 0);
-    res = recv(icqlink->icq_ProxySok, buf, 2, 0);
-#else
-    write(icqlink->icq_ProxySok, buf, 3);
-    res = read(icqlink->icq_ProxySok, buf, 2);
-#endif
-
-    if(authEnabled)
-    {
-      if(res != 2 || buf[0] != 5 || buf[1] != 2) /* username/password authentication*/
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Authentication method incorrect\n");
-        icq_SocketDelete(icqlink->icq_ProxySok);
-        return -1;
-      }
-      buf[0] = 1; /* version of subnegotiation */
-      buf[1] = strlen(icqlink->icq_ProxyName);
-      memcpy(&buf[2], icqlink->icq_ProxyName, buf[1]);
-      buf[2+buf[1]] = strlen(icqlink->icq_ProxyPass);
-      memcpy(&buf[3+buf[1]], icqlink->icq_ProxyPass, buf[2+buf[1]]);
-#ifdef _WIN32
-      send(icqlink->icq_ProxySok, buf, buf[1]+buf[2+buf[1]]+3, 0);
-      res = recv(icqlink->icq_ProxySok, buf, 2, 0);
-#else
-      write(icqlink->icq_ProxySok, buf, buf[1]+buf[2+buf[1]]+3);
-      res = read(icqlink->icq_ProxySok, buf, 2);
-#endif
-      if(res != 2 || buf[0] != 1 || buf[1] != 0)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Authorization failure\n");
-        icq_SocketDelete(icqlink->icq_ProxySok);
-        return -1;
-      }
-    }
-    else
-    {
-      if(res != 2 || buf[0] != 5 || buf[1] != 0) /* no authentication required */
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Authentication method incorrect\n");
-        icq_SocketDelete(icqlink->icq_ProxySok);
-        return -1;
-      }
-    }
-    buf[0] = 5; /* protocol version */
-    buf[1] = 3; /* command UDP associate */
-    buf[2] = 0; /* reserved */
-    buf[3] = 1; /* address type IP v4 */
-    buf[4] = (char)0;
-    buf[5] = (char)0;
-    buf[6] = (char)0;
-    buf[7] = (char)0;
-    *(unsigned short*)&buf[8] = htons(icqlink->icq_ProxyOurPort);
-/*     memcpy(&buf[8], &icqlink->icq_ProxyOurPort, 2); */
-#ifdef _WIN32
-    send(icqlink->icq_ProxySok, buf, 10, 0);
-    res = recv(icqlink->icq_ProxySok, buf, 10, 0);
-#else
-    write(icqlink->icq_ProxySok, buf, 10);
-    res = read(icqlink->icq_ProxySok, buf, 10);
-#endif
-    if(res != 10 || buf[0] != 5 || buf[1] != 0)
-    {
-      switch(buf[1])
-      {
-        case 1:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] General SOCKS server failure\n");
-          break;
-        case 2:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection not allowed by ruleset\n");
-          break;
-        case 3:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Network unreachable\n");
-          break;
-        case 4:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Host unreachable\n");
-          break;
-        case 5:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection refused\n");
-          break;
-        case 6:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] TTL expired\n");
-          break;
-        case 7:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Command not supported\n");
-          break;
-        case 8:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Address type not supported\n");
-          break;
-        default:
-          icq_FmtLog(icqlink, ICQ_LOG_FATAL, "[SOCKS] Unknown SOCKS server failure\n");
-          break;
-      }
-      icq_SocketDelete(icqlink->icq_ProxySok);
-      icqlink->icq_ProxySok = -1;
-      return -1;
-    }
-  }
-  saddr.sin_addr.s_addr = inet_addr(hostname); /* checks for n.n.n.n notation */
-  if(saddr.sin_addr.s_addr == (unsigned long)-1) /* name isn't n.n.n.n so must be DNS */
-  {
-    host_struct = gethostbyname(hostname);
-    if(host_struct == 0L)
-    {
-      icq_FmtLog(icqlink, ICQ_LOG_FATAL, "Can't find hostname: %s\n", hostname);
-      if(icqlink->icq_UseProxy)
-      {
-        icq_SocketDelete(icqlink->icq_ProxySok);
-      }
-      return -1;
-    }
-    saddr.sin_addr = *((struct in_addr *)host_struct->h_addr);
-  }
-  if(icqlink->icq_UseProxy)
-  {
-    icqlink->icq_ProxyDestIP = ntohl(saddr.sin_addr.s_addr);
-    memcpy(&saddr.sin_addr.s_addr, &buf[4], 4);
-  }
-  saddr.sin_family = AF_INET; /* we're using the inet not appletalk*/
-  saddr.sin_port = htons(port); /* port */
-  if(icqlink->icq_UseProxy)
-  {
-    icqlink->icq_ProxyDestPort = port;
-    memcpy(&saddr.sin_port, &buf[8], 2);
-  }
-  conct = connect(icqlink->icq_UDPSok, (struct sockaddr*)&saddr, sizeof(saddr));
-  if(conct == -1) /* did we connect ?*/
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_FATAL, "Connection refused\n");
-    if(icqlink->icq_UseProxy)
-    {
-      icq_SocketDelete(icqlink->icq_ProxySok);
-    }
-    return -1;
-  }
-  length = sizeof(saddr) ;
-  getsockname(icqlink->icq_UDPSok, (struct sockaddr*)&saddr, &length);
-  icqlink->icq_OurIP = ntohl(saddr.sin_addr.s_addr);
-  icqlink->icq_OurPort = ntohs(saddr.sin_port);
-
-  /* sockets are ready to receive data - install handlers */
-  icq_SocketSetHandler(icqlink->icq_UDPSok, ICQ_SOCKET_READ,
-    (icq_SocketHandler)icq_HandleServerResponse, icqlink);
-  if (icqlink->icq_UseProxy)
-    icq_SocketSetHandler(icqlink->icq_ProxySok, ICQ_SOCKET_READ,
-      (icq_SocketHandler)icq_HandleProxyResponse, icqlink);
-  return icqlink->icq_UDPSok;
-}
-
-void icq_Disconnect(icq_Link *icqlink)
-{
-  icq_SocketDelete(icqlink->icq_UDPSok);
-  if(icqlink->icq_UseProxy)
-    icq_SocketDelete(icqlink->icq_ProxySok);
-  icq_UDPQueueFree(icqlink);
-}
-
-/*
-void icq_InitNewUser(const char *hostname, DWORD port)
-{
-  srv_net_icq_pak pak;
-  int s;
-  struct timeval tv;
-  fd_set readfds;
-
-  icq_Connect(hostname, port);
-  if((icq_UDPSok == -1) || (icq_UDPSok == 0))
-  {
-    printf("Couldn't establish connection\n");
-    exit(1);
-  }
-  icq_RegNewUser(icq_Password);
-  for(;;)
-  {
-    tv.tv_sec = 2;
-    tv.tv_usec = 500000;
-
-    FD_ZERO(&readfds);
-    FD_SET(icq_UDPSok, &readfds);
-
-    select(icq_UDPSok+1, &readfds, 0L, 0L, &tv);
-
-    if(FD_ISSET(icq_UDPSok, &readfds))
-    {
-      s = icq_UDPSockRead(icq_UDPSok, &pak.head, sizeof(pak));
-      if(icqtohs(pak.head.cmd) == SRV_NEW_UIN)
-      {
-        icq_Uin = icqtohl(&pak.data[2]);
-        return;
-      }
-    }
-  }
-}
-*/
-
-/************************
-icq_UDPServMess functions
-*************************/
-BOOL icq_GetServMess(icq_Link *icqlink, WORD num)
-{
-  return ((icqlink->d->icq_UDPServMess[num/8] & (1 << (num%8))) >> (num%8));
-}
-
-void icq_SetServMess(icq_Link *icqlink, WORD num)
-{
-  icqlink->d->icq_UDPServMess[num/8] |= (1 << (num%8));
-}
-
-int icq_GetSok(icq_Link *icqlink)
-{
-  return icqlink->icq_UDPSok;
-}
--- a/src/protocols/icq/icqlib.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,91 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqlib.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQLIB_H_
-#define _ICQLIB_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/* for strdup(), bzero() and snprintf() declarations */
-#ifndef __USE_BSD
-#define __USE_BSD 1
-#define __need_bsd_undef 1
-#endif
-#include <string.h>
-#include <stdio.h>
-#ifdef __need_bsd_undef
-#undef __USE_BSD
-#endif
-
-#include "icq.h"
-#include "util.h"
-
-BOOL icq_GetServMess(icq_Link *icqlink, WORD num);
-void icq_SetServMess(icq_Link *icqlink, WORD num);
-void icq_RusConv(const char to[4], char *t_in);
-void icq_RusConv_n(const char to[4], char *t_in, int len);
-
-#ifndef _WIN32
-#ifndef inet_addr
-extern unsigned long inet_addr(const char *cp);
-#endif /* inet_addr */
-#ifndef inet_aton
-extern int inet_aton(const char *cp, struct in_addr *inp);
-#endif /* inet_aton */
-#ifndef inet_ntoa
-extern char *inet_ntoa(struct in_addr in);
-#endif /* inet_ntoa */
-#ifndef strdup
-extern char *strdup(const char *s);
-#endif /* strdup */
-#endif /* _WIN32 */
-
-/** Private ICQLINK data.  These are members that are internal to
- * icqlib, but must be contained in the per-connection ICQLINK
- * struct.
- */
-struct icq_LinkPrivate_s
-{
-  icq_List *icq_ContactList;
-
-  /* 65536 seqs max, 1 bit per seq -> 65536/8 = 8192 */
-  unsigned char icq_UDPServMess[8192]; 
-
-  unsigned short icq_UDPSeqNum1, icq_UDPSeqNum2;
-  unsigned long icq_UDPSession;
-  
-  icq_List *icq_UDPQueue;
-
-  int icq_TCPSequence;
-  icq_List *icq_TCPLinks;
-  icq_List *icq_ChatSessions;
-  icq_List *icq_FileSessions;
-};
-
-#define invoke_callback(plink, callback) \
-   if (plink->callback) (*(plink->callback))
-
-#endif /* _ICQLIB_H_ */
--- a/src/protocols/icq/icqpacket.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,358 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqpacket.c 2487 2001-10-10 19:58:11Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-/*
- * ICQ packet abstraction
- */
-
-#include <stdlib.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#else
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif
-
-#include "icqlib.h"
-#include "tcp.h"
-#include "icqbyteorder.h"
-
-icq_Packet *icq_PacketNew()
-{
-  icq_Packet *p=(icq_Packet*)malloc(sizeof(icq_Packet));
-
-  p->length=0;
-  p->cursor=0;
-  p->id=0;
-
-  return p;
-}
-
-void icq_PacketDelete(void *p)
-{
-  free(p);
-}
-
-void icq_PacketAppend32(icq_Packet *p, DWORD i)
-{
-  DWORD val=i;
-
-  val = htoicql(val);
-  memcpy((p->data)+(p->cursor),&val,sizeof(DWORD));
-  icq_PacketAdvance(p, sizeof(DWORD));
-}
-
-void icq_PacketAppend32n(icq_Packet *p, DWORD i)
-{
-  DWORD val=i;
-
-  memcpy((p->data)+(p->cursor),&val,sizeof(DWORD));
-  icq_PacketAdvance(p, sizeof(DWORD));
-}
-
-DWORD icq_PacketRead32(icq_Packet *p)
-{
-  DWORD val;
-
-  memcpy(&val,(p->data)+(p->cursor),sizeof(DWORD));
-  val = icqtohl(val);
-  icq_PacketAdvance(p, sizeof(DWORD));
-
-  return val;
-}
-
-DWORD icq_PacketRead32n(icq_Packet *p)
-{
-  DWORD val;
-
-  memcpy(&val,(p->data)+(p->cursor),sizeof(DWORD));
-  icq_PacketAdvance(p, sizeof(DWORD));
-
-  return val;
-}
-
-void icq_PacketAppend16(icq_Packet *p, WORD i)
-{
-  WORD val=i;
-
-  val = htoicqs(val);
-  memcpy((p->data)+(p->cursor),&val,sizeof(WORD));
-  icq_PacketAdvance(p, sizeof(WORD));
-}
-
-void icq_PacketAppend16n(icq_Packet *p, WORD i)
-{
-  WORD val=i;
-
-  memcpy((p->data)+(p->cursor),&val,sizeof(WORD));
-  icq_PacketAdvance(p, sizeof(WORD));
-}
-
-WORD icq_PacketRead16(icq_Packet *p)
-{
-  WORD val;
-
-  memcpy(&val,(p->data)+(p->cursor),sizeof(WORD));
-  val = icqtohs(val);
-  icq_PacketAdvance(p, sizeof(WORD));
-
-  return val;
-}
-
-WORD icq_PacketRead16n(icq_Packet *p)
-{
-  WORD val;
-
-  memcpy(&val,(p->data)+(p->cursor),sizeof(WORD));
-  icq_PacketAdvance(p, sizeof(WORD));
-
-  return val;
-}
-
-void icq_PacketAppend8(icq_Packet *p, BYTE i)
-{
-  BYTE val=i;
-
-  memcpy((p->data)+(p->cursor), &val, sizeof(BYTE));
-  icq_PacketAdvance(p, sizeof(BYTE));
-}
-
-BYTE icq_PacketRead8(icq_Packet *p)
-{
-  BYTE val;
-
-  memcpy(&val, (p->data)+(p->cursor), sizeof(BYTE));
-  icq_PacketAdvance(p, sizeof(BYTE));
-
-  return val;
-}
-
-void icq_PacketAppendString(icq_Packet *p, const char *s)
-{
-  if(s)
-  {
-    int length=strlen(s)+1;
-
-    icq_PacketAppend16(p, length);
-    icq_PacketAppend(p, s, length);
-  }
-  else
-  {
-    icq_PacketAppend16(p, 1);
-    icq_PacketAppend8(p,0);
-  }
-}
-
-const char *icq_PacketReadString(icq_Packet *p)
-{
-  int length=icq_PacketRead16(p);
-
-  return (const char *)icq_PacketRead(p, length);
-}
-
-char *icq_PacketReadStringNew(icq_Packet *p)
-{
-  char *ptr;
-  int length=icq_PacketRead16(p);
-
-  ptr = (char*)malloc(length);
-  if(!ptr)
-    return 0L;
-  strncpy(ptr, icq_PacketRead(p, length), length);
-  return ptr;
-}
-
-void icq_PacketAppendStringFE(icq_Packet *p, const char *s)
-{
-  if(s)
-  {
-    int length=strlen(s);
-    icq_PacketAppend(p, s, length);
-  }
-  icq_PacketAppend8(p, 0xFE);
-}
-
-void icq_PacketAppendString0(icq_Packet *p, const char *s)
-{
-  if(s)
-  {
-    int length=strlen(s);
-    icq_PacketAppend(p, s, length);
-  }
-  icq_PacketAppend8(p, 0);
-}
-
-WORD icq_PacketReadUDPOutVer(icq_Packet *p)
-{
-  icq_PacketGoto(p, 0);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPOutCmd(icq_Packet *p)
-{
-  icq_PacketGoto(p, 14 /*2*/);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPOutSeq1(icq_Packet *p)
-{
-  icq_PacketGoto(p, 16);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPOutSeq2(icq_Packet *p)
-{
-  icq_PacketGoto(p, 18 /*4*/);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPInVer(icq_Packet *p)
-{
-  icq_PacketGoto(p, 0);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPInCmd(icq_Packet *p)
-{
-  icq_PacketGoto(p, 7);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPInCmdV3(icq_Packet *p)
-{
-  icq_PacketGoto(p, 2);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPInSeq1(icq_Packet *p)
-{
-  icq_PacketGoto(p, 9);
-  return icq_PacketRead16(p);
-}
-
-WORD icq_PacketReadUDPInSeq2(icq_Packet *p)
-{
-  icq_PacketGoto(p, 11);
-  return icq_PacketRead16(p);
-}
-
-DWORD icq_PacketReadUDPInUIN(icq_Packet *p)
-{
-  icq_PacketGoto(p, 13);
-  return icq_PacketRead32(p);
-}
-
-void icq_PacketAppend(icq_Packet *p, const void *data, int length)
-{
-  memcpy((p->data)+(p->cursor), data, length);
-  icq_PacketAdvance(p, length);
-}
-
-const void *icq_PacketRead(icq_Packet *p, int length)
-{
-  const void *data=(p->data)+(p->cursor);
-
-  icq_PacketAdvance(p, length);
-
-  return data;
-}
-
-void icq_PacketShortDump(icq_Packet *p)
-{
-  printf("icq_Packet %lx { id=%d, cursor=%x, length=%d }\n", 
-         (long)p, (int)p->id, p->cursor, p->length);
-}
-
-void icq_PacketDump(icq_Packet *p)
-{
-  icq_PacketShortDump(p);
-  hex_dump((char*)&(p->length), p->length+sizeof(WORD));
-}
-
-void icq_PacketUDPDump(icq_Packet *p)
-{
-  icq_PacketShortDump(p);
-  hex_dump((char*)&(p->data), p->length);
-}
-
-void icq_PacketBegin(icq_Packet *p)
-{
-  p->cursor=0;
-}
-
-void icq_PacketEnd(icq_Packet *p)
-{
-  p->cursor=p->length;
-}
-
-void icq_PacketAdvance(icq_Packet *p, int i)
-{
-  p->cursor+=i;
-
-  if(p->cursor > p->length)
-    p->length=p->cursor;
-
-/* Do nothing, because we don't have ICQLINK here */
-/*   if(p->cursor > ICQ_PACKET_DATA_SIZE) */
-/*     icq_FmtLog(0L, ICQ_LOG_WARNING, "icq_Packet data overflow\n"); */
-}
-
-void icq_PacketGoto(icq_Packet *p, int i)
-{
-  icq_PacketBegin(p);
-  icq_PacketAdvance(p, i);
-}
-
-void icq_PacketGotoUDPOutData(icq_Packet *p, int i)
-{
-  /* Go to data in UDP _client_ packet. */
-  icq_PacketGoto(p, 24+i);
-}
-
-void icq_PacketGotoUDPInData(icq_Packet *p, int i)
-{
-  /* Go to data in UDP _server_ packet. */
-  icq_PacketGoto(p, 21+i);
-}
-
-WORD icq_PacketPos(icq_Packet *p)
-{
-  return p->cursor;
-}
-
-int icq_PacketSend(icq_Packet *p, int socket_fd)
-{
-  int result;
-
-  result=send(socket_fd, (const char*)&(p->length), p->length+sizeof(WORD), 0);
-
-#ifdef TCP_RAW_TRACE
-  printf("%d bytes sent on socket %d, result %d\n", 
-    p->length+1, socket, result);
-  icq_PacketDump(p);
-#endif /* TCP_RAW_TRACE */
-
-  return result;
-}
--- a/src/protocols/icq/icqpacket.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqpacket.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQ_PACKET_H_
-#define _ICQ_PACKET_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "icqtypes.h"
-
-#define ICQ_PACKET_DATA_SIZE   4096
-
-typedef struct icq_Packet_s
-{
-  DWORD id;
-  WORD cursor;
-  WORD length;
-  BYTE data[ICQ_PACKET_DATA_SIZE];
-} icq_Packet;
-
-icq_Packet *icq_PacketNew();
-void icq_PacketDelete(void *);
-
-void icq_PacketAppend(icq_Packet *, const void *, int);
-void icq_PacketAppend32(icq_Packet *, DWORD);
-void icq_PacketAppend32n(icq_Packet *, DWORD);
-void icq_PacketAppend16(icq_Packet *, WORD);
-void icq_PacketAppend16n(icq_Packet *, WORD);
-void icq_PacketAppend8(icq_Packet *, BYTE);
-void icq_PacketAppendString(icq_Packet *, const char *);
-void icq_PacketAppendStringFE(icq_Packet *, const char *);
-void icq_PacketAppendString0(icq_Packet *, const char *);
-
-const void *icq_PacketRead(icq_Packet*, int);
-DWORD icq_PacketRead32(icq_Packet*);
-DWORD icq_PacketRead32n(icq_Packet*);
-WORD icq_PacketRead16(icq_Packet*);
-WORD icq_PacketRead16n(icq_Packet*);
-BYTE icq_PacketRead8(icq_Packet*);
-const char *icq_PacketReadString(icq_Packet*);
-char *icq_PacketReadStringNew(icq_Packet*);
-WORD icq_PacketReadUDPOutVer(icq_Packet*);
-WORD icq_PacketReadUDPOutCmd(icq_Packet*);
-WORD icq_PacketReadUDPOutSeq1(icq_Packet*);
-WORD icq_PacketReadUDPOutSeq2(icq_Packet*);
-WORD icq_PacketReadUDPInVer(icq_Packet*);
-WORD icq_PacketReadUDPInCmd(icq_Packet*);
-WORD icq_PacketReadUDPInCmdV3(icq_Packet*);
-WORD icq_PacketReadUDPInSeq1(icq_Packet*);
-WORD icq_PacketReadUDPInSeq2(icq_Packet*);
-DWORD icq_PacketReadUDPInUIN(icq_Packet*);
-
-void icq_PacketDump(icq_Packet*);
-void icq_PacketUDPDump(icq_Packet*);
-void icq_PacketBegin(icq_Packet*);
-void icq_PacketEnd(icq_Packet*);
-void icq_PacketAdvance(icq_Packet*, int);
-void icq_PacketGoto(icq_Packet*, int);
-void icq_PacketGotoUDPOutData(icq_Packet*, int);
-void icq_PacketGotoUDPInData(icq_Packet*, int);
-WORD icq_PacketPos(icq_Packet*);
-int icq_PacketSend(icq_Packet*, int);
-
-#endif /* _ICQ_PACKET_H_ */
--- a/src/protocols/icq/icqtypes.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,44 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: icqtypes.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQTYPES_H_
-#define _ICQTYPES_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-typedef unsigned long DWORD;
-typedef unsigned short WORD;
-typedef unsigned char BYTE;
-
-#ifndef _WIN32
-typedef unsigned char BOOL;
-#endif
-
-typedef signed long S_DWORD;
-typedef signed short S_WORD;
-typedef signed char S_BYTE;
-
-#endif /* _ICQTYPES_H_ */
--- a/src/protocols/icq/list.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,269 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: list.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-/*
- * linked list functions
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "list.h"
-
-icq_List *icq_ListNew()
-{
-  icq_List *plist=(icq_List *)malloc(sizeof(icq_List));
-
-  plist->head=0;
-  plist->tail=0;
-  plist->count=0;
-
-  return plist;
-}
-
-/* Frees all list nodes and list itself */
-void icq_ListDelete(icq_List *plist, void (*item_free_f)(void *))
-{
-  if (item_free_f)
-    icq_ListFree(plist, item_free_f);
-  free(plist);
-}
-
-/* Only frees the list nodes */
-void icq_ListFree(icq_List *plist, void (*item_free_f)(void *))
-{
-  icq_ListNode *p=plist->head;
-
-#ifdef LIST_TRACE
-  printf("icq_ListFree(%p)\n", plist);
-  icq_ListDump(plist);
-#endif
-
-  while(p)
-  {
-    icq_ListNode *ptemp=p;
-
-    p=p->next;
-    (*item_free_f)((void *)ptemp->item);
-    icq_ListRemoveNode(plist, ptemp);
-  }
-}
-
-void icq_ListInsertSorted(icq_List *plist, void *pitem)
-{
-  icq_ListNode *i=plist->head;
-  int done = 0;
-
-  while (i && !done)
-  {
-    if ((*plist->compare_function)(pitem, i->item)<0)
-      done = 1;
-    else
-      i=i->next;
-  }
-
-  icq_ListInsert(plist, i, pitem);
-}
-
-void icq_ListInsert(icq_List *plist, icq_ListNode *pnode, void *pitem)
-{
-  icq_ListNode *pnew=(icq_ListNode *)malloc(sizeof(icq_ListNode));
-  pnew->item=pitem;
-
-#ifdef LIST_TRACE
-  printf("inserting %x (node=%x) into list %x\n", pitem, pnew, plist);
-#endif
- 
-  plist->count++;
-
-  /* null source node signifies insert at end of icq_List */
-  if(!pnode) 
-  {
-    pnew->previous=plist->tail;
-    pnew->next=0;
-    if(plist->tail)
-      plist->tail->next=pnew;
-    plist->tail=pnew;
-
-    if(!plist->head)
-      plist->head=pnew;
-  }
-  else
-  {
-    pnew->previous=pnode->previous;
-    pnew->next=pnode;
-
-    if(pnew->previous)
-      pnew->previous->next=pnew;
-
-    if(pnew->next)
-      pnode->previous=pnew;
-        
-    if(plist->head==pnode)
-      plist->head=pnew;
-  }
-
-#ifdef LIST_TRACE
-  icq_ListDump(plist);
-#endif
-}
-
-void *icq_ListRemoveNode(icq_List *plist, icq_ListNode *p)
-{
-  void *pitem;
-
-  if(!p)
-    return 0;
-
-#ifdef LIST_TRACE
-  printf("removing %x (node=%x) from list %x\n", p->item, p, plist);
-#endif
-
-  plist->count--;
-
-  if(p->next)
-    p->next->previous=p->previous;
-
-  if(p->previous)
-    p->previous->next=p->next;
-
-  if(plist->head==p)
-    plist->head=p->next;
-
-  if(plist->tail==p)
-    plist->tail=p->previous;
-
-  p->next=0;
-  p->previous=0;
-
-#ifdef LIST_TRACE
-  icq_ListDump(plist);
-#endif
-
-  pitem=p->item;
-
-  free(p);
-
-  return pitem;
-}
-
-void *icq_ListTraverse(icq_List *plist, int (*item_f)(void *, va_list), ...)
-{
-  icq_ListNode *i=plist->head;
-  int f=0;
-  va_list ap;
-
-#ifdef LIST_TRACE
-  printf("icq_ListTraverse(%p)\n", plist);
-  icq_ListDump(plist);
-#endif
-  va_start(ap, item_f);
-
-  /* call item_f for each item in list until end of list or item 
-   * function returns 0 */
-  while(i && !f)
-  {
-    icq_ListNode *pnext=i->next;
-
-    if(!(f=(*item_f)(i->item, ap)))
-      i=pnext;
-  }
-
-  va_end(ap);
-
-  if (i)
-    return i->item;
-  else
-    return 0;
-}
-
-int icq_ListDump(icq_List *plist)
-{
-  icq_ListNode *p=plist->head;
-
-  printf("list %lx { head=%lx, tail=%lx, count=%d }\ncontents: ",
-         (long)plist, (long)plist->head, (long)plist->tail, plist->count);
-
-  while(p)
-  {
-    printf("%lx, ", (long)p->item);
-    p=p->next;
-  }
-  printf("end\n");
-
-  return 0;
-}
-
-void *icq_ListFirst(icq_List *plist)
-{
-  if(plist->head)
-    return plist->head->item;
-  else
-    return 0;
-}
-
-void *icq_ListLast(icq_List *plist)
-{
-  if(plist->tail)
-    return plist->tail->item;
-  else
-    return 0;
-}
-
-void *icq_ListAt(icq_List *plist, int num)
-{
-  icq_ListNode *ptr = plist->head;
-  while(ptr && num)
-  {
-    num--;
-    ptr = ptr->next;
-  }
-  if(!num)
-    return ptr->item;
-  else
-    return 0L;
-}
-
-icq_ListNode *icq_ListFind(icq_List *plist, void *pitem)
-{
-  icq_ListNode *p=plist->head;
-
-  while(p)
-  {
-    if(p->item==pitem)
-      return p;
-    p=p->next;
-  }
-  return 0;
-}
-
-void *icq_ListRemove(icq_List *plist, void *pitem)
-{
-  icq_ListNode *p=icq_ListFind(plist, pitem);
-
-  if(p)
-    return icq_ListRemoveNode(plist, p);
-  else
-    return 0;
-}
--- a/src/protocols/icq/list.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,73 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: list.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _LIST_H
-#define _LIST_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdarg.h>
-
-#define icq_ListEnqueue(plist, p) \
-   icq_ListInsert(plist, 0, p)
-
-#define icq_ListDequeue(plist) \
-  icq_ListRemoveNode(plist, plist->head)
-
-typedef struct icq_ListNode_s icq_ListNode;
-typedef struct icq_List_s icq_List;
-typedef int (*icq_ListCompareFunc)(void *o1, void *o2);
-
-struct icq_ListNode_s
-{
-  icq_ListNode *next;
-  icq_ListNode *previous;
-  void *item;
-};
-
-struct icq_List_s
-{
-  icq_ListNode *head;
-  icq_ListNode *tail;
-  int count;
-  icq_ListCompareFunc compare_function;
-};
-
-icq_List *icq_ListNew(void);
-void icq_ListDelete(icq_List *plist, void (*item_free_f)(void *));
-void icq_ListFree(icq_List *plist, void (*item_free_f)(void *));
-void icq_ListInsertSorted(icq_List *plist, void *pitem);
-void icq_ListInsert(icq_List *plist, icq_ListNode *pnode, void *pitem);
-void *icq_ListRemove(icq_List *plist, void *pitem);
-void *icq_ListTraverse(icq_List *plist, int (*item_f)(void *, va_list), ...);
-int icq_ListDump(icq_List *plist);
-void *icq_ListFirst(icq_List *plist);
-void *icq_ListLast(icq_List *plist);
-void *icq_ListAt(icq_List *plist, int num);
-icq_ListNode *icq_ListFind(icq_List *plist, void *pitem);
-void *icq_ListRemoveNode(icq_List *plist, icq_ListNode *p);
-
-#endif /* _LIST_H */
--- a/src/protocols/icq/proxy.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,111 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: proxy.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifdef _WIN32
-#include <winsock.h>
-#endif
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-
-void icq_HandleProxyResponse(icq_Link *icqlink)
-{
-  int s;
-  char buf[256];
-#ifdef _WIN32
-  s = recv(icqlink->icq_ProxySok, buf, sizeof(buf), 0);
-#else
-  s = read(icqlink->icq_ProxySok, &buf, sizeof(buf));
-#endif
-  if(s<=0)
-  {
-    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(icq_Link *icqlink, const char *phost, unsigned short pport, 
-  int pauth, const char *pname, const char *ppass)
-{
-  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(!phost)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_ERROR, "[SOCKS] Proxy host is empty\n");
-    icqlink->icq_UseProxy = 0;
-    return;
-  }
-  if(!pname)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_ERROR, "[SOCKS] User name is empty\n");
-    icqlink->icq_UseProxy = 0;
-    return;
-  }
-  if(!pname)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_ERROR, "[SOCKS] User password is empty\n");
-    icqlink->icq_UseProxy = 0;
-    return;
-  }
-
-  if(strlen(pname)>255)
-  {
-    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(icqlink, ICQ_LOG_ERROR, "[SOCKS] User password greater than 255 chars\n");
-    icqlink->icq_UseProxy = 0;
-    return;
-  }
-
-  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(icq_Link *icqlink)
-{
-  icqlink->icq_UseProxy = 0;
-}
-
-int icq_GetProxySok(icq_Link *icqlink)
-{
-  return icqlink->icq_ProxySok;
-}
--- a/src/protocols/icq/queue.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,134 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: queue.c 2509 2001-10-13 00:06:18Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-#include "queue.h"
-#include "udp.h"
-
-void icq_UDPQueueNew(icq_Link *icqlink)
-{
-  icqlink->d->icq_UDPQueue = icq_ListNew();
-  icqlink->icq_UDPExpireInterval = 15; /* expire interval = 15 sec */
-}
-
-void icq_UDPQueuePut(icq_Link *icqlink, icq_Packet *p)
-{
-  icq_UDPQueueItem *ptr = (icq_UDPQueueItem*)malloc(sizeof(icq_UDPQueueItem));
-#ifdef QUEUE_DEBUG
-  printf("icq_UDPQueuePut(seq=0x%04X, cmd=0x%04X)\n", icq_PacketReadUDPOutSeq1(p),
-         icq_PacketReadUDPOutCmd(p));
-#endif
-  ptr->attempts = 1;
-  ptr->timeout = icq_TimeoutNew(icqlink->icq_UDPExpireInterval, 
-    (icq_TimeoutHandler)icq_UDPQueueItemResend, ptr);
-  ptr->timeout->single_shot = 0;
-  ptr->pack = p;
-  ptr->icqlink = icqlink;
-#ifdef QUEUE_DEBUG
-  printf("enqueuing queueitem %p\n", ptr);
-#endif
-  icq_ListEnqueue(icqlink->d->icq_UDPQueue, ptr);
-}
-
-void _icq_UDPQueueItemFree(void *p)
-{
-  icq_UDPQueueItem *pitem=(icq_UDPQueueItem *)p;
-
-#ifdef QUEUE_DEBUG
-  printf("_icq_UDPQueueItemFree(%p)\n", p);
-#endif
-
-  if (pitem->pack)
-    icq_PacketDelete(pitem->pack);
-
-  if (pitem->timeout)
-    icq_TimeoutDelete(pitem->timeout);
-
-  free(p);
-}
-
-/* Frees the queue and dispose it */
-void icq_UDPQueueDelete(icq_Link *icqlink)
-{
-#ifdef QUEUE_DEBUG
-  printf("icq_UDPQueueDelete\n");
-#endif
-  if(icqlink->d->icq_UDPQueue)
-  {
-    icq_ListDelete(icqlink->d->icq_UDPQueue, _icq_UDPQueueItemFree);
-    icqlink->d->icq_UDPQueue = 0;
-  }
-}
-
-/* Only frees the queue */
-void icq_UDPQueueFree(icq_Link *icqlink)
-{
-#ifdef QUEUE_DEBUG
-  printf("icq_UDPQueueFree\n");
-#endif
-  if(icqlink->d->icq_UDPQueue)
-    icq_ListFree(icqlink->d->icq_UDPQueue, _icq_UDPQueueItemFree);
-}
-
-int icq_UDPQueueFindSeq(void *p, va_list data)
-{
-  WORD seq=va_arg(data, int);
-  return icq_PacketReadUDPOutSeq1(((icq_UDPQueueItem *)p)->pack) == seq;
-}
-
-void icq_UDPQueueDelSeq(icq_Link *icqlink, WORD seq)
-{
-  icq_UDPQueueItem *ptr;
-#ifdef QUEUE_DEBUG
-  printf("icq_UDPQueueDelSeq(seq=0x%04X", seq);
-#endif
-  ptr = icq_ListTraverse(icqlink->d->icq_UDPQueue, icq_UDPQueueFindSeq, seq);
-  if(ptr)
-  {
-#ifdef QUEUE_DEBUG
-    printf(", cmd=0x%04X",icq_PacketReadUDPOutCmd(ptr->pack));
-#endif
-    icq_ListRemove(icqlink->d->icq_UDPQueue, ptr);
-    _icq_UDPQueueItemFree(ptr);
-  }
-#ifdef QUEUE_DEBUG
-  printf(")\n");
-#endif
-}
-
-void icq_UDPQueueItemResend(icq_UDPQueueItem *p)
-{
-  p->attempts++;
-  if (p->attempts > 6)
-  {
-    icq_Disconnect(p->icqlink);
-    invoke_callback(p->icqlink, icq_Disconnected)(p->icqlink);
-    return;
-  }
-
-  icq_UDPSockWriteDirect(p->icqlink, p->pack);
-}
-
--- a/src/protocols/icq/queue.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,52 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: queue.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _QUEUE_H_
-#define _QUEUE_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "icq.h"
-#include "icqpacket.h"
-#include "timeout.h"
-
-typedef struct icq_UDPQueueItem_s
-{
-  unsigned char attempts;
-  icq_Timeout *timeout;
-  icq_Packet *pack;
-  icq_Link *icqlink;
-} icq_UDPQueueItem;
-
-void icq_UDPQueueNew(icq_Link *);
-void icq_UDPQueueFree(icq_Link *);
-void icq_UDPQueuePut(icq_Link *, icq_Packet*);
-void icq_UDPQueueDelete(icq_Link *);
-void icq_UDPQueueFree(icq_Link *);
-void icq_UDPQueueDelSeq(icq_Link *, WORD);
-void icq_UDPQueueItemResend(icq_UDPQueueItem *pitem);
-
-#endif
--- a/src/protocols/icq/socketmanager.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,246 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: socketmanager.c 2405 2001-09-29 02:08:00Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-/**
- * The icqlib socket manager is a simple socket abstraction layer, which
- * supports opening and closing sockets as well as installing handler
- * functions for read ready and write ready events.  Its purpose is to
- * both unify socket handling in icqlib and expose icqlib's socket
- * requirements so the library client can assist with socket housekeeping.
- *
- * Library clients have two options to support icqlib:
- *
- * 1. Periodically call icq_Main.  This will handle all select logic
- * internally.  Advantage is implementation ease, disadvantage is wasted 
- * CPU cycles because of polling and poor TCP file transfer performance.
- * 
- * 2. Install a icq_SocketNotify callback, perform your own socket
- * management, and notify icqlib using the icq_SocketReady method when
- * a socket is ready for reading or writing.  Advantage is efficiency,
- * disadvantage is extra code.
- *
- */
-
-#include <stdlib.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#endif
-
-#include "socketmanager.h"
-
-icq_List *icq_SocketList = NULL;
-fd_set icq_FdSets[ICQ_SOCKET_MAX];
-int icq_MaxSocket;
-
-void (*icq_SocketNotify)(int socket_fd, int type, int status);
-
-/**
- * Creates a new socket using the operating system's socket creation
- * facility.
- */
-int icq_SocketNew(int domain, int type, int protocol)
-{
-  int s = socket(domain, type, protocol);
-
-  icq_SocketAlloc(s);
-
-  return s;
-}
-
-
-/**
- * Creates a new socket by accepting a connection from a listening
- * socket.
- */
-int icq_SocketAccept(int listens, struct sockaddr *addr, int *addrlen)
-{
-  int s = accept(listens, addr, addrlen);
-
-  icq_SocketAlloc(s);
-
-  return s;
-}
-
-/**
- * Creates a new icq_Socket structure, and appends it to the 
- * socketmanager's global socket list.
- */
-void icq_SocketAlloc(int s)
-{
-  if (s != -1)
-  {
-    icq_Socket *psocket = (icq_Socket *)malloc(sizeof(icq_Socket));
-    int i;
-    psocket->socket = s;
-
-    for (i=0; i<ICQ_SOCKET_MAX; i++)
-      psocket->handlers[i] = NULL;
-
-    icq_ListEnqueue(icq_SocketList, psocket);
-  }
-}  
-
-/**
- * Closes a socket.  This function will notify the library client
- * through the icq_SocketNotify callback if the socket had an installed
- * read or write handler.
- */
-int icq_SocketDelete(int socket_fd)
-{
-#ifdef _WIN32
-  int result = closesocket(socket_fd);
-#else
-  int result = close(socket_fd);
-#endif
-
-  if (result != -1)
-  {
-    icq_Socket *s = icq_FindSocket(socket_fd);
-    int i;
-
-    /* uninstall all handlers - this will take care of notifing library
-     * client */
-    for (i=0; i<ICQ_SOCKET_MAX; i++)
-    {
-      if (s->handlers[i])
-        icq_SocketSetHandler(s->socket, i, NULL, NULL);
-    }
-
-    icq_ListRemove(icq_SocketList, s);
-    free(s);
-  }
-
-  return result;
-}
-
-/**
- * Installs a socket event handler.  The handler will be called when
- * the socket is ready for reading or writing, depending on the type
- * which should be either ICQ_SOCKET_READ or ICQ_SOCKET_WRITE.  In 
- * addition, user data can be passed to the callback function through
- * the data member.
- */
-void icq_SocketSetHandler(int socket_fd, int type, icq_SocketHandler handler, 
-  void *data)
-{
-  icq_Socket *s = icq_FindSocket(socket_fd);
-  if (s)
-  {
-    s->data[type] = data;
-    s->handlers[type] = handler;
-    if (icq_SocketNotify)
-      (*icq_SocketNotify)(socket_fd, type, handler ? 1 : 0);
-  }
-}
-
-/**
- * Handles a socket ready event by calling the installed callback 
- * function, if any.
- */
-void icq_SocketReady(icq_Socket *s, int type)
-{
-  if (s && s->handlers[type])
-  {
-    (*s->handlers[type])(s->data[type]);
-  }
-}
-
-void icq_HandleReadySocket(int socket_fd, int type)
-{
-  icq_SocketReady(icq_FindSocket(socket_fd), type);
-}
-  
-int _icq_SocketBuildFdSets(void *p, va_list data)
-{
-  icq_Socket *s = p;
-  int i;
-  (void)data;
-  
-  for (i=0; i<ICQ_SOCKET_MAX; i++)
-    if (s->handlers[i]) {
-      FD_SET(s->socket, &(icq_FdSets[i]));
-      if (s->socket > icq_MaxSocket)
-        icq_MaxSocket = s->socket;
-    }
-
-  return 0; /* traverse entire icq_List */
-}
-
-void icq_SocketBuildFdSets()
-{
-  int i;
-
-  /* clear fdsets */
-  for (i=0; i<ICQ_SOCKET_MAX; i++)
-    FD_ZERO(&(icq_FdSets[i]));
-
-  icq_MaxSocket = 0;
-  
-  /* build fd lists for open sockets */
-  (void)icq_ListTraverse(icq_SocketList, _icq_SocketBuildFdSets);
-}
-
-int _icq_SocketHandleReady(void *p, va_list data)
-{
-  icq_Socket *s = p;
-  int i;
-  (void)data;
-  
-  for (i=0; i<ICQ_SOCKET_MAX; i++)
-    if (FD_ISSET(s->socket, &(icq_FdSets[i]))) {
-      icq_SocketReady(s, i);
-    }
-
-  return 0; /* traverse entire icq_List */
-}
-      
-void icq_SocketPoll()
-{
-  struct timeval tv;
-
-  icq_SocketBuildFdSets();
-  
-  tv.tv_sec = 0; tv.tv_usec = 0;
-    
-  /* determine which sockets require maintenance */
-  select(icq_MaxSocket+1, &(icq_FdSets[ICQ_SOCKET_READ]),
-    &(icq_FdSets[ICQ_SOCKET_WRITE]), NULL, &tv);
-
-  /* handle ready sockets */
-  (void)icq_ListTraverse(icq_SocketList, _icq_SocketHandleReady);
-}
-
-int _icq_FindSocket(void *p, va_list data)
-{
-  int socket_fd = va_arg(data, int);
-  return (((icq_Socket *)p)->socket == socket_fd);
-}
-
-icq_Socket *icq_FindSocket(int socket_fd)
-{
-  return icq_ListTraverse(icq_SocketList, _icq_FindSocket, socket_fd);
-}
-
-
--- a/src/protocols/icq/socketmanager.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: socketmanager.h 8967 2004-02-12 19:54:18Z hermanator $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _SOCKETMANAGER_H
-#define _SOCKETMANAGER_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#ifndef _WIN32
-#include <sys/socket.h>
-#else
-#include "libc_interface.h"
-#endif
-
-#include "icq.h"
-#include "list.h"
-
-typedef struct icq_Socket_s icq_Socket;
-typedef void (*icq_SocketHandler)(void *data);
-
-struct icq_Socket_s
-{
-  int socket;
-
-  icq_SocketHandler handlers[ICQ_SOCKET_MAX];
-  void *data[ICQ_SOCKET_MAX];
-};
-
-int icq_SocketNew(int domain, int type, int protocol);
-int icq_SocketAccept(int listens, struct sockaddr *addr, int *addrlen);
-void icq_SocketAlloc(int socket_fd);
-int icq_SocketDelete(int socket_fd);
-void icq_SocketSetHandler(int socket_fd, int type, icq_SocketHandler handler,
-  void *data);
-void icq_SocketReady(icq_Socket *s, int type);
-void icq_SocketBuildFdSets(void);
-void icq_SocketPoll();
-icq_Socket *icq_FindSocket(int socket_fd);
-
-extern icq_List *icq_SocketList;
-
-#endif /* _SOCKETMANAGER_H */
--- a/src/protocols/icq/stdpackets.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,555 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: stdpackets.c 2400 2001-09-28 23:45:19Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-#include "tcp.h"
-#include "stdpackets.h"
-
-icq_Packet *icq_TCPCreateInitPacket(icq_TCPLink *plink)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    int type=plink->type;
-
-    icq_PacketAppend8(p, 0xFF);
-    icq_PacketAppend32(p, ICQ_TCP_VER);
-    if(type==TCP_LINK_MESSAGE)
-      icq_PacketAppend32n(p, htons(plink->icqlink->icq_TCPSrvPort));
-    else
-      icq_PacketAppend32(p, 0x00000000);
-    icq_PacketAppend32(p, plink->icqlink->icq_Uin);
-    icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-    icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-    icq_PacketAppend8(p, 0x04);
-    if(type==TCP_LINK_FILE || type==TCP_LINK_CHAT)
-      icq_PacketAppend32(p, ntohs(plink->socket_address.sin_port));
-    else
-      icq_PacketAppend32(p, 0x00000000);
-
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateStdPacket(icq_TCPLink *plink, WORD icq_TCPCommand,
-               WORD type, const char *msg, WORD status,
-               WORD msg_command)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend32(p, plink->icqlink->icq_Uin);
-    icq_PacketAppend16(p, ICQ_TCP_VER);
-    icq_PacketAppend16(p, icq_TCPCommand);
-    icq_PacketAppend16(p, 0x0000);
-    icq_PacketAppend32(p, plink->icqlink->icq_Uin);
-
-    icq_PacketAppend16(p, type);
-    icq_PacketAppendString(p, (char*)msg);
-      
-    /* FIXME: this should be the address the server returns to us,
-     * link->icq_OurIp */
-    icq_PacketAppend32(p, plink->socket_address.sin_addr.s_addr); 
-    icq_PacketAppend32(p, plink->socket_address.sin_addr.s_addr);
-    icq_PacketAppend32(p, ntohs(plink->socket_address.sin_port));
-    icq_PacketAppend8(p, 0x04);
-    icq_PacketAppend16(p, status);
-    icq_PacketAppend16(p, msg_command);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateMessagePacket(icq_TCPLink *plink, const char *message)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_MESSAGE,
-    ICQ_TCP_MSG_MSG,
-    message,
-    0, /* status */
-    ICQ_TCP_MSG_REAL);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateAwayReqPacket(icq_TCPLink *plink, WORD statusMode)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_MESSAGE,
-    statusMode,           /* one of the icq_tcp_msg_read... constants */
-    "",
-    0, /* status */
-    0);   
-    
-  return p;
-}
-
-icq_Packet *icq_TCPCreateURLPacket(icq_TCPLink *plink, const char *message,
-   const char *url)
-{
-  icq_Packet *p;
-  unsigned char *str=(unsigned char*)malloc(strlen(message)+strlen(url)+2);
-
-  strcpy((char*)str, message);
-  *(str+strlen(message))=0xFE;
-  strcpy((char*)(str+strlen(message)+1), url);
-
-  p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_MESSAGE,
-    ICQ_TCP_MSG_URL,
-    (const char *)str,
-    0, /* status */
-    ICQ_TCP_MSG_REAL);
-
-  free(str);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateChatReqPacket(icq_TCPLink *plink, const char *message)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_MESSAGE,
-    ICQ_TCP_MSG_CHAT,
-    message,
-    0, /* status */
-    ICQ_TCP_MSG_REAL);
-
-  icq_PacketAppendString(p, 0);
-
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend32(p, 0x00000000);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateChatReqAck(icq_TCPLink *plink, WORD port)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_CHAT,
-    0,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppendString(p, 0);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateChatReqRefuse(icq_TCPLink *plink, WORD port,
-  const char *reason)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_CHAT,
-    reason,
-    ICQ_TCP_STATUS_REFUSE,
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppendString(p, 0);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateChatReqCancel(icq_TCPLink *plink, WORD port)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_CANCEL,
-    ICQ_TCP_MSG_CHAT,
-    0,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppendString(p, 0);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFileReqAck(icq_TCPLink *plink, WORD port)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_FILE,
-    0,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppendString(p, 0);
-  icq_PacketAppend32(p, 0x00000000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFileReqRefuse(icq_TCPLink *plink, WORD port,
-  const char *reason)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_FILE,
-    reason,
-    ICQ_TCP_STATUS_REFUSE,
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppendString(p, 0);
-  icq_PacketAppend32(p, 0x00000000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFileReqCancel(icq_TCPLink *plink, WORD port)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_CANCEL,
-    ICQ_TCP_MSG_FILE,
-    0,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-  icq_PacketAppend16(p, htons(port));
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppendString(p, 0);
-  icq_PacketAppend32(p, 0x00000000);
-  icq_PacketAppend32(p, port);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateChatInfoPacket(icq_TCPLink *plink, const char *name, 
-   DWORD foreground, DWORD background)
-{
-   icq_Packet *p=icq_PacketNew();
-
-   icq_PacketAppend32(p, 0x00000065);
-   icq_PacketAppend32(p, 0xfffffffa);
-   icq_PacketAppend32(p, plink->icqlink->icq_Uin);
-   icq_PacketAppendString(p, name);
-   icq_PacketAppend16(p, plink->socket_address.sin_port);
-   icq_PacketAppend32(p, foreground);
-   icq_PacketAppend32(p, background);
-   icq_PacketAppend8(p, 0x00);
-
-   return p;
-
-}
-
-icq_Packet *icq_TCPCreateChatInfo2Packet(icq_TCPLink *plink, const char *name, 
-   DWORD foreground, DWORD background)
-{
-   icq_Packet *p=icq_PacketNew();
-
-   icq_PacketAppend32(p, 0x00000064);
-   icq_PacketAppend32(p, plink->icqlink->icq_Uin);
-   icq_PacketAppendString(p, name);
-   icq_PacketAppend32(p, foreground);
-   icq_PacketAppend32(p, background);
-
-   icq_PacketAppend32(p, 0x00070004);
-   icq_PacketAppend32(p, 0x00000000);
-   icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-   icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-   icq_PacketAppend8(p, 0x04);
-   icq_PacketAppend16(p, 0x0000);
-   icq_PacketAppend32(p, 0x000a);
-   icq_PacketAppend32(p, 0x0000);
-   icq_PacketAppendString(p, "Courier New");
-   icq_PacketAppend8(p, 204);
-   icq_PacketAppend8(p, 49);
-   icq_PacketAppend8(p, 0x00);
-
-   return p;
-}
-
-icq_Packet *icq_TCPCreateChatFontInfoPacket(icq_TCPLink *plink)
-{
-   icq_Packet *p=icq_PacketNew();
-   
-   icq_PacketAppend32(p, 0x00070004);
-   icq_PacketAppend32(p, 0x00000000);
-   icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-   icq_PacketAppend32n(p, htonl(plink->icqlink->icq_OurIP));
-   icq_PacketAppend8(p, 0x04);
-   icq_PacketAppend16(p, ntohs(plink->socket_address.sin_port)); /* Zero ? */
-   icq_PacketAppend32(p, 0x000a);
-   icq_PacketAppend32(p, 0x0000);
-   icq_PacketAppendString(p, "Courier New");
-   icq_PacketAppend8(p, 204);
-   icq_PacketAppend8(p, 49);
-   icq_PacketAppend8(p, 0x00);
-
-   return p;
-}
-
-
-icq_Packet *icq_TCPCreateFileReqPacket(icq_TCPLink *plink, 
-  const char *message, const char *filename, unsigned long size)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_MESSAGE,
-    ICQ_TCP_MSG_FILE,
-    (const char*)message,
-    0, /* status */
-    ICQ_TCP_MSG_REAL);
-
-  icq_PacketAppend16(p, 0x0000);
-  icq_PacketAppend16(p, 0x0000);
-
-  icq_PacketAppendString(p, filename);
-
-  icq_PacketAppend32(p, size);
-  icq_PacketAppend32(p, 0x00000000);
-
-  return p;
-}
-
-void icq_TCPAppendSequence(icq_Link *icqlink, icq_Packet *p)
-{
-  p->id=icqlink->d->icq_TCPSequence--;
-  icq_PacketEnd(p);
-  icq_PacketAppend32(p, p->id);
-}
-
-void icq_TCPAppendSequenceN(icq_Link *icqlink, icq_Packet *p, DWORD seq)
-{
-  (void)icqlink;
-  p->id=seq;
-  icq_PacketEnd(p);
-  icq_PacketAppend32(p, p->id);
-}
-
-icq_Packet *icq_TCPCreateMessageAck(icq_TCPLink *plink, const char *message)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_MSG,
-    message,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-   return p;
-}
-
-icq_Packet *icq_TCPCreateURLAck(icq_TCPLink *plink, const char *message)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_URL,
-    message,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-   return p;
-}
-
-icq_Packet *icq_TCPCreateContactListAck(icq_TCPLink *plink, const char *message)
-{
-  icq_Packet *p=icq_TCPCreateStdPacket(
-    plink,
-    ICQ_TCP_ACK,
-    ICQ_TCP_MSG_CONTACTLIST,
-    message,
-    0, /* status */
-    ICQ_TCP_MSG_ACK);
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile00Packet(DWORD num_files, DWORD total_bytes,
-  DWORD speed, const char *name)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x00);
-    icq_PacketAppend32(p, 0x00000000);
-    icq_PacketAppend32(p, num_files);
-    icq_PacketAppend32(p, total_bytes);
-    icq_PacketAppend32(p, speed);
-    icq_PacketAppendString(p, name);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile01Packet(DWORD speed, const char *name)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x01);
-    icq_PacketAppend32(p, speed);
-    icq_PacketAppendString(p, name);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile02Packet(const char *filename, DWORD filesize,
-  DWORD speed)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x02);
-    icq_PacketAppend8(p, 0x00);
-    icq_PacketAppendString(p, filename);
-    icq_PacketAppendString(p, 0);
-    icq_PacketAppend32(p, filesize);
-    icq_PacketAppend32(p, 0x00000000);    
-    icq_PacketAppend32(p, speed);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile03Packet(DWORD filesize, DWORD speed)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x03);
-    icq_PacketAppend32(p, filesize);
-    icq_PacketAppend32(p, 0x00000000);
-    icq_PacketAppend32(p, speed);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile04Packet(DWORD filenum)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x04);
-    icq_PacketAppend32(p, filenum);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile05Packet(DWORD speed)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x05);
-    icq_PacketAppend32(p, speed);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_TCPCreateFile06Packet(int length, void *data)
-{
-  icq_Packet *p=icq_PacketNew();
-
-  if(p)
-  {
-    icq_PacketAppend8(p, 0x06);
-    icq_PacketAppend(p, data, length);
-  }
-
-  return p;
-}
-
-icq_Packet *icq_UDPCreateStdPacket(icq_Link *icqlink, WORD cmd)
-{
-  icq_Packet *p = icq_PacketNew();
-
-/*  if(!link->d->icq_UDPSession)
-    link->d->icq_UDPSession = rand() & 0x3FFFFFFF;
-  if(!link->d->icq_UDPSeqNum2)
-    link->d->icq_UDPSeqNum2 = rand() & 0x7FFF;*/
-
-  icq_PacketAppend16(p, ICQ_UDP_VER);                  /* ver */
-  icq_PacketAppend32(p, 0);                            /* zero */
-  icq_PacketAppend32(p, icqlink->icq_Uin);             /* uin */
-  icq_PacketAppend32(p, icqlink->d->icq_UDPSession);   /* session */
-  icq_PacketAppend16(p, cmd);                          /* cmd */
-  icq_PacketAppend16(p, icqlink->d->icq_UDPSeqNum1++); /* seq1 */
-  icq_PacketAppend16(p, icqlink->d->icq_UDPSeqNum2++); /* seq2 */
-  icq_PacketAppend32(p, 0);                            /* checkcode */
-
-  return p;
-}
-
-icq_Packet *icq_UDPCreateStdSeqPacket(icq_Link *icqlink, WORD cmd, WORD seq)
-{
-  icq_Packet *p = icq_PacketNew();
-
-  icq_PacketAppend16(p, ICQ_UDP_VER);                /* ver */
-  icq_PacketAppend32(p, 0);                          /* zero */
-  icq_PacketAppend32(p, icqlink->icq_Uin);           /* uin */
-  icq_PacketAppend32(p, icqlink->d->icq_UDPSession); /* session */
-  icq_PacketAppend16(p, cmd);                        /* cmd */
-  icq_PacketAppend16(p, seq);                        /* seq1 */
-  icq_PacketAppend16(p, 0);                          /* seq2 */
-  icq_PacketAppend32(p, 0);                          /* checkcode */
-
-  return p;
-}
--- a/src/protocols/icq/stdpackets.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,127 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: stdpackets.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQTCPPACKETS_H
-#define _ICQTCPPACKETS_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#define ICQ_UDP_VER            0x0005
-#define ICQ_TCP_VER            0x0003
-
-/* TCP Packet Commands */
-#define ICQ_TCP_HELLO            0xFF
-#define ICQ_TCP_CANCEL           0x07D0
-#define ICQ_TCP_ACK              0x07DA
-#define ICQ_TCP_MESSAGE          0x07EE
-
-/* TCP Message Types */
-#define ICQ_TCP_MSG_MSG          0x0001
-#define ICQ_TCP_MSG_CHAT         0x0002
-#define ICQ_TCP_MSG_FILE         0x0003
-#define ICQ_TCP_MSG_URL          0x0004
-#define ICQ_TCP_MSG_CONTACTLIST  0x0013
-#define ICQ_TCP_MSG_READAWAY     0x03E8
-#define ICQ_TCP_MSG_READOCCUPIED 0x03E9
-#define ICQ_TCP_MSG_READNA       0x03EA
-#define ICQ_TCP_MSG_READDND      0x03EB
-#define ICQ_TCP_MSG_READFFC      0x03EC
-#define ICQ_TCP_MASS_MASK        0x8000
-
-/* TCP Message Command Types */
-#define ICQ_TCP_MSG_ACK          0x0000
-#define ICQ_TCP_MSG_AUTO         0x0000
-#define ICQ_TCP_MSG_REAL         0x0010
-#define ICQ_TCP_MSG_LIST         0x0020
-#define ICQ_TCP_MSG_URGENT       0x0040
-#define ICQ_TCP_MSG_INVISIBLE    0x0090
-#define ICQ_TCP_MSG_UNK_1        0x00A0
-#define ICQ_TCP_MSG_AWAY         0x0110
-#define ICQ_TCP_MSG_OCCUPIED     0x0210
-#define ICQ_TCP_MSG_UNK_2        0x0802
-#define ICQ_TCP_MSG_NA           0x0810
-#define ICQ_TCP_MSG_NA_2         0x0820
-#define ICQ_TCP_MSG_DND          0x1010
-
-/* TCP Message Statuses */
-#define ICQ_TCP_STATUS_ONLINE      0x0000
-#define ICQ_TCP_STATUS_REFUSE      0x0001
-#define ICQ_TCP_STATUS_AWAY        0x0004
-#define ICQ_TCP_STATUS_OCCUPIED    0x0009
-#define ICQ_TCP_STATUS_DND         0x000A
-#define ICQ_TCP_STATUS_NA          0x000E
-#define ICQ_TCP_STATUS_FREE_CHAT   ICQ_TCP_STATUS_ONLINE
-#define ICQ_TCP_STATUS_INVISIBLE   ICQ_TCP_STATUS_ONLINE
-
-#include "tcplink.h"
-
-icq_Packet *icq_TCPCreateInitPacket(icq_TCPLink *plink);
-icq_Packet *icq_TCPCreateStdPacket(icq_TCPLink *plink, WORD icq_TCPCommand,
-               WORD type, const char *msg, WORD status, WORD msg_command);
-icq_Packet *icq_TCPCreateMessagePacket(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateURLPacket(icq_TCPLink *plink, const char *message,
-   const char *url);
-icq_Packet *icq_TCPCreateAwayReqPacket(icq_TCPLink *plink, WORD statusMode);
-icq_Packet *icq_TCPCreateChatReqPacket(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateFileReqPacket(icq_TCPLink *plink, 
-   const char *message, const char *filename, DWORD size);
-void icq_TCPAppendSequence(icq_Link *icqlink, icq_Packet *p);
-void icq_TCPAppendSequenceN(icq_Link *icqlink, icq_Packet *p, DWORD seq);
-
-icq_Packet *icq_TCPCreateMessageAck(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateURLAck(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateContactListAck(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateWebPagerAck(icq_TCPLink *plink, const char *message);
-icq_Packet *icq_TCPCreateChatReqAck(icq_TCPLink *plink, WORD port);
-icq_Packet *icq_TCPCreateChatReqCancel(icq_TCPLink *plink, WORD port);
-icq_Packet *icq_TCPCreateChatReqRefuse(icq_TCPLink *plink, WORD port,
-   const char *reason);
-icq_Packet *icq_TCPCreateFileReqAck(icq_TCPLink *plink, WORD port);
-icq_Packet *icq_TCPCreateFileReqCancel(icq_TCPLink *plink, WORD port);
-icq_Packet *icq_TCPCreateFileReqRefuse(icq_TCPLink *plink, WORD port,
-   const char *reason);
-
-icq_Packet *icq_TCPCreateChatInfoPacket(icq_TCPLink *plink, const char *name, 
-   DWORD foreground, DWORD background);
-icq_Packet *icq_TCPCreateChatInfo2Packet(icq_TCPLink *plink, const char *name,
-   DWORD foreground, DWORD background);
-icq_Packet *icq_TCPCreateChatFontInfoPacket(icq_TCPLink *plink);
-
-icq_Packet *icq_TCPCreateFile00Packet(DWORD num_files, DWORD total_bytes, DWORD speed, const char *name);
-icq_Packet *icq_TCPCreateFile01Packet(DWORD speed, const char *name);
-icq_Packet *icq_TCPCreateFile02Packet(const char *filename, DWORD filesize, DWORD speed);
-icq_Packet *icq_TCPCreateFile03Packet(DWORD filesize, DWORD speed);
-icq_Packet *icq_TCPCreateFile04Packet(DWORD filenum);
-icq_Packet *icq_TCPCreateFile05Packet(DWORD speed);
-icq_Packet *icq_TCPCreateFile06Packet(int length, void *data);
-
-icq_Packet *icq_UDPCreateStdPacket(icq_Link *icqlink, WORD cmd);
-icq_Packet *icq_UDPCreateStdSeqPacket(icq_Link *icqlink, WORD cmd, WORD seq);
-
-#endif /* _ICQTCPPACKETS_H */
-
-/* From `tcppackets.c': */
-
--- a/src/protocols/icq/tcp.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,465 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcp.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-/*
- * Peer-to-peer ICQ protocol implementation
- *
- * Uses version 2 of the ICQ protocol
- *
- * Thanks to Douglas F. McLaughlin and many others for
- * packet details (see tcp02.txt)
- *
- */
-
-#include <stdlib.h>
-
-#include <fcntl.h>
-#include <errno.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#endif
-
-#include <sys/stat.h>
-
-#include "icqlib.h"
-
-#include "tcp.h"
-#include "stdpackets.h"
-#include "chatsession.h"
-#include "filesession.h"
-
-/**
- Initializes structures necessary for TCP use.  Not required by user
- programs.
-
- \return true on error
-*/
- 
-int icq_TCPInit(icq_Link *icqlink)
-{
-  icq_TCPLink *plink;
-
-  /* allocate lists */
-  icqlink->d->icq_TCPLinks=icq_ListNew();
-  icqlink->d->icq_ChatSessions=icq_ListNew();
-  icqlink->d->icq_FileSessions=icq_ListNew();
-
-  /* only the main listening socket gets created upon initialization -
-   * the other two are created when necessary */
-  plink=icq_TCPLinkNew(icqlink);
-  icq_TCPLinkListen(plink);
-  icqlink->icq_TCPSrvPort=ntohs(plink->socket_address.sin_port);
-
-  /* reset tcp sequence number */
-  icqlink->d->icq_TCPSequence=0xfffffffe;
-
-  return 0;
-}
-
-void icq_TCPDone(icq_Link *icqlink)
-{
-  /* close and deallocate all tcp links, this will also close any attached 
-   * file or chat sessions */
-  if (icqlink->d->icq_TCPLinks) {
-    icq_ListDelete(icqlink->d->icq_TCPLinks, icq_TCPLinkDelete);
-    icqlink->d->icq_TCPLinks = 0;
-  }
-  if (icqlink->d->icq_ChatSessions) {
-    icq_ListDelete(icqlink->d->icq_ChatSessions, icq_ChatSessionDelete);
-    icqlink->d->icq_ChatSessions = 0;
-  }
-  if (icqlink->d->icq_FileSessions) {
-    icq_ListDelete(icqlink->d->icq_FileSessions, icq_FileSessionDelete);
-    icqlink->d->icq_FileSessions = 0;
-  }
-}
-
-icq_TCPLink *icq_TCPCheckLink(icq_Link *icqlink, DWORD uin, int type)
-{
-  icq_TCPLink *plink=icq_FindTCPLink(icqlink, uin, type);
-
-  if(!plink)
-  {
-    plink=icq_TCPLinkNew(icqlink);
-    if(type==TCP_LINK_MESSAGE)
-      icq_TCPLinkConnect(plink, uin, 0);
-  }
-
-  return plink;
-}
-
-DWORD icq_TCPSendMessage(icq_Link *icqlink, DWORD uin, const char *message)
-{
-  icq_TCPLink *plink;
-  icq_Packet *p;
-  DWORD sequence;
-  char data[ICQ_MAX_MESSAGE_SIZE] ;
-  
-  strncpy(data,message,sizeof(data)) ;
-  data[sizeof(data)-1]='\0';
-  icq_RusConv("kw", data) ;
-
-  plink=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-  /* create and send the message packet */
-  p=icq_TCPCreateMessagePacket(plink, data);
-  sequence=icq_TCPLinkSendSeq(plink, p, 0);
-
-#ifdef TCP_PACKET_TRACE
-  printf("message packet sent to uin %lu { sequence=%lx }\n", uin, p->id);
-#endif
-
-  return sequence;
-}
-
-DWORD icq_TCPSendURL(icq_Link *icqlink, DWORD uin, const char *message, const char *url)
-{
-  icq_TCPLink *plink;
-  icq_Packet *p;
-  DWORD sequence;
-  char data[ICQ_MAX_MESSAGE_SIZE];
-
-  plink=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  
-  strncpy(data, message, sizeof(data));
-  data[sizeof(data)-1] = '\0';
-  icq_RusConv("kw", data);
-
-  /* create and send the url packet */
-  p=icq_TCPCreateURLPacket(plink, data, url);
-  sequence=icq_TCPLinkSendSeq(plink, p, 0);
-
-#ifdef TCP_PACKET_TRACE
-  printf("url packet queued for uin %lu { sequence=%lx }\n", uin, p->id);
-#endif
-
-  return sequence;
-}
-
-DWORD icq_TCPSendAwayMessageReq(icq_Link *icqlink, DWORD uin, int status)
-{
-  icq_TCPLink *plink;
-  icq_Packet *p;
-  DWORD sequence;
-  WORD type;
-  
-  plink=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-  /* create and send the message packet */
-  switch(status)
-  {
-    case STATUS_AWAY:
-      type=ICQ_TCP_MSG_READAWAY;
-      break;
-    case STATUS_DND:
-      type=ICQ_TCP_MSG_READDND;
-      break;
-    case STATUS_NA:
-      type=ICQ_TCP_MSG_READNA;
-      break;
-    case STATUS_OCCUPIED:
-      type=ICQ_TCP_MSG_READOCCUPIED;
-      break;
-    case STATUS_FREE_CHAT:
-      type=ICQ_TCP_MSG_READFFC;
-      break;
-    default:
-      type=ICQ_TCP_MSG_READAWAY;
-      break;
-  }
-  p=icq_TCPCreateAwayReqPacket(plink, type);
-  sequence=icq_TCPLinkSendSeq(plink, p, 0);
-
-#ifdef TCP_PACKET_TRACE
-  printf("away msg request packet sent to uin %lu { sequence=%lx }\n", uin, p->id);
-#endif
-
-  return sequence;
-}
-
-DWORD icq_SendChatRequest(icq_Link *icqlink, DWORD uin, const char *message)
-{
-  icq_TCPLink *plink;
-  icq_Packet *p;
-  DWORD sequence;
-  char data[ICQ_MAX_MESSAGE_SIZE];
-
-  plink=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  
-  strncpy(data, message, sizeof(data));
-  data[sizeof(data)-1] = '\0';
-  icq_RusConv("kw", data);
-
-  /* create and send the url packet */
-  p=icq_TCPCreateChatReqPacket(plink, data);
-  sequence=icq_TCPLinkSendSeq(plink, p, 0);
-
-#ifdef TCP_PACKET_TRACE
-  printf("chat req packet sent to uin %lu { sequence=%lx }\n", uin, p->id);
-#endif
-
-  return sequence;
-}
-
-unsigned long icq_SendFileRequest(icq_Link *icqlink, unsigned long uin,
-  const char *message, char **files)
-{
-  icq_TCPLink *plink;
-  icq_FileSession *pfile;
-  icq_Packet *p;
-  unsigned long sequence;
-  char filename[64];
-  char data[ICQ_MAX_MESSAGE_SIZE];
-  char **filesiterator;
-  char **pfilesiterator;
-
-  plink=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-  /* create the file session, this will be linked to the incoming icq_TCPLink
-   * in icq_HandleFileAck */ 
-  pfile=icq_FileSessionNew(icqlink);
-  pfile->remote_uin=uin;
-  pfile->files=files;
-  pfile->direction=FILE_STATUS_SENDING;
-
-  /* count the number and size of the files */
-  pfile->total_files=0;
-  filesiterator = files;
-  while(*filesiterator) {
-#ifdef _WIN32
-    struct _stat file_status;
-    if(_stat(*filesiterator, &file_status)==0) {
-#else
-    struct stat file_status;
-    if(stat(*filesiterator, &file_status)==0) {
-#endif
-      pfile->total_files++;
-      pfile->total_bytes+=file_status.st_size;
-    }
-    filesiterator++;
-  }
-
-  pfile->files=(char **)malloc(sizeof(char *)*(pfile->total_files +1));
-  filesiterator = files;
-  pfilesiterator = pfile->files;
-  while (*filesiterator) {
-    *pfilesiterator=(char *)malloc(strlen(*filesiterator)+1);
-    strcpy(*pfilesiterator,*filesiterator);
-    filesiterator++;
-    pfilesiterator++;
-  }
-  *pfilesiterator = NULL;
-
-  strncpy(filename, *(pfile->files), 64);
-
-  strncpy(data, message, sizeof(data));
-  data[sizeof(data)-1]='\0';
-  icq_RusConv("kw", data);  
-
-  /* create and send the file req packet */
-  p=icq_TCPCreateFileReqPacket(plink, (char *)data, filename, 
-    pfile->total_bytes);
-  sequence=icq_TCPLinkSendSeq(plink, p, 0);
-  pfile->id=sequence;
-
-#ifdef TCP_PACKET_TRACE
-  printf("file req packet sent to uin %lu { sequence=%lx }\n", uin, p->id);
-#endif
-
-  return sequence;
-}            
-
-void icq_AcceptChatRequest(icq_Link *icqlink, DWORD uin, unsigned long sequence)
-{
-  icq_TCPLink *pmessage, *plisten;
-  icq_ChatSession *pchat;
-  icq_Packet *p;
-
-  pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-  /* create the chat listening socket if necessary */
-  if(!(plisten=icq_FindTCPLink(icqlink, 0, TCP_LINK_CHAT)))
-  {
-    plisten=icq_TCPLinkNew(icqlink);
-    plisten->type=TCP_LINK_CHAT;
-    icq_TCPLinkListen(plisten);
-  }
-
-  /* create the chat session, this will be linked to the incoming icq_TCPLink
-   * in TCPProcessHello */ 
-  pchat=icq_ChatSessionNew(icqlink);
-  pchat->id=sequence;
-  pchat->remote_uin=uin;
-
-  /* create and send the ack packet */
-  p=icq_TCPCreateChatReqAck(pmessage,
-    ntohs(plisten->socket_address.sin_port));
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-
-#ifdef TCP_PACKET_TRACE
-  printf("chat req ack sent to uin %lu { sequence=%lx }\n", uin, sequence);
-#endif
-}
-
-void icq_TCPSendChatData(icq_Link *icqlink, DWORD uin, const char *data)
-{
-  icq_TCPLink *plink=icq_FindTCPLink(icqlink, uin, TCP_LINK_CHAT);
-  char data1[ICQ_MAX_MESSAGE_SIZE];
-  int data1_len;
-
-  if(!plink)
-    return;  
-
-  strncpy(data1,data,sizeof(data1)) ;
-  data1[sizeof(data1)-1] = '\0';
-  data1_len = strlen(data);
-  icq_ChatRusConv_n("kw", data1, data1_len);
-
-  send(plink->socket, data1, data1_len, 0);
-}
-
-void icq_TCPSendChatData_n(icq_Link *icqlink, DWORD uin, const char *data, int len)
-{
-  icq_TCPLink *plink=icq_FindTCPLink(icqlink, uin, TCP_LINK_CHAT);
-  char *data1;
-
-  if(!plink)
-    return;
-
-  data1 = (char *)malloc(len);
-  memcpy(data1, data, len);
-  icq_ChatRusConv_n("kw", data1, len);  
-
-  send(plink->socket, data1, len, 0);
-}
-
-icq_FileSession *icq_AcceptFileRequest(icq_Link *icqlink, DWORD uin,
-  unsigned long sequence)
-{
-  icq_TCPLink *pmessage, *plisten;
-  icq_FileSession *pfile;
-  icq_Packet *p;
-
-  pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-  /* create the file listening socket if necessary */
-  if(!(plisten=icq_FindTCPLink(icqlink, 0, TCP_LINK_FILE)))
-  {
-    plisten=icq_TCPLinkNew(icqlink);
-    plisten->type=TCP_LINK_FILE;
-    icq_TCPLinkListen(plisten);
-  }
-
-  /* create the file session, this will be linked to the incoming icq_TCPLink
-   * in TCPProcessHello */ 
-  pfile=icq_FileSessionNew(icqlink);
-  pfile->id=sequence;
-  pfile->remote_uin=uin;
-  pfile->direction=FILE_STATUS_RECEIVING;
-  pfile->tcplink=plisten;
-  icq_FileSessionSetStatus(pfile, FILE_STATUS_LISTENING);
-
-  /* create and send the ack packet */
-  p=icq_TCPCreateFileReqAck(pmessage, 
-    ntohs(plisten->socket_address.sin_port));
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-
-#ifdef TCP_PACKET_TRACE
-  printf("file req ack sent to uin %lu { sequence=%lx }\n", uin, sequence);
-#endif
-
-  return pfile;
-}
-
-void icq_RefuseFileRequest(icq_Link *icqlink, DWORD uin, 
-  unsigned long sequence, const char *reason)
-{
-  icq_TCPLink *pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  icq_Packet *p;
-
-  /* create and send the refuse packet */
-  p=icq_TCPCreateFileReqRefuse(pmessage,
-    ntohs(pmessage->socket_address.sin_port), reason);
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-
-#ifdef TCP_PACKET_TRACE
-  printf("file req refuse sent to uin %lu { sequence=%lx, reason=\"%s\" }\n",
-    uin, sequence, reason);
-#endif
-}
-
-void icq_CancelFileRequest(icq_Link *icqlink, DWORD uin, unsigned long sequence)
-{
-  icq_TCPLink *pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  icq_FileSession *psession=icq_FindFileSession(icqlink, uin, sequence);
-  icq_Packet *p;
-
-  if (psession)
-    icq_FileSessionClose(psession);
-
-  /* create and send the cancel packet */
-  p=icq_TCPCreateFileReqCancel(pmessage,
-    ntohs(pmessage->socket_address.sin_port));
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-#ifdef TCP_PACKET_TRACE
-  printf("file req cancel sent to uin %lu { sequence=%lx }\n", uin, sequence);
-#endif
-}
-
-void icq_RefuseChatRequest(icq_Link *icqlink, DWORD uin, 
-  unsigned long sequence, const char *reason)
-{
-  icq_TCPLink *pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  icq_Packet *p;
-
-  /* create and send the refuse packet */
-  p=icq_TCPCreateChatReqRefuse(pmessage,
-    ntohs(pmessage->socket_address.sin_port), reason);
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-
-#ifdef TCP_PACKET_TRACE
-  printf("chat req refuse sent to uin %lu { sequence=%lx, reason=\"%s\" }\n",
-    uin, sequence, reason);
-#endif
-}
-
-void icq_CancelChatRequest(icq_Link *icqlink, DWORD uin, unsigned long sequence)
-{
-  icq_TCPLink *pmessage=icq_TCPCheckLink(icqlink, uin, TCP_LINK_MESSAGE);
-  icq_ChatSession *psession=icq_FindChatSession(icqlink, uin);
-  icq_Packet *p;
-
-  if (psession)
-    icq_ChatSessionClose(psession);
-
-  /* create and send the cancel packet */
-  p=icq_TCPCreateChatReqCancel(pmessage,
-    ntohs(pmessage->socket_address.sin_port));
-  (void)icq_TCPLinkSendSeq(pmessage, p, sequence);
-
-#ifdef TCP_PACKET_TRACE
-  printf("chat req cancel sent to uin %lu { sequence=%lx }\n", uin, sequence);
-#endif
-}
--- a/src/protocols/icq/tcp.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,62 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcp.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _ICQTCP_H
-#define _ICQTCP_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "tcplink.h"
-
-/* initialize icq_TCPSocket and icq_TCPSocketAddress
- * returns < 0 on failure */
-int icq_TCPInit(icq_Link *icqlink);
-
-/* close icq_TCPSocket, internal cleanup */
-void icq_TCPDone(icq_Link *icqlink);
-
-int icq_TCPProcessHello(icq_Packet *p, icq_TCPLink *plink);
-void icq_TCPProcessPacket(icq_Packet *p, icq_TCPLink *plink);
-void icq_TCPProcessChatPacket(icq_Packet *p, icq_TCPLink *plink);
-void icq_TCPProcessFilePacket(icq_Packet *p, icq_TCPLink *plink);
-
-/* Debugging */
-/* trace packet process results */
-#undef TCP_PROCESS_TRACE 
-
-/* trace sent and received icq packets */
-#undef TCP_PACKET_TRACE    
-
-/* trace raw sent and received packet data */
-#undef TCP_RAW_TRACE 
-
-/* trace recv buffer in tcplink.c*/
-#undef TCP_BUFFER_TRACE
-
-/* trace queueing operations in list.c */
-#undef TCP_QUEUE_TRACE
-
-#endif /* _ICQTCP_H */
--- a/src/protocols/icq/tcpchathandle.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,259 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcpchathandle.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-
-#include "stdpackets.h"
-#include "chatsession.h"
-
-void icq_HandleChatAck(icq_TCPLink *plink, icq_Packet *p, int port)
-{
-  icq_TCPLink *pchatlink;
-  icq_ChatSession *pchat;
-  icq_Packet *p2;
-
-  pchatlink=icq_TCPLinkNew(plink->icqlink);
-  pchatlink->type=TCP_LINK_CHAT;
-  pchatlink->id=p->id;
-
-  /* once the ack packet has been processed, create a new chat session */
-  pchat=icq_ChatSessionNew(plink->icqlink);
-
-  pchat->id=p->id;
-  pchat->remote_uin=plink->remote_uin;
-  pchat->tcplink=pchatlink;
-
-  invoke_callback(plink->icqlink, icq_RequestNotify)(plink->icqlink, p->id,
-    ICQ_NOTIFY_CHATSESSION, sizeof(icq_ChatSession), pchat);
-
-  icq_ChatSessionSetStatus(pchat, CHAT_STATUS_CONNECTING);
-  icq_TCPLinkConnect(pchatlink, plink->remote_uin, port);
-
-  pchatlink->session=pchat;
-
-  p2=icq_TCPCreateChatInfoPacket(pchatlink, plink->icqlink->icq_Nick,
-    0x00ffffff, 0x00000000);
-  icq_TCPLinkSend(pchatlink, p2);
-
-}
-
-void icq_HandleChatHello(icq_TCPLink *plink)
-{
-
-  /* once the hello packet has been processed and we know which uin this
-   * link is for, we can link up with a chat session */
-  icq_ChatSession *pchat=icq_FindChatSession(plink->icqlink,
-    plink->remote_uin);
-
-  if(pchat)
-  {
-    plink->id=pchat->id;
-    plink->session=pchat;
-    icq_ChatSessionSetStatus(pchat, CHAT_STATUS_WAIT_NAME);
-
-  } else {
-
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING,
-      "unexpected chat hello received from %d, closing link\n",
-      plink->remote_uin);
-    icq_TCPLinkClose(plink);
-  }
-
-}
-
-void icq_TCPOnChatReqReceived(icq_Link *icqlink, DWORD uin,
-  const char *message, DWORD id)
-{
-  /* use the current system time for time received */
-  time_t t=time(0);
-  struct tm *ptime=localtime(&t);
-
-#ifdef TCP_PACKET_TRACE
-  printf("chat request packet received from %lu { sequence=%lx, message=%s }\n",
-     uin, id, message);
-#endif /* TCP_PACKET_TRACE */
-
-  invoke_callback(icqlink,icq_RecvChatReq)(icqlink, uin, ptime->tm_hour, 
-    ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900,
-    message, id);
-
-  /* don't send an acknowledgement to the remote client!
-   * GUI is responsible for sending acknowledgement once user accepts
-   * or denies using icq_TCPSendChatAck */
-}
-
-void icq_TCPChatUpdateFont(icq_ChatSession *psession, const char *font, 
-  WORD encoding, DWORD style, DWORD size)
-{
-  icq_Link *icqlink = psession->icqlink;
-  int packet_len, fontlen;
-  char *buffer;
-
-  buffer = malloc(packet_len = (2 + (fontlen = strlen(font) + 1)) + 
-    2 + 1 + (4+1)*2);
-  buffer[0] = '\x11';
-  *((DWORD *)&buffer[1]) = style;
-  buffer[5] = '\x12';
-  *((DWORD *)&buffer[6]) = size;
-  buffer[10] = '\x10';
-  *((WORD *)&buffer[11]) = fontlen;
-  strcpy(&buffer[13], font);
-
-  icq_RusConv("wk", &buffer[13]);
-
-  *((WORD *)&buffer[13 + fontlen]) = encoding;
-
-  invoke_callback(icqlink, icq_ChatNotify)(psession, CHAT_NOTIFY_DATA,
-    packet_len, buffer);
-
-  free(buffer);
-}
-
-void icq_TCPChatUpdateColors(icq_ChatSession *psession, DWORD foreground, 
-  DWORD background)
-{
-  icq_Link *icqlink = psession->icqlink;
-  char buffer[10];
-
-  buffer[0] = '\x00';
-  *((DWORD *)&buffer[1]) = foreground;
-  buffer[5] = '\x01';
-  *((DWORD *)&buffer[6]) = background;
-
-  invoke_callback(icqlink, icq_ChatNotify)(psession, 
-    CHAT_NOTIFY_DATA, sizeof(buffer), buffer);
-}
-
-void icq_TCPProcessChatPacket(icq_Packet *p, icq_TCPLink *plink)
-{
-  DWORD code;
-  DWORD remote_uin;
-  DWORD ip1, ip2;
-  DWORD fg, bg, fontstyle, fontsize;
-  WORD port1, encoding;
-  icq_Packet *presponse;
-  icq_ChatSession *pchat=(icq_ChatSession *)plink->session;
-  const char *font, *user;
-	
-  icq_PacketBegin(p);
-
-  code=icq_PacketRead32(p);
-  remote_uin=icq_PacketRead32(p);
-
-  if(code==0x00000006 || code==0x00070004)
-  {
-    font = (char *)NULL;
-    encoding = 0;
-    fontstyle = 0;
-    fontsize = 0;
-    if(code == 0x00070004)
-    {
-      ip1 = icq_PacketRead32(p);
-      ip2 = icq_PacketRead32(p);
-      icq_PacketRead8(p);
-      port1 = icq_PacketRead16(p);
-      fontsize = icq_PacketRead32(p);
-      fontstyle = icq_PacketRead32(p);
-      font = icq_PacketReadString(p);
-      encoding = icq_PacketRead16(p);
-    }
-    else
-    {
-      ip1 = icq_PacketRead32(p);
-      ip2 = icq_PacketRead32(p);
-      port1 = icq_PacketRead16(p);
-      icq_PacketRead8(p);
-      fontsize = icq_PacketRead32(p);
-      fontstyle = icq_PacketRead32(p);
-      font = icq_PacketReadString(p);
-      encoding = icq_PacketRead16(p);
-    }
-    if(font)
-      icq_TCPChatUpdateFont(pchat, font, encoding, fontstyle, fontsize);
-    icq_ChatSessionSetStatus(pchat, CHAT_STATUS_READY);
-    plink->mode|=TCP_LINK_MODE_RAW;
-  }
-  else
-    if(remote_uin>0xffffff00)
-    {
-      remote_uin=icq_PacketRead32(p);
-      user = icq_PacketReadString(p);
-      icq_PacketRead16(p); /* Unknown */;
-      fg = icq_PacketRead32(p);
-      bg = icq_PacketRead32(p);
-      icq_TCPChatUpdateColors(pchat, fg, bg);
-
-      presponse=icq_TCPCreateChatInfo2Packet(plink, plink->icqlink->icq_Nick,
-        0x00ffffff, 0x00000000);
-      icq_PacketSend(presponse, plink->socket);
-      icq_PacketDelete(presponse);
-      icq_ChatSessionSetStatus(pchat, CHAT_STATUS_WAIT_FONT);
-    }
-    else
-    {
-      user = icq_PacketReadString(p);
-      fg = icq_PacketRead32(p);
-      bg = icq_PacketRead32(p);
-      icq_TCPChatUpdateColors(pchat, fg, bg);
-      font = (char *)NULL;
-      encoding = 0;
-      fontstyle = 0;
-      fontsize = 0;
-      if((code = icq_PacketRead32(p)) == 0x00070004)
-      {
-        icq_PacketRead32(p);
-        ip1 = icq_PacketRead32(p);
-        ip2 = icq_PacketRead32(p);
-        icq_PacketRead8(p);
-        port1 = icq_PacketRead16(p);
-        fontsize = icq_PacketRead32(p);
-        fontstyle = icq_PacketRead32(p);
-        font = icq_PacketReadString(p);
-        encoding = icq_PacketRead16(p);
-      }
-      else if(code == 0x00000006)
-      {
-        icq_PacketRead32(p);
-        ip1 = icq_PacketRead32(p);
-        ip2 = icq_PacketRead32(p);
-        port1 = icq_PacketRead16(p);
-        icq_PacketRead8(p);
-        fontsize = icq_PacketRead32(p);
-        fontstyle = icq_PacketRead32(p);
-        font = icq_PacketReadString(p);
-        encoding = icq_PacketRead16(p);
-      }
-      if(font)
-        icq_TCPChatUpdateFont(pchat, font, encoding, fontstyle, fontsize);
-      presponse=icq_TCPCreateChatFontInfoPacket(plink);
-      icq_PacketSend(presponse, plink->socket);
-      icq_PacketDelete(presponse);
-      /* notify app that chat connection has been established */
-      icq_ChatSessionSetStatus(pchat, CHAT_STATUS_READY);
-      plink->mode|=TCP_LINK_MODE_RAW;
-    }
-}
-
--- a/src/protocols/icq/tcpfilehandle.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,249 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcpfilehandle.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifdef _MSVC_
-#include <io.h>
-#define open _open
-#define close _close
-#define read _read
-#define write _write
-#endif
-
-#include <errno.h>
-
-#include "icqlib.h"
-
-#include "tcp.h"
-#include "stdpackets.h"
-#include "filesession.h"
-
-void icq_TCPOnFileReqReceived(icq_Link *icqlink, DWORD uin, const char *message, 
-   const char *filename, unsigned long filesize, DWORD id)
-{
-  /* use the current system time for time received */
-  time_t t=time(0);
-  struct tm *ptime=localtime(&t);
-
-#ifdef TCP_PACKET_TRACE
-  printf("file request packet received from %lu { sequence=%lx, message=%s }\n",
-     uin, id, message);
-#endif
-
-  invoke_callback(icqlink,icq_RecvFileReq)(icqlink, uin, ptime->tm_hour, 
-    ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900,
-    message, filename, filesize, id);
-
-  /* don't send an acknowledgement to the remote client!
-   * GUI is responsible for sending acknowledgement once user accepts
-   * or denies using icq_TCPSendFileAck */
-}
-
-void icq_TCPProcessFilePacket(icq_Packet *p, icq_TCPLink *plink)
-{
-  icq_FileSession *psession=(icq_FileSession *)plink->session;
-  icq_Link *icqlink = plink->icqlink;
-  BYTE type;
-  DWORD num_files;
-  DWORD total_bytes;
-  DWORD speed;
-  DWORD filesize;
-  const char *name;
-  int result;
-
-  icq_Packet *presponse;
-
-  icq_PacketBegin(p);
-
-  type=icq_PacketRead8(p);
-
-  switch(type)
-  {
-    case 0x00:
-      (void)icq_PacketRead32(p);
-      num_files=icq_PacketRead32(p);
-      total_bytes=icq_PacketRead32(p);
-      speed=icq_PacketRead32(p);
-      name=icq_PacketReadString(p);
-      psession->total_files=num_files;
-      psession->total_bytes=total_bytes;
-      psession->current_speed=speed;
-      icq_FileSessionSetHandle(psession, name);
-      icq_FileSessionSetStatus(psession, FILE_STATUS_INITIALIZING);
-
-      /* respond */
-      presponse=icq_TCPCreateFile01Packet(speed, icqlink->icq_Nick);
-
-      icq_TCPLinkSend(plink, presponse);
-#ifdef TCP_PACKET_TRACE
-      printf("file 01 packet sent to uin %lu\n", plink->remote_uin);
-#endif
-
-      break;
-
-    case 0x01:
-      speed=icq_PacketRead32(p);
-      name=icq_PacketReadString(p);
-      psession->current_speed=speed;
-      icq_FileSessionSetHandle(psession, name);
-      icq_FileSessionSetStatus(psession, FILE_STATUS_INITIALIZING);
-
-      /* respond */
-      icq_FileSessionPrepareNextFile(psession);
-      presponse=icq_TCPCreateFile02Packet(psession->current_file,
-        psession->current_file_size, psession->current_speed);
-
-      icq_TCPLinkSend(plink, presponse);
-#ifdef TCP_PACKET_TRACE
-      printf("file 02 packet sent to uin %lu\n", plink->remote_uin);
-#endif       
-      break;
-
-    case 0x02:
-      /* when files are skipped
-      psession->total_transferred_bytes+=
-        (psession->current_file_size-psession->current_file_progress);
-      */
-
-      (void)icq_PacketRead8(p);
-      name=icq_PacketReadString(p);
-      (void)icq_PacketReadString(p);
-      filesize=icq_PacketRead32(p);
-      (void)icq_PacketRead32(p);
-      speed=icq_PacketRead32(p);
-      icq_FileSessionSetCurrentFile(psession, name);
-      psession->current_file_size=filesize;
-      psession->current_speed=speed;
-      psession->current_file_num++;
-      icq_FileSessionSetStatus(psession, FILE_STATUS_NEXT_FILE);
-
-      /* respond */
-      presponse=icq_TCPCreateFile03Packet(psession->current_file_progress,
-         speed);
-
-      icq_TCPLinkSend(plink, presponse);
-#ifdef TCP_PACKET_TRACE
-      printf("file 03 packet sent to uin %lu\n", plink->remote_uin);
-#endif       
-      break;
-	
-    case 0x03:
-      filesize=icq_PacketRead32(p);
-      (void)icq_PacketRead32(p);       
-      speed=icq_PacketRead32(p);
-      psession->current_file_progress=filesize;
-      psession->total_transferred_bytes+=filesize;
-      psession->current_speed=speed;
-
-      icq_FileSessionSetStatus(psession, FILE_STATUS_NEXT_FILE);
-      icq_FileSessionSetStatus(psession, FILE_STATUS_SENDING);
-      break;
-
-    case 0x04:
-      (void)icq_PacketRead32(p);
-      invoke_callback(icqlink, icq_FileNotify)(psession, 
-        FILE_NOTIFY_STOP_FILE, 0, NULL);
-      break;
-
-    case 0x05:
-      speed=icq_PacketRead32(p);
-      psession->current_speed=speed;
-      invoke_callback(icqlink, icq_FileNotify)(psession,
-        FILE_NOTIFY_NEW_SPEED, speed, NULL);
-      break;
-
-    case 0x06:
-    {
-      void *data = p->data+sizeof(BYTE);
-      int length = p->length-sizeof(BYTE);
-
-      invoke_callback(icqlink, icq_FileNotify)(psession,
-        FILE_NOTIFY_DATAPACKET, length, data);
-      icq_FileSessionSetStatus(psession, FILE_STATUS_RECEIVING);
-      result=write(psession->current_fd, data, length);
-      psession->current_file_progress+=length;
-      psession->total_transferred_bytes+=length;
-      break;
-    }
-
-    default:
-      icq_FmtLog(icqlink, ICQ_LOG_WARNING, "unknown file packet type %d!\n", type);
-
-  }
-}
-
-void icq_HandleFileHello(icq_TCPLink *plink)
-{
-
-  /* once the hello packet has been processed and we know which uin this
-   * link is for, we can link up with a file session */
-  icq_FileSession *pfile=icq_FindFileSession(plink->icqlink,
-    plink->remote_uin, 0);
-
-  if(pfile)
-  {
-    plink->id=pfile->id;
-    plink->session=pfile;
-    pfile->tcplink=plink;
-    icq_FileSessionSetStatus(pfile, FILE_STATUS_CONNECTED);
-
-  } else {
-
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING,
-      "unexpected file hello received from %d, closing link\n",
-      plink->remote_uin);
-    icq_TCPLinkClose(plink);
-  }
-
-}
-  
-void icq_HandleFileAck(icq_TCPLink *plink, icq_Packet *p, int port)
-{
-  icq_TCPLink *pfilelink;
-  icq_FileSession *pfile;
-  icq_Packet *p2;
-
-  pfilelink=icq_TCPLinkNew(plink->icqlink);
-  pfilelink->type=TCP_LINK_FILE;
-  pfilelink->id=p->id;
-
-  /* once the ack packet has been processed, link up with the file session */
-  pfile=icq_FindFileSession(plink->icqlink, plink->remote_uin, 0);
-
-  pfile->tcplink=pfilelink;
-  pfilelink->id=pfile->id;
-
-  invoke_callback(plink->icqlink, icq_RequestNotify)(plink->icqlink,
-    pfile->id, ICQ_NOTIFY_FILESESSION, sizeof(icq_FileSession), pfile);
-  
-  icq_FileSessionSetStatus(pfile, FILE_STATUS_CONNECTING);
-  icq_TCPLinkConnect(pfilelink, plink->remote_uin, port);
-
-  pfilelink->session=pfile;
-
-  p2=icq_TCPCreateFile00Packet( pfile->total_files,
-    pfile->total_bytes, pfile->current_speed, plink->icqlink->icq_Nick);
-  icq_TCPLinkSend(pfilelink, p2);
-
-}   
-
--- a/src/protocols/icq/tcphandle.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,361 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcphandle.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-
-#include "tcp.h"
-#include "stdpackets.h"
-
-void icq_TCPOnMessageReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id, icq_TCPLink *plink);
-void icq_TCPOnURLReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id);
-void icq_TCPOnContactListReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id);
-void icq_TCPOnChatReqReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id);
-void icq_TCPOnFileReqReceived(icq_Link *icqlink, DWORD uin, const char *message, 
-   const char *filename, unsigned long filesize, DWORD id);
-void icq_TCPProcessAck(icq_Link *icqlink, icq_Packet *p);
-void icq_HandleChatAck(icq_TCPLink *plink, icq_Packet *p, int port);
-void icq_HandleChatHello(icq_TCPLink *plink);
-void icq_HandleFileHello(icq_TCPLink *plink);
-void icq_HandleFileAck(icq_TCPLink *plink, icq_Packet *p, int port);
-
-void icq_TCPProcessPacket(icq_Packet *p, icq_TCPLink *plink)
-{
-  DWORD uin;
-  WORD version;
-  WORD command;
-  WORD type;
-  WORD status;
-  DWORD command_type;
-  DWORD filesize = 0;
-  DWORD port = 0;
-  
-  const char *message;
-  const char *filename = 0;
-
-  icq_PacketBegin(p);
-  (void)icq_PacketRead32(p);
-  version=icq_PacketRead16(p);
-  command=icq_PacketRead16(p);
-  (void)icq_PacketRead16(p);
-
-  uin=icq_PacketRead32(p);
-  type=icq_PacketRead16(p);
-  message=icq_PacketReadString(p);
-  (void)icq_PacketRead32(p);
-  (void)icq_PacketRead32(p);
-  (void)icq_PacketRead32(p);
-  (void)icq_PacketRead8(p);
-  status=icq_PacketRead16(p);
-  command_type=icq_PacketRead16(p);
-
-  switch(type & ~ICQ_TCP_MASS_MASK)
-  {
-    case ICQ_TCP_MSG_MSG:
-    case ICQ_TCP_MSG_URL:
-    case ICQ_TCP_MSG_CONTACTLIST:
-    case ICQ_TCP_MSG_READAWAY:
-    case ICQ_TCP_MSG_READNA:
-    case ICQ_TCP_MSG_READDND:
-    case ICQ_TCP_MSG_READOCCUPIED:
-    case ICQ_TCP_MSG_READFFC:
-      p->id=icq_PacketRead32(p);
-      break;
-
-    case ICQ_TCP_MSG_CHAT:
-      (void)icq_PacketReadString(p);
-      (void)icq_PacketRead16(p);
-      (void)icq_PacketRead16(p);
-      port=icq_PacketRead32(p);
-      p->id=icq_PacketRead32(p);
-      break;
-
-    case ICQ_TCP_MSG_FILE:
-      (void)icq_PacketRead16(p);
-      (void)icq_PacketRead16(p);
-      filename=icq_PacketReadString(p);
-      filesize=icq_PacketRead32(p);
-      port=icq_PacketRead32(p);
-      p->id=icq_PacketRead32(p);
-      break;
-
-    default:
-      icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown message packet, type %x\n", type);
-  }
-
-#ifdef TCP_PROCESS_TRACE
-  printf("packet processed from uin: %lu:\n", uin);
-  printf("   command: %x\ttype: %x\n", command, type);
-  printf("   status: %x\tcommand_type: %x\n", status, (int)command_type);
-  printf("   message %s\n", message);
-  printf("   id: %x\n", (int)p->id);
-#endif
-
-  switch(command)
-  {
-    case ICQ_TCP_MESSAGE:
-      switch(type & ~ICQ_TCP_MASS_MASK)
-      {
-        case ICQ_TCP_MSG_MSG:
-          icq_TCPOnMessageReceived(plink->icqlink, uin, message, p->id, plink);
-          break;
-
-        case ICQ_TCP_MSG_URL:
-          icq_TCPOnURLReceived(plink->icqlink, uin, message, p->id);
-          break;
-
-        case ICQ_TCP_MSG_CHAT:
-          icq_TCPOnChatReqReceived(plink->icqlink, uin, message, p->id);
-          break;
-
-        case ICQ_TCP_MSG_FILE:
-          icq_TCPOnFileReqReceived(plink->icqlink, uin, message, filename, filesize, p->id);
-          break;
-
-        case ICQ_TCP_MSG_CONTACTLIST:
-          icq_TCPOnContactListReceived(plink->icqlink, uin, message, p->id);
-          break;
-
-        default:
-          icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "unknown message type %d!\n", type);
-          break;
-      }
-      break;
-
-    case ICQ_TCP_ACK:
-      invoke_callback(plink->icqlink, icq_RequestNotify)
-        (plink->icqlink, p->id, ICQ_NOTIFY_ACK, status, (void *)message);
-      switch(type)
-      {
-        case ICQ_TCP_MSG_CHAT:
-          icq_HandleChatAck(plink, p, port);
-          break;
-
-        case ICQ_TCP_MSG_FILE:
-          icq_HandleFileAck(plink, p, port);
-          break;
-
-        case ICQ_TCP_MSG_MSG:
-        case ICQ_TCP_MSG_URL:
-          icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, "received ack %d\n", 
-            p->id);
-          break;
-
-        case ICQ_TCP_MSG_READAWAY:
-        case ICQ_TCP_MSG_READNA:
-        case ICQ_TCP_MSG_READDND:
-        case ICQ_TCP_MSG_READOCCUPIED:
-        case ICQ_TCP_MSG_READFFC:
-          icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, 
-            "received away msg, seq %d\n", p->id);
-          invoke_callback(plink->icqlink, icq_RecvAwayMsg)
-            (plink->icqlink, p->id, message);
-          break;
-      }
-      invoke_callback(plink->icqlink, icq_RequestNotify)
-        (plink->icqlink, p->id, ICQ_NOTIFY_SUCCESS, 0, NULL);
-      break;
-
-    case ICQ_TCP_CANCEL:
-      /* icq_TCPProcessCancel(p); */
-      break;
-
-    default:
-      icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, 
-                 "unknown packet command %d!\n", command);
-  }
-}
-
-void icq_TCPProcessCancel(icq_Packet *p)
-{
-  (void)p;
-
-/*
-  find packet in queue
-  call notification function
-  remove packet from queue
-*/
-}
-
-int icq_TCPProcessHello(icq_Packet *p, icq_TCPLink *plink)
-{
-  /* TCP Hello packet */
-  BYTE code;                /* 0xFF - init packet code */
-  DWORD version;            /* tcp version */
-  DWORD remote_port;        /* remote message listen port */
-  DWORD remote_uin;         /* remote uin */
-  DWORD remote_ip;          /* remote IP as seen by ICQ server */
-  DWORD remote_real_ip;     /* remote IP as seen by client */
-  BYTE flags;               /* tcp flags */
-  DWORD remote_other_port;  /* remote chat or file listen port */
-
-  icq_PacketBegin(p);
-  
-  code=icq_PacketRead8(p);
-  version=icq_PacketRead32(p);
-
-  if (!(p->length>=26 && code==ICQ_TCP_HELLO))
-  {
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, 
-      "malformed hello packet received from %s:%d, closing link\n",
-      inet_ntoa(*((struct in_addr *)(&(plink->remote_address.sin_addr)))),
-      ntohs(plink->remote_address.sin_port));
-
-    icq_TCPLinkClose(plink);
-    return 0;
-  }
-  remote_port=icq_PacketRead32(p);
-  remote_uin=icq_PacketRead32(p);
-  remote_ip=icq_PacketRead32(p);
-  remote_real_ip=icq_PacketRead32(p);
-  flags=icq_PacketRead8(p);
-  remote_other_port=icq_PacketRead32(p);
-
-  icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, 
-    "hello packet received from %lu { version=%d }\n", remote_uin, version);
-
-  plink->remote_version=version;
-  plink->remote_uin=remote_uin;
-  plink->flags=flags;
-  plink->mode&=~TCP_LINK_MODE_HELLOWAIT;
-
-  /* file and chat sessions require additional handling */
-  if(plink->type==TCP_LINK_CHAT) icq_HandleChatHello(plink);
-  if(plink->type==TCP_LINK_FILE) icq_HandleFileHello(plink);
-
-  return 1;
-}
-
-void icq_TCPOnMessageReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id, icq_TCPLink *plink)
-{
-  char data[ICQ_MAX_MESSAGE_SIZE];
-
-  /* use the current system time for time received */
-  time_t t=time(0);
-  struct tm *ptime=localtime(&t);
-  icq_Packet *pack;
-
-#ifdef TCP_PACKET_TRACE
-  printf("tcp message packet received from %lu { sequence=%x }\n",
-         uin, (int)id);
-#endif
-
-  strncpy(data,message,sizeof(data));
-  data[sizeof(data)-1]='\0';
-  icq_RusConv("wk",data);
-
-  invoke_callback(icqlink,icq_RecvMessage)(icqlink, uin, ptime->tm_hour, 
-    ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900, data);
-
-  /*
-  icq_TCPLink *preallink=icq_FindTCPLink(icqlink, uin, TCP_LINK_MESSAGE);
-  if(plink != preallink)
-    invoke_callback(icqlink,icq_SpoofedMessage)(uin, ...)
-  */
-
-  /* send an acknowledgement to the remote client */
-  pack=icq_TCPCreateMessageAck(plink,0);
-  icq_PacketAppend32(pack, id);
-  icq_PacketSend(pack, plink->socket);
-#ifdef TCP_PACKET_TRACE
-  printf("tcp message ack sent to uin %lu { sequence=%lx }\n", uin, id);
-#endif
-  icq_PacketDelete(pack);
-}
-
-void icq_TCPOnURLReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id)
-{
-  /* use the current system time for time received */
-  time_t t=time(0);
-  struct tm *ptime=localtime(&t);
-  icq_Packet *pack;
-  char *pfe;
-  icq_TCPLink *plink=icq_FindTCPLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-#ifdef TCP_PACKET_TRACE
-  printf("tcp url packet received from %lu { sequence=%lx }\n",
-     uin, id);
-#endif /*TCP_PACKET_TRACE*/
-
-  /* the URL is split from the description by 0xFE */
-  pfe=strchr(message, '\xFE');
-  *pfe=0;
-  icq_RusConv("wk", (char*)message);
-
-  invoke_callback(icqlink,icq_RecvURL)(icqlink, uin, ptime->tm_hour, 
-    ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1, ptime->tm_year+1900, 
-    pfe+1, message);
-
-  /* send an acknowledgement to the remote client */
-  pack=icq_TCPCreateURLAck(plink,0);
-  icq_PacketAppend32(pack, id);
-  icq_PacketSend(pack, plink->socket);
-#ifdef TCP_PACKET_TRACE
-  printf("tcp message ack sent to %lu { sequence=%lx }\n", uin, id);
-#endif
-  icq_PacketDelete(pack);
-}
-
-void icq_TCPOnContactListReceived(icq_Link *icqlink, DWORD uin, const char *message, DWORD id)
-{
-  /* use the current system time for time received */
-  time_t t=time(0);
-  struct tm *ptime=localtime(&t);
-  icq_Packet *pack;
-  icq_List *strList = icq_ListNew();
-  int i, k, nr = icq_SplitFields(strList, message);
-  const char **contact_uin  = (const char **)malloc((nr - 2) /2);
-  const char **contact_nick = (const char **)malloc((nr - 2) /2);
-  icq_TCPLink *plink=icq_FindTCPLink(icqlink, uin, TCP_LINK_MESSAGE);
-
-#ifdef TCP_PACKET_TRACE
-  printf("tcp contactlist packet received from %lu { sequence=%lx }\n", uin, id);
-#endif /* TCP_PACKET_TRACE */
-
-  /* split message */
-  for (i = 1, k = 0; i < (nr - 1); k++)
-  {
-    contact_uin[k]  = icq_ListAt(strList, i);
-    contact_nick[k] = icq_ListAt(strList, i + 1);
-    i += 2;
-  }
-
-  invoke_callback(icqlink,icq_RecvContactList)(icqlink, uin, 
-    ptime->tm_hour, ptime->tm_min, ptime->tm_mday, ptime->tm_mon+1, 
-    ptime->tm_year+1900, k, contact_uin, contact_nick);
-
-  /* send an acknowledement to the remote client */
-  pack=icq_TCPCreateContactListAck(plink, 0);
-  icq_PacketAppend32(pack, id);
-  icq_PacketSend(pack, plink->socket);
-#ifdef TCP_PACKET_TRACE
-  printf("tcp message ack sent to %lu { sequence=%lx }\n", uin, id);
-#endif /* TCP_PACKE_TRACE */
-  icq_PacketDelete(pack);
-
-  free(contact_nick);
-  free(contact_uin);
-  icq_ListDelete(strList, free);
-}
--- a/src/protocols/icq/tcplink.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,903 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcplink.c 2509 2001-10-13 00:06:18Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include <fcntl.h>
-#include <errno.h>
-
-#ifdef _WIN32
-#include <winsock.h>
-#define EINPROGRESS   WSAEINPROGRESS
-#define ENETUNREACH   WSAENETUNREACH
-#define ECONNREFUSED  WSAECONNREFUSED
-#define ETIMEDOUT     WSAETIMEDOUT
-#define EOPNOTSUPP    WSAEOPNOTSUPP
-#define EAFNOSUPPORT  WSAEAFNOSUPPORT
-#define EWOULDBLOCK   WSAEWOULDBLOCK
-#else
-#include <netdb.h>
-#endif
-
-#include "icqlib.h"
-#include "stdpackets.h"
-#include "tcp.h"
-#include "errno.h"
-#include "chatsession.h"
-#include "filesession.h"
-#include "contacts.h"
-#include "socketmanager.h"
-
-icq_TCPLink *icq_TCPLinkNew(icq_Link *icqlink)
-{
-  icq_TCPLink *p=(icq_TCPLink *)malloc(sizeof(icq_TCPLink));
-
-  p->socket=-1;
-  p->icqlink=icqlink;
-  p->mode=0;
-  p->session=0L;
-  p->type=TCP_LINK_MESSAGE;
-  p->buffer_count=0;
-  p->send_queue=icq_ListNew();
-  p->received_queue=icq_ListNew();
-  p->id=0;
-  p->remote_uin=0;
-  p->remote_version=0;
-  p->flags=0;
-  p->proxy_status = 0;
-  p->connect_timeout = NULL;
-
-  if(p)
-    icq_ListEnqueue(icqlink->d->icq_TCPLinks, p);
-
-  return p;
-}
-
-int _icq_TCPLinkDelete(void *pv, va_list data)
-{
-  icq_Packet *p=(icq_Packet *)pv;
-  icq_Link *icqlink=va_arg(data, icq_Link *);
-
-  /* notify the app the packet didn't make it */
-  if(p->id)
-    invoke_callback(icqlink, icq_RequestNotify)(icqlink, p->id,
-      ICQ_NOTIFY_FAILED, 0, 0);
-
-  return 0;
-}
-
-void icq_TCPLinkDelete(void *pv)
-{
-  icq_TCPLink *p=(icq_TCPLink *)pv;
-
-  /* process anything left in the received queue */
-  icq_TCPLinkProcessReceived(p);
-
-  /* make sure we notify app that packets in send queue didn't make it */
-  (void)icq_ListTraverse(p->send_queue, _icq_TCPLinkDelete, p->icqlink);
-
-  /* destruct all packets still waiting on queues */
-  icq_ListDelete(p->send_queue, icq_PacketDelete);
-  icq_ListDelete(p->received_queue, icq_PacketDelete);
-
-  /* if this is a chat or file link, delete the associated session as
-   * well, but make sure we unassociate ourself first so the session
-   * doesn't try to close us */
-  if(p->session)
-  {
-    if(p->type==TCP_LINK_CHAT)
-    {
-      icq_ChatSession *psession=p->session;
-      psession->tcplink=NULL;
-      icq_ChatSessionClose(psession);
-    }
-
-    if(p->type==TCP_LINK_FILE) {
-      icq_FileSession *psession=p->session;
-      psession->tcplink=NULL;
-      icq_FileSessionClose(psession);
-    }
-  }
-
-  /* close the socket after we notify app so app can read errno if necessary */
-  if (p->socket > -1)
-  {
-    icq_SocketDelete(p->socket);
-  }
-
-  if (p->connect_timeout)
-  {
-    icq_TimeoutDelete(p->connect_timeout);
-  }
-
-  free(p);
-}
-
-void icq_TCPLinkClose(icq_TCPLink *plink)
-{
-  icq_ListRemove(plink->icqlink->d->icq_TCPLinks, plink);
-  icq_TCPLinkDelete(plink);
-}
-
-int icq_TCPLinkProxyConnect(icq_TCPLink *plink, DWORD uin, int port)
-{
-  struct sockaddr_in prsin;
-  struct hostent *host_struct;
-  int conct;
-
-  (void)uin; (void)port;
-
-  prsin.sin_addr.s_addr = htonl(plink->icqlink->icq_ProxyIP);
-  if(prsin.sin_addr.s_addr  == (unsigned long)-1)
-  {
-    prsin.sin_addr.s_addr = inet_addr(plink->icqlink->icq_ProxyHost);
-    if(prsin.sin_addr.s_addr  == (unsigned long)-1) /* name isn't n.n.n.n so must be DNS */
-    {
-      host_struct = gethostbyname(plink->icqlink->icq_ProxyHost);
-      if(host_struct == 0L)
-      {
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Can't find hostname: %s\n",
-                   plink->icqlink->icq_ProxyHost);
-        return -1;
-      }
-      prsin.sin_addr = *((struct in_addr *)host_struct->h_addr);
-    }
-  }
-  prsin.sin_family = AF_INET; /* we're using the inet not appletalk*/
-  prsin.sin_port = htons(plink->icqlink->icq_ProxyPort); /* port */
-/*   flags = fcntl(plink->socket, F_GETFL, 0); */
-/*   fcntl(plink->socket, F_SETFL, flags & (~O_NONBLOCK)); */
-  plink->mode |= TCP_LINK_SOCKS_CONNECTING;
-  conct = connect(plink->socket, (struct sockaddr *) &prsin, sizeof(prsin));
-  if(conct == -1) /* did we connect ?*/
-  {
-    if(errno != EINPROGRESS)
-    {
-      conct = errno;
-      icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection refused\n");
-      return conct;
-    }
-    return 1;
-  }
-  return 0;
-}
-
-int icq_TCPLinkProxyRequestAuthorization(icq_TCPLink *plink)
-{
-  char buf[1024];
-
-  int hasName = plink->icqlink->icq_ProxyName &&
-    strlen(plink->icqlink->icq_ProxyName);
-  int hasPass = plink->icqlink->icq_ProxyPass &&
-    strlen(plink->icqlink->icq_ProxyPass);
-  int authEnabled = hasName && hasPass && plink->icqlink->icq_ProxyAuth;
-
-  plink->mode = (plink->mode & (~TCP_LINK_SOCKS_CONNECTING));
-  buf[0] = 5; /* protocol version */
-  buf[1] = 1; /* number of methods */
-  buf[2] = authEnabled ? 2 : 0; /* authentication method */
-
-  plink->mode |= authEnabled ? TCP_LINK_SOCKS_AUTHORIZATION :
-    TCP_LINK_SOCKS_NOAUTHSTATUS;
-
-#ifdef _WIN32
-  if(send(plink->socket, buf, 3, 0) != 3)
-    return errno;
-#else
-  if(write(plink->socket, buf, 3) != 3)
-    return errno;
-#endif
-  return 0;
-}
-
-int icq_TCPLinkProxyAuthorization(icq_TCPLink *plink)
-{
-  int res;
-  char buf[1024];
-
-  plink->mode &= ~TCP_LINK_SOCKS_AUTHORIZATION;
-  plink->mode |= TCP_LINK_SOCKS_AUTHSTATUS;
-
-#ifdef _WIN32
-  res = recv(plink->socket, buf, 2, 0);
-#else
-  res = read(plink->socket, buf, 2);
-#endif
-  if(res != 2 || buf[0] != 5 || buf[1] != 2) /* username/password authentication*/
-  {
-    icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Authentication method incorrect\n");
-    icq_SocketDelete(plink->socket);
-    return -1;
-  }
-  buf[0] = 1; /* version of subnegotiation */
-  buf[1] = strlen(plink->icqlink->icq_ProxyName);
-  memcpy(&buf[2], plink->icqlink->icq_ProxyName, buf[1]);
-  buf[2+buf[1]] = strlen(plink->icqlink->icq_ProxyPass);
-  memcpy(&buf[3+buf[1]], plink->icqlink->icq_ProxyPass, buf[2+buf[1]]);
-#ifdef _WIN32
-  if(send(plink->socket, buf, buf[1]+buf[2+buf[1]]+3, 0) != buf[1] + buf[2+buf[1]]+3)
-    return errno;
-#else
-  if(write(plink->socket, buf, buf[1]+buf[2+buf[1]]+3) != buf[1] + buf[2+buf[1]]+3)
-    return errno;
-#endif
-  return 0;
-}
-
-int icq_TCPLinkProxyAuthStatus(icq_TCPLink *plink)
-{
-  int res;
-  char buf[20];
-
-  plink->mode = (plink->mode & (~TCP_LINK_SOCKS_AUTHSTATUS)) | TCP_LINK_SOCKS_CROSSCONNECT;
-#ifdef _WIN32
-  res = recv(plink->socket, buf, 2, 0);
-#else
-  res = read(plink->socket, buf, 2);
-#endif
-  if(res != 2 || buf[0] != 1 || buf[1] != 0)
-  {
-    icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Authorization failure\n");
-    icq_SocketDelete(plink->socket);
-    return -1;
-  }
-  return 0;
-}
-
-int icq_TCPLinkProxyNoAuthStatus(icq_TCPLink *plink)
-{
-  int res;
-  char buf[20];
-
-  plink->mode = (plink->mode & (~TCP_LINK_SOCKS_NOAUTHSTATUS)) | TCP_LINK_SOCKS_CROSSCONNECT;
-#ifdef _WIN32
-  res = recv(plink->socket, buf, 2, 0);
-#else
-  res = read(plink->socket, buf, 2);
-#endif
-  if(res != 2 || buf[0] != 5 || buf[1] != 0) /* no authentication required */
-  {
-    icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Authentication method incorrect\n");
-    icq_SocketDelete(plink->socket);
-    return -1;
-  }
-  return 0;
-}
-
-int icq_TCPLinkProxyCrossConnect(icq_TCPLink *plink)
-{
-  char buf[20];
-
-  plink->mode = (plink->mode & ~(TCP_LINK_SOCKS_CROSSCONNECT)) | TCP_LINK_SOCKS_CONNSTATUS;
-  buf[0] = 5; /* protocol version */
-  buf[1] = 1; /* command connect */
-  buf[2] = 0; /* reserved */
-  buf[3] = 1; /* address type IP v4 */
-  memcpy(&buf[4], &plink->remote_address.sin_addr.s_addr, 4);
-  memcpy(&buf[8], &plink->remote_address.sin_port, 2);
-#ifdef _WIN32
-  if(send(plink->socket, buf, 10, 0) != 10)
-    return errno;
-#else
-  if(write(plink->socket, buf, 10) != 10)
-    return errno;
-#endif
-  return 0;
-}
-
-int icq_TCPLinkProxyConnectStatus(icq_TCPLink *plink)
-{
-  int res;
-  char buf[1024];
-
-  plink->mode = (plink->mode & (~TCP_LINK_SOCKS_CONNSTATUS));
-#ifdef _WIN32
-  res = recv(plink->socket, buf, 10, 0);
-#else
-  res = read(plink->socket, buf, 10);
-#endif
-  if(res != 10 || buf[0] != 5 || buf[1] != 0)
-  {
-    switch(buf[1])
-    {
-      case 1:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] General SOCKS server failure\n");
-        res = EFAULT;
-        break;
-      case 2:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection not allowed by ruleset\n");
-        res = EACCES;
-        break;
-      case 3:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Network unreachable\n");
-        res = ENETUNREACH;
-        break;
-      case 4:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Host unreachable\n");
-        res = ENETUNREACH;
-        break;
-      case 5:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Connection refused\n");
-        res = ECONNREFUSED;
-        break;
-      case 6:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] TTL expired\n");
-        res = ETIMEDOUT;
-        break;
-      case 7:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Command not supported\n");
-        res = EOPNOTSUPP;
-        break;
-      case 8:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Address type not supported\n");
-        res = EAFNOSUPPORT;
-        break;
-      default:
-        icq_FmtLog(plink->icqlink, ICQ_LOG_FATAL, "[SOCKS] Unknown SOCKS server failure\n");
-        res = EFAULT;
-        break;
-    }
-    icq_SocketDelete(plink->socket);
-    return res;
-  }
-  return 0;
-}
-
-int icq_TCPLinkConnect(icq_TCPLink *plink, DWORD uin, int port)
-{
-  icq_ContactItem *pcontact=icq_ContactFind(plink->icqlink, uin);
-  icq_Packet *p;
-  int result;
-
-#ifndef _WIN32
-  int flags;
-#else
-  u_long iosflag;
-#endif
-
-  /* these return values never and nowhere checked */
-  /*                                   denis.      */
-  if(!pcontact)
-    return -2;
-
-  if((plink->socket=icq_SocketNew(AF_INET, SOCK_STREAM, 0)) < 0)
-    return -3;
-
-/*   bzero(&(plink->remote_address), sizeof(plink->remote_address));   Win32 incompatible... */
-  memset(&(plink->remote_address), 0, sizeof(plink->remote_address));
-  plink->remote_address.sin_family = AF_INET;
-
-  /* if our IP is the same as the remote user's ip, connect to real_ip
-     instead since we're both probably behind a firewall */
-  icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE,
-    "local IP is %08X:%d, remote real IP is %08X:%d, remote IP is %08X:%d, port is %d\n",
-    plink->icqlink->icq_OurIP,
-    plink->icqlink->icq_OurPort,
-    pcontact->remote_real_ip,
-    pcontact->remote_port,
-    pcontact->remote_ip,
-    pcontact->remote_port,
-    port
-    );
-  if (plink->icqlink->icq_OurIP == pcontact->remote_ip) 
-    plink->remote_address.sin_addr.s_addr = htonl(pcontact->remote_real_ip);
-  else 
-    plink->remote_address.sin_addr.s_addr = htonl(pcontact->remote_ip);
-
-  if(plink->type==TCP_LINK_MESSAGE)
-  {
-    plink->remote_address.sin_port = htons(pcontact->remote_port);
-    icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, 
-      "initiating message connect to %d (%s:%d)\n", uin, 
-      inet_ntoa(*((struct in_addr *)(&(plink->remote_address.sin_addr)))),
-      pcontact->remote_port);
-  }
-  else
-  {
-  plink->remote_address.sin_port = htons(port);
-    icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE, 
-      "initiating file/chat connect to %d (%s:%d)\n", uin, 
-      inet_ntoa(*((struct in_addr *)(&(plink->remote_address.sin_addr)))),
-      port);
-  }
-
-  /* set the socket to non-blocking */
-#ifdef _WIN32
-  iosflag = TRUE;
-  ioctlsocket(plink->socket, FIONBIO, &iosflag);
-#else
-  flags=fcntl(plink->socket, F_GETFL, 0);
-  fcntl(plink->socket, F_SETFL, flags | O_NONBLOCK);
-#endif
-
-  if(!plink->icqlink->icq_UseProxy)
-    result=connect(plink->socket, (struct sockaddr *)&(plink->remote_address),
-       sizeof(plink->remote_address));
-  else /* SOCKS proxy support */
-    result=icq_TCPLinkProxyConnect(plink, uin, port);
-  /* FIXME: Here we should check for errors on connection */
-  /* because of proxy support - it can't be checked       */
-  /* by getsockopt() later in _handle_ready_sockets()     */
-  /*                                  denis.              */
-
-  plink->mode|=TCP_LINK_MODE_CONNECTING;
-
-  plink->remote_uin=uin;
-
-  /* Send the hello packet */
-  p=icq_TCPCreateInitPacket(plink);
-  icq_TCPLinkSend(plink, p);
-
-#ifdef TCP_PACKET_TRACE
-  printf("hello packet queued for %lu\n", uin);
-#endif /* TCP_PACKET_TRACE */
-
-  icq_SocketSetHandler(plink->socket, ICQ_SOCKET_WRITE,
-    (icq_SocketHandler)icq_TCPLinkOnConnect, plink);
-  plink->connect_timeout=icq_TimeoutNew(TCP_LINK_CONNECT_TIMEOUT,
-    (icq_TimeoutHandler)icq_TCPLinkClose, plink);
-  
-  return 1;
-}
-
-icq_TCPLink *icq_TCPLinkAccept(icq_TCPLink *plink)
-{
-#ifdef _WIN32
-  u_long iosflag;
-#else
-  int flags;
-#endif
-  int socket_fd;
-  size_t remote_length;
-  icq_TCPLink *pnewlink=icq_TCPLinkNew(plink->icqlink);
-  
-  if(pnewlink)
-  {
-    remote_length = sizeof(struct sockaddr_in);
-    socket_fd=icq_SocketAccept(plink->socket,
-      (struct sockaddr *)&(plink->remote_address), &remote_length);
-
-    icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE,
-      "accepting tcp connection from %s:%d\n",
-      inet_ntoa(*((struct in_addr *)(&(plink->remote_address.sin_addr)))),
-      ntohs(plink->remote_address.sin_port));
-
-    /* FIXME: make sure accept succeeded */
-
-    pnewlink->type=plink->type;
-    pnewlink->socket=socket_fd;
-
-    /* first packet sent on an icq tcp link is always the hello packet */
-    pnewlink->mode|=TCP_LINK_MODE_HELLOWAIT;
-
-    /* install socket handler for new socket */
-    icq_SocketSetHandler(socket_fd, ICQ_SOCKET_READ, 
-      (icq_SocketHandler)icq_TCPLinkOnDataReceived, pnewlink);
-  }
-
-  /* set the socket to non-blocking */
-#ifdef _WIN32
-  iosflag = TRUE;
-  ioctlsocket(pnewlink->socket, FIONBIO, &iosflag);
-#else
-  flags=fcntl(pnewlink->socket, F_GETFL, 0);
-  fcntl(pnewlink->socket, F_SETFL, flags | O_NONBLOCK);
-#endif
-  
-  return pnewlink;
-}
-
-int icq_TCPLinkListen(icq_TCPLink *plink)
-{
-  unsigned int t;
-
-  /* listening links have 0 uin */
-  plink->remote_uin=0;
-
-  /* create tcp listen socket */
-  if((plink->socket=icq_SocketNew(AF_INET, SOCK_STREAM, 0)) < 0)
-    return -1;
-
-  /* must use memset, no bzero for Win32! */
-  memset(&plink->socket_address, 0, sizeof(struct sockaddr_in));
-  plink->socket_address.sin_family=AF_INET;
-  plink->socket_address.sin_addr.s_addr=htonl(INADDR_ANY);
-  plink->socket_address.sin_port=0;
-
-  if(bind(plink->socket, (struct sockaddr *)&plink->socket_address, sizeof(struct sockaddr_in)) < 0)
-    return -2;
-
-  if(listen(plink->socket, 5) < 0)
-    return -3;
-
-  t=sizeof(struct sockaddr_in);
-  if(getsockname(plink->socket, (struct sockaddr *)&plink->socket_address, &t) < 0)
-    return -4;
-
-  icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE,
-             "created tcp listening socket %d, local address=%s:%d\n",
-             plink->socket,
-             inet_ntoa(*((struct in_addr *)(&plink->socket_address.sin_addr))),
-             ntohs(plink->socket_address.sin_port));
-
-  plink->mode|=TCP_LINK_MODE_LISTEN;
-
-  icq_SocketSetHandler(plink->socket, ICQ_SOCKET_READ, (icq_SocketHandler)icq_TCPLinkAccept,
-    plink);
-
-  return 0;
-}
-
-/* Doing Cyrillic translations for Chat dialog sessions */
-void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len)
-{
-  int i, j;
-  
-  for(i = j = 0; i < t_len; ++i)
-  {
-    if((((unsigned char)t_in[i]) < ' ') && (t_in[i] != '\r'))
-    {
-      if(i - 1 > j)
-        icq_RusConv_n(to, &t_in[j], i - j - 1);
-      switch(t_in[i])
-      {
-        case '\x07': /* Bell */
-        case '\x08': /* BackSpace */
-        case '\x03': /* Chat is active */
-        case '\x04': /* Chat is not active */
-             break;
-        case '\x00': /* Foregroung color (RR GG BB ?? ) */
-        case '\x01': /* Background color (RR GG BB ?? ) */
-        case '\x11': /* Font style change (Bold - 1, Italic - 2, Underline - 4) */
-        case '\x12': /* Font size change */
-             i += 4;
-             break;
-        case '\x10': /* Font family and encoding change */
-             i += t_in[i+1] + 2 + 2;
-             icq_RusConv_n(to, &t_in[i+3], t_in[i+1]);
-             break;
-      }
-      j = i + 1;
-    }
-  }
-  if(i > t_len)
-    i = t_len;
-  if(j > t_len)
-    j = t_len;
-  if(i > j)
-    icq_RusConv_n(to, &t_in[j], i - j);
-}
-
-void icq_TCPLinkOnDataReceived(icq_TCPLink *plink)
-{
-  int process_count=0, recv_result=0;
-  char *buffer=plink->buffer;
-
-  do { /* while recv_result > 0 */
-
-    int done=0;
-
-    /* append received data onto end of buffer */
-    if((recv_result=recv(plink->socket, buffer+plink->buffer_count,
-      icq_TCPLinkBufferSize-plink->buffer_count, 0)) < 1)
-    {
-      /* either there was an error or the remote side has closed 
-       * the connection - fall out of the loop */
-      continue;
-    };
-  
-    plink->buffer_count+=recv_result;
-
-#ifdef TCP_BUFFER_TRACE
-    printf("received %d bytes from link %x, new buffer count %d\n",
-      recv_result, plink, plink->buffer_count);
-
-    hex_dump(plink->buffer, plink->buffer_count);
-#endif /*TCP_BUFFER_TRACE*/
-
-    process_count+=recv_result;
-
-    /* don't do any packet processing if we're in raw mode */
-    if(plink->mode & TCP_LINK_MODE_RAW) {
-      /* notify the app with the new data */
-      if(plink->type == TCP_LINK_CHAT)
-        icq_ChatRusConv_n("wk", plink->buffer, plink->buffer_count);
-      invoke_callback(plink->icqlink, icq_ChatNotify)(plink->session,
-        CHAT_NOTIFY_DATA, plink->buffer_count, plink->buffer);
-      plink->buffer_count=0;
-      continue;
-    }
-
-    /* remove packets from the buffer until the buffer is empty
-     * or the remaining bytes do not equal a full packet */
-    while((unsigned)plink->buffer_count>sizeof(WORD) && !done)
-    {
-      WORD packet_size=(*((WORD *)buffer));
-
-      /* warn if the buffer is too small to hold the whole packet */
-      if(packet_size>icq_TCPLinkBufferSize-sizeof(WORD))
-      {
-        icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "tcplink buffer "
-          "overflow, packet size = %d, buffer size = %d, closing link\n",
-          packet_size, icq_TCPLinkBufferSize);
-        return;
-      }
-
-      if(packet_size+sizeof(WORD) <= (unsigned)plink->buffer_count)
-      {
-        /* copy the packet into memory */
-        icq_Packet *p=icq_PacketNew();
-        icq_PacketAppend(p, buffer+sizeof(WORD), packet_size);
-
-        /* remove it from the buffer */
-        memcpy(buffer, buffer+packet_size+sizeof(WORD),
-             plink->buffer_count-packet_size-sizeof(WORD));
-
-        plink->buffer_count-=(packet_size+sizeof(WORD));
-
-        icq_TCPLinkOnPacketReceived(plink, p);
-      }
-      else
-      {
-        /* not enough bytes in buffer to form the complete packet.
-         * we're done for now */
-        done=1;
-      }
-    } /* while packets remain in buffer */
-
-  } while (recv_result > 0);
-
-#ifdef _WIN32
-  if (recv_result <= 0 && WSAGetLastError()!=EWOULDBLOCK) {
-    /* receive error - log it */
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "recv failed from %d (%d),"
-      " closing link\n", plink->remote_uin, WSAGetLastError());
-#else
-  if (recv_result <= 0 && errno!=EWOULDBLOCK) {
-    /* receive error - log it */
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "recv failed from %d (%d-%s),"
-      " closing link\n", plink->remote_uin, errno, strerror(errno));
-#endif
-
-    icq_TCPLinkClose(plink);
-
-  } else {
-
-    icq_TCPLinkProcessReceived(plink);
-
-  }
-
-}
-
-void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p)
-{
-
-#ifdef TCP_RAW_TRACE
-  printf("packet received! { length=%d }\n", p->length);
-  icq_PacketDump(p);
-#endif
-
-  /* Stick packet on ready packet linked icq_List */
-  icq_ListEnqueue(plink->received_queue, p);
-}
-
-void icq_TCPLinkOnConnect(icq_TCPLink *plink)
-{
-#ifdef _WIN32
-  int len;
-#else
-  size_t len;
-#endif
-  int error;
-  
-  icq_TimeoutDelete(plink->connect_timeout);
-  plink->connect_timeout = NULL;
-
-  /* check getsockopt */
-  len=sizeof(error);
-
-#ifndef __BEOS__
-#ifdef _WIN32
-  getsockopt(plink->socket, SOL_SOCKET, SO_ERROR, (char *)&error, &len);
-#else
-  getsockopt(plink->socket, SOL_SOCKET, SO_ERROR, &error, &len);
-#endif
-#endif
-  if(!error && (plink->mode & (TCP_LINK_SOCKS_CONNECTING | TCP_LINK_SOCKS_AUTHORIZATION |
-                               TCP_LINK_SOCKS_AUTHSTATUS | TCP_LINK_SOCKS_NOAUTHSTATUS |
-                               TCP_LINK_SOCKS_CROSSCONNECT | TCP_LINK_SOCKS_CONNSTATUS)))
-  {
-    if(plink->mode & TCP_LINK_SOCKS_CONNECTING)
-       error = icq_TCPLinkProxyRequestAuthorization(plink);
-    else if(plink->mode & TCP_LINK_SOCKS_AUTHORIZATION)
-      error = icq_TCPLinkProxyAuthorization(plink);
-    else if(plink->mode & TCP_LINK_SOCKS_AUTHSTATUS)
-      error = icq_TCPLinkProxyAuthStatus(plink);
-    else if(plink->mode & TCP_LINK_SOCKS_NOAUTHSTATUS)
-      error = icq_TCPLinkProxyNoAuthStatus(plink);
-    else if(plink->mode & TCP_LINK_SOCKS_CROSSCONNECT)
-      error = icq_TCPLinkProxyCrossConnect(plink);
-    else if(plink->mode & TCP_LINK_SOCKS_CONNSTATUS)
-      error = icq_TCPLinkProxyConnectStatus(plink);
-    else
-      error = EINVAL;
-  }
-
-  if(error)
-  {
-    /* connection failed- close the link, which takes care
-     * of notifying the app about packets that didn't make it */
-    icq_FmtLog(plink->icqlink, ICQ_LOG_WARNING, "connect failed to %d (%d-%s),"
-       " closing link\n", plink->remote_uin, error, strerror(error));
-
-    icq_TCPLinkClose(plink);
-    return;
-  }
-
-  if(plink->mode & (TCP_LINK_SOCKS_CONNECTING | TCP_LINK_SOCKS_AUTHORIZATION | TCP_LINK_SOCKS_AUTHSTATUS | TCP_LINK_SOCKS_NOAUTHSTATUS | TCP_LINK_SOCKS_CROSSCONNECT | TCP_LINK_SOCKS_CONNSTATUS))
-  {
-    icq_SocketSetHandler(plink->socket, ICQ_SOCKET_WRITE, NULL, NULL);
-    icq_SocketSetHandler(plink->socket, ICQ_SOCKET_READ, 
-      (icq_SocketHandler)icq_TCPLinkOnConnect, plink);
-    return;
-  }
-
-  len=sizeof(plink->socket_address);
-  getsockname(plink->socket, (struct sockaddr *)&plink->socket_address, &len);
-
-  icq_FmtLog(plink->icqlink, ICQ_LOG_MESSAGE,
-             "connected to uin %d, socket=%d local address=%s:%d remote address=%s:%d\n",
-             plink->remote_uin, plink->socket,
-             inet_ntoa(*((struct in_addr *)(&plink->socket_address.sin_addr))),
-             ntohs(plink->socket_address.sin_port),
-             inet_ntoa(*((struct in_addr *)(&plink->remote_address.sin_addr))),
-             ntohs(plink->remote_address.sin_port));
-
-  plink->mode&= ~TCP_LINK_MODE_CONNECTING;
-
-  icq_SocketSetHandler(plink->socket, ICQ_SOCKET_READ, 
-    (icq_SocketHandler)icq_TCPLinkOnDataReceived, plink);
-  icq_SocketSetHandler(plink->socket, ICQ_SOCKET_WRITE, NULL, NULL);
-
-  /* socket is now connected, notify each request that connection
-   * has been established and send pending data */
-  while(plink->send_queue->count>0)
-  {
-    icq_Packet *p=icq_ListDequeue(plink->send_queue);
-    if(p->id)
-      if(plink->icqlink->icq_RequestNotify)
-        (*plink->icqlink->icq_RequestNotify)(plink->icqlink, p->id, ICQ_NOTIFY_CONNECTED, 0, 0);
-    icq_TCPLinkSend(plink, p);
-  }
-
-  /* yeah this probably shouldn't be here.  oh well :) */
-  if(plink->type==TCP_LINK_CHAT)
-  {
-    icq_ChatSessionSetStatus((icq_ChatSession *)plink->session,
-      CHAT_STATUS_CONNECTED);
-    icq_ChatSessionSetStatus((icq_ChatSession *)plink->session, 
-      CHAT_STATUS_WAIT_ALLINFO);
-  }
-
-  if(plink->type==TCP_LINK_FILE)
-  {
-    icq_FileSessionSetStatus((icq_FileSession *)plink->session,
-      FILE_STATUS_CONNECTED);
-  }
-
-}
-
-unsigned long icq_TCPLinkSendSeq(icq_TCPLink *plink, icq_Packet *p,
-  unsigned long sequence)
-{
-  /* append the next sequence number on the packet */
-  if (!sequence)
-    sequence=plink->icqlink->d->icq_TCPSequence--;
-  p->id=sequence;
-  icq_PacketEnd(p);
-  icq_PacketAppend32(p, sequence);
-
-  /* if the link is currently connecting, queue the packets for
-   * later, else send immediately */
-  if(plink->mode & TCP_LINK_MODE_CONNECTING) {
-    icq_ListInsert(plink->send_queue, 0, p);
-    if(plink->icqlink->icq_RequestNotify)
-      (*plink->icqlink->icq_RequestNotify)(plink->icqlink, p->id, ICQ_NOTIFY_CONNECTING, 0, 0);
-  } else {
-    icq_PacketSend(p, plink->socket);
-    if(p->id)
-      if(plink->icqlink->icq_RequestNotify)
-        (*plink->icqlink->icq_RequestNotify)(plink->icqlink, p->id, ICQ_NOTIFY_SENT, 0, 0);
-    icq_PacketDelete(p);
-  }
-  return sequence;
-}
-
-void icq_TCPLinkSend(icq_TCPLink *plink, icq_Packet *p)
-{
-  /* if the link is currently connecting, queue the packets for
-   * later, else send immediately */
-  if(plink->mode & TCP_LINK_MODE_CONNECTING) {
-    icq_ListInsert(plink->send_queue, 0, p);
-    if(plink->icqlink->icq_RequestNotify)
-      (*plink->icqlink->icq_RequestNotify)(plink->icqlink, p->id, ICQ_NOTIFY_CONNECTING, 0, 0);
-  } else {
-    icq_PacketSend(p, plink->socket);
-    if(p->id)
-      if(plink->icqlink->icq_RequestNotify)
-        (*plink->icqlink->icq_RequestNotify)(plink->icqlink, p->id, ICQ_NOTIFY_SENT, 0, 0);
-    icq_PacketDelete(p);
-  }
-}
-
-void icq_TCPLinkProcessReceived(icq_TCPLink *plink)
-{
-  icq_List *plist=plink->received_queue;
-  while(plist->count>0)
-
-  {
-    icq_Packet *p=icq_ListDequeue(plist);
-
-    if(plink->mode & TCP_LINK_MODE_HELLOWAIT)
-    {
-      icq_TCPProcessHello(p, plink);
-    }
-    else
-    {
-
-      switch (plink->type) {
-
-        case TCP_LINK_MESSAGE:
-          icq_TCPProcessPacket(p, plink);
-          break;
-
-        case TCP_LINK_CHAT:
-          icq_TCPProcessChatPacket(p, plink);
-          break;
-
-        case TCP_LINK_FILE:
-          icq_TCPProcessFilePacket(p, plink);
-          break;
-
-      }
-    }
-
-    icq_PacketDelete(p);
-  }
-
-}
-
-int _icq_FindTCPLink(void *p, va_list data)
-{
-  icq_TCPLink *plink=(icq_TCPLink *)p;
-  unsigned long uin=va_arg(data, unsigned long);
-  int type=va_arg(data, int);
-
-  return ( (plink->remote_uin == uin ) && (plink->type == type) );
-}
-
-icq_TCPLink *icq_FindTCPLink(icq_Link *icqlink, unsigned long uin, int type)
-{
-  return icq_ListTraverse(icqlink->d->icq_TCPLinks, _icq_FindTCPLink, uin, type);
-}
--- a/src/protocols/icq/tcplink.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,120 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: tcplink.h 8967 2004-02-12 19:54:18Z hermanator $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _TCP_LINK_H_
-#define _TCP_LINK_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#ifndef _WIN32
-#include <sys/socket.h>
-#include <netinet/in.h>
-#else
-#include "libc_interface.h"
-#endif
-
-#include "icq.h"
-#include "icqpacket.h"
-#include "timeout.h"
-
-/* link mode bitfield values */
-#define TCP_LINK_MODE_RAW             1
-#define TCP_LINK_MODE_HELLOWAIT       2
-#define TCP_LINK_MODE_LISTEN          4
-#define TCP_LINK_MODE_CONNECTING      8
-#define TCP_LINK_SOCKS_CONNECTING     16
-#define TCP_LINK_SOCKS_AUTHORIZATION  32
-#define TCP_LINK_SOCKS_AUTHSTATUS     64
-#define TCP_LINK_SOCKS_NOAUTHSTATUS   128
-#define TCP_LINK_SOCKS_CROSSCONNECT   256
-#define TCP_LINK_SOCKS_CONNSTATUS     512
-
-/* link types */
-#define TCP_LINK_MESSAGE              1
-#define TCP_LINK_CHAT                 2
-#define TCP_LINK_FILE                 3
-
-#define icq_TCPLinkBufferSize 4096
-#define TCP_LINK_CONNECT_TIMEOUT 30
-
-struct icq_TCPLink_s {
-
-   /* icq_TCPLink ICQLINK, type, mode, and session */
-   icq_Link *icqlink;
-   int type;
-   int mode;
-   int proxy_status;
-   void *session;
-	 
-   /* socket parameters */
-   int socket;
-   struct sockaddr_in socket_address;
-   struct sockaddr_in remote_address;
-
-   /* data buffer for receive calls */
-   char buffer[icq_TCPLinkBufferSize];
-   int buffer_count;
-
-   /* packet queues */
-   icq_List *received_queue;
-   icq_List *send_queue;
-
-   /* icq specific data, initialized by hello packet */
-   unsigned long id;
-   unsigned long remote_version;
-   unsigned long remote_uin;
-   char flags;
-
-   /* timeout for connect operation */
-   icq_Timeout *connect_timeout;
-
-};
-
-icq_TCPLink *icq_TCPLinkNew(icq_Link *icqlink);
-void icq_TCPLinkDelete(void *p);
-void icq_TCPLinkClose(icq_TCPLink *p);
-void icq_TCPLinkNodeDelete(icq_ListNode *p);
-
-int icq_TCPLinkConnect(icq_TCPLink *plink, DWORD uin, int port);
-icq_TCPLink *icq_TCPLinkAccept(icq_TCPLink *plink);
-int icq_TCPLinkListen(icq_TCPLink *plink);
-
-void icq_TCPLinkOnDataReceived(icq_TCPLink *plink);
-void icq_TCPLinkOnPacketReceived(icq_TCPLink *plink, icq_Packet *p);
-void icq_TCPLinkOnConnect(icq_TCPLink *plink);
-void icq_TCPLinkOnConnectTimeout(icq_TCPLink *plink);
-
-unsigned long icq_TCPLinkSendSeq(icq_TCPLink *plink, icq_Packet *p,
-  unsigned long sequence);
-void icq_TCPLinkSend(icq_TCPLink *plink, icq_Packet *p);
-
-void icq_TCPLinkProcessReceived(icq_TCPLink *plink);
-
-icq_TCPLink *icq_FindTCPLink(icq_Link *icqlink, unsigned long uin, int type);
-
-void icq_ChatRusConv_n(const char to[4], char *t_in, int t_len);
-
-#endif /* _TCP_LINK_H_ */
--- a/src/protocols/icq/timeout.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,173 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: timeout.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "timeout.h"
-
-icq_Timeout *icq_CurrentTimeout = NULL;
-icq_List *icq_TimeoutList = NULL;
-
-void (*icq_SetTimeout)(long length);
-
-int icq_TimeoutCompare(icq_Timeout *t1, icq_Timeout *t2)
-{
-  return (t1->expire_time - t2->expire_time);
-}
-
-icq_Timeout *icq_TimeoutNew(int length, icq_TimeoutHandler handler, 
-  void *data)
-{
-  icq_Timeout *t = (icq_Timeout *)malloc(sizeof(icq_Timeout));
-
-  if (t)
-  {
-    int count = icq_TimeoutList->count;
-
-    t->length = length;
-    t->handler = handler;
-    t->data = data;
-    t->expire_time = time(NULL) + length;
-    t->single_shot = 1;
-
-    icq_ListInsertSorted(icq_TimeoutList, t);
-
-    if (count == 0)
-      icq_TimeoutDoNotify();
-  }
-
-  return t;
-}
-
-void icq_TimeoutDelete(icq_Timeout *timeout)
-{
-  icq_ListRemove(icq_TimeoutList, timeout);
-
-  /* if this was the timeout we were currently waiting on, move on
-   * to the next */
-  if (icq_CurrentTimeout == timeout)
-  {
-    icq_CurrentTimeout = NULL;
-    icq_TimeoutDoNotify();
-  }
-
-  free(timeout);
-}
-
-int _icq_HandleTimeout1(void *p, va_list data)
-{
-  icq_Timeout *t = p;
-  int complete = 0;
-  time_t current_time = va_arg(data, time_t);
-  icq_List *expired_timeouts = va_arg(data, icq_List *);
-  (void)data;
-
-  if (t->expire_time <= current_time)
-    icq_ListEnqueue(expired_timeouts, t);
-  else
-    /* traversal is complete when we reach an expire time in the future */
-    complete = 1;
-
-  return complete;
-}
-
-int _icq_HandleTimeout2(void *p, va_list data)
-{
-  icq_Timeout *t = p;
-  (void)data;
-
-  /* maybe a previously executed timeout caused us to be deleted, so
-   * make sure we're still around */
-  if (icq_ListFind(icq_TimeoutList, t))
-    (t->handler)(t->data);
-
-  return 0; /* traverse entire list */
-}
-
-int _icq_HandleTimeout3(void *p, va_list data)
-{
-  icq_Timeout *t = p;
-  int complete = 0;
-  time_t current_time = va_arg(data, time_t);
-
-  if (t->expire_time <= current_time)
-  {
-    if (t->single_shot)
-      icq_TimeoutDelete(t);
-    else
-      t->expire_time = current_time + t->length;
-  }
-  else
-    /* traversal is complete when we reach an expire time in the future */
-    complete = 1;
-
-  return complete;
-}
-
-void icq_HandleTimeout()
-{
-  time_t current_time = time(NULL);
-  icq_List *expired_timeouts = icq_ListNew();
-
-  icq_CurrentTimeout = NULL;
-
-  /* these three operations must be split up for the case where a
-   * timeout function causes timers to be deleted - this ensures
-   * we don't try to free any timers that have already been removed
-   * or corrupt the list traversal process */
-
-  /* determine which timeouts that have expired */
-  icq_ListTraverse(icq_TimeoutList, _icq_HandleTimeout1, current_time,
-    expired_timeouts);
-
-  /* call handler function for expired timeouts */
-  icq_ListTraverse(expired_timeouts, _icq_HandleTimeout2);
-
-  /* delete any expired timeouts */
-  icq_ListTraverse(icq_TimeoutList, _icq_HandleTimeout3, current_time);
-
-  /* if there's any timeouts left, notify the library client */
-  if (icq_TimeoutList->count)
-    icq_TimeoutDoNotify();
-
-  icq_ListDelete(expired_timeouts, NULL);
-}
-
-void icq_TimeoutDoNotify()
-{
-  time_t length, current_time = time(NULL);
-
-  if (!icq_TimeoutList->count)
-  {
-    if (icq_SetTimeout)
-      (*icq_SetTimeout)(0);
-    return;
-  }
-
-  icq_CurrentTimeout = (icq_Timeout *)icq_ListFirst(icq_TimeoutList);
-  length = icq_CurrentTimeout->expire_time - current_time;
-
-  if (icq_SetTimeout)
-    (*icq_SetTimeout)(length);
-}
--- a/src/protocols/icq/timeout.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,59 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: timeout.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _TIMEOUTMANAGER_H
-#define _TIMEOUTMANAGER_H
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <time.h>
-
-#include "list.h"
-
-typedef struct icq_Timeout_s icq_Timeout;
-typedef void (*icq_TimeoutHandler)(void *data);
-
-struct icq_Timeout_s
-{
-  time_t expire_time;
-  int length;
-  int single_shot;
-
-  icq_TimeoutHandler handler;
-  void *data;
-};
-
-int icq_TimeoutCompare(icq_Timeout *t1, icq_Timeout *t2);
-icq_Timeout *icq_TimeoutNew(int length, icq_TimeoutHandler handler, 
-  void *data);
-void icq_TimeoutDelete(icq_Timeout *timeout);
-
-void icq_HandleTimeout();
-void icq_TimeoutDoNotify();
-
-extern icq_List *icq_TimeoutList;
-
-#endif /* _TIMEOUTMANAGER_H */
--- a/src/protocols/icq/udp.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,670 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: udp.c 9490 2004-04-21 01:34:26Z chipx86 $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifdef _WIN32
-#include <winsock.h>
-#endif
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-#include "udp.h"
-#include "queue.h"
-
-#include "stdpackets.h"
-#include "icqbyteorder.h"
-
-#include "contacts.h"
-
-static const BYTE icq_UDPTable[] = {
-  0x59, 0x60, 0x37, 0x6B, 0x65, 0x62, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x60, 0x57, 0x5B, 0x3D,
-  0x5E, 0x34, 0x6D, 0x36, 0x50, 0x3F, 0x6F, 0x67, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x47, 0x63, 0x39,
-  0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x43, 0x69, 0x48, 0x33, 0x31, 0x64, 0x35, 0x5A, 0x4A, 0x42,
-  0x56, 0x40, 0x67, 0x53, 0x41, 0x07, 0x6C, 0x49, 0x58, 0x3B, 0x4D, 0x46, 0x68, 0x43, 0x69, 0x48,
-  0x33, 0x31, 0x44, 0x65, 0x62, 0x46, 0x48, 0x53, 0x41, 0x07, 0x6C, 0x69, 0x48, 0x33, 0x51, 0x54,
-  0x5D, 0x4E, 0x6C, 0x49, 0x38, 0x4B, 0x55, 0x4A, 0x62, 0x46, 0x48, 0x33, 0x51, 0x34, 0x6D, 0x36,
-  0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F, 0x47, 0x63, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64, 0x35, 0x5A,
-  0x6A, 0x52, 0x6E, 0x3C, 0x51, 0x34, 0x6D, 0x36, 0x50, 0x5F, 0x5F, 0x3F, 0x4F, 0x37, 0x4B, 0x35,
-  0x5A, 0x4A, 0x62, 0x66, 0x58, 0x3B, 0x4D, 0x66, 0x58, 0x5B, 0x5D, 0x4E, 0x6C, 0x49, 0x58, 0x3B,
-  0x4D, 0x66, 0x58, 0x3B, 0x4D, 0x46, 0x48, 0x53, 0x61, 0x4C, 0x59, 0x40, 0x67, 0x33, 0x31, 0x64,
-  0x55, 0x6A, 0x32, 0x3E, 0x44, 0x45, 0x52, 0x6E, 0x3C, 0x31, 0x64, 0x55, 0x6A, 0x52, 0x4E, 0x6C,
-  0x69, 0x48, 0x53, 0x61, 0x4C, 0x39, 0x30, 0x6F, 0x47, 0x63, 0x59, 0x60, 0x57, 0x5B, 0x3D, 0x3E,
-  0x64, 0x35, 0x3A, 0x3A, 0x5A, 0x6A, 0x52, 0x4E, 0x6C, 0x69, 0x48, 0x53, 0x61, 0x6C, 0x49, 0x58,
-  0x3B, 0x4D, 0x46, 0x68, 0x63, 0x39, 0x50, 0x5F, 0x5F, 0x3F, 0x6F, 0x67, 0x53, 0x41, 0x25, 0x41,
-  0x3C, 0x51, 0x54, 0x3D, 0x5E, 0x54, 0x5D, 0x4E, 0x4C, 0x39, 0x50, 0x5F, 0x5F, 0x5F, 0x3F, 0x6F,
-  0x47, 0x43, 0x69, 0x48, 0x33, 0x51, 0x54, 0x5D, 0x6E, 0x3C, 0x31, 0x64, 0x35, 0x5A, 0x00, 0x00,
-};
-
-DWORD icq_UDPCalculateCheckCode(icq_Packet *p)
-{
-  DWORD num1, num2;
-  DWORD r1,r2;
-
-  num1 = p->data[8];
-  num1 <<= 8;
-  num1 += p->data[4];
-  num1 <<= 8;
-  num1 += p->data[2];
-  num1 <<= 8;
-  num1 += p->data[6];
-
-  r1 = 0x18 + (rand() % (p->length - 0x18));
-  r2 = rand() & 0xff;
-
-  num2 = r1;
-  num2 <<= 8;
-  num2 += p->data[r1];
-  num2 <<= 8;
-  num2 += r2;   
-  num2 <<= 8;
-  num2 += icq_UDPTable[r2];
-  num2 ^= 0xFF00FF;
-
-  return num1 ^ num2;
-}
-
-DWORD icq_UDPScramble(DWORD cc)
-{
-  DWORD a[5];
-
-  a[0] = cc & 0x0000001F;
-  a[1] = cc & 0x03E003E0;
-  a[2] = cc & 0xF8000400;
-  a[3] = cc & 0x0000F800;
-  a[4] = cc & 0x041F0000;
-
-  a[0] <<= 0x0C;
-  a[1] <<= 0x01;
-  a[2] >>= 0x0A;
-  a[3] <<= 0x10;
-  a[4] >>= 0x0F;
-
-  return a[0] + a[1] + a[2] + a[3] + a[4];
-}
-
-void icq_UDPEncode(icq_Packet *p, char *buffer)
-{
-  DWORD checkcode = icq_UDPCalculateCheckCode(p);
-  DWORD code1, code2, code3;
-  DWORD pos;
-  DWORD tmp;
-
-  memcpy(buffer, p->data, p->length);
-
-  tmp = htoicql(checkcode);
-  memcpy((buffer+0x14),&tmp,sizeof(DWORD));
-  code1 = p->length * 0x68656c6cL;
-  code2 = code1 + checkcode;
-  pos = 0x0A;
-
-  for(; pos < p->length; pos+=4)
-  {
-    DWORD data;
-    memcpy(&data, (p->data)+pos, sizeof(DWORD));
-    data = icqtohl(data);
-    code3 = code2 + icq_UDPTable[pos & 0xFF];
-    data ^= code3;
-    data = htoicql(data);
-    memcpy((buffer+pos),&data,sizeof(DWORD));
-  }
-  checkcode = icq_UDPScramble(checkcode);
-  tmp = htoicql(checkcode);
-  memcpy((buffer+0x14),&tmp,sizeof(DWORD));
-}
-
-/*********************************************************
-icq_UDPSockWrite and icq_UDPSockRead are for _UDP_ packets
-proxy support for TCP sockets is different!
-*********************************************************/
-int icq_UDPSockWriteDirect(icq_Link *icqlink, icq_Packet *p)
-{
-  char tmpbuf[ICQ_PACKET_DATA_SIZE+10];
-
-  if(icqlink->icq_UDPSok <= 3)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad socket!\n");
-    return -1;
-  }
-
-  icq_UDPEncode(p, tmpbuf+10);
-
-  if(!icqlink->icq_UseProxy)
-  {
-#ifdef _WIN32
-    return send(icqlink->icq_UDPSok, tmpbuf+10, p->length, 0);
-#else
-    return write(icqlink->icq_UDPSok, tmpbuf+10, p->length);
-#endif
-  }
-  else
-  {
-    tmpbuf[0] = 0; /* reserved */
-    tmpbuf[1] = 0; /* reserved */
-    tmpbuf[2] = 0; /* standalone packet */
-    tmpbuf[3] = 1; /* address type IP v4 */
-    *(unsigned long*)&tmpbuf[4] = htonl(icqlink->icq_ProxyDestIP);
-    *(unsigned short*)&tmpbuf[8] = htons(icqlink->icq_ProxyDestPort);
-#ifdef _WIN32
-    return send(icqlink->icq_UDPSok, tmpbuf, p->length+10, 0)-10;
-#else
-    return write(icqlink->icq_UDPSok, tmpbuf, p->length+10)-10;
-#endif
-  }
-}
-
-int icq_UDPSockWrite(icq_Link *icqlink, icq_Packet *p)
-{
-  icq_UDPQueuePut(icqlink, p);
-
-  return icq_UDPSockWriteDirect(icqlink, p);
-}
-
-int icq_UDPSockRead(icq_Link *icqlink, icq_Packet *p)
-{
-  int res;
-  char tmpbuf[ICQ_PACKET_DATA_SIZE];
-
-  if(!icqlink->icq_UseProxy)
-  {
-#ifdef _WIN32
-    res = recv(icqlink->icq_UDPSok, p->data, ICQ_PACKET_DATA_SIZE, 0);
-#else
-    res = read(icqlink->icq_UDPSok, p->data, ICQ_PACKET_DATA_SIZE);
-#endif
-    p->length = res;
-    return res;
-  }
-  else
-  {
-#ifdef _WIN32
-    res = recv(icqlink->icq_UDPSok, tmpbuf, ICQ_PACKET_DATA_SIZE, 0);
-#else
-    res = read(icqlink->icq_UDPSok, tmpbuf, ICQ_PACKET_DATA_SIZE);
-#endif
-    if(res<0)
-      return res;
-    memcpy(p->data, &tmpbuf[10], res-10);
-    p->length = res-10;
-    return res-10;
-  }
-}
-
-/****************************************
-This must be called every 2 min.
-so the server knows we're still alive.
-JAVA client sends two different commands
-so we do also :)
-*****************************************/
-WORD icq_KeepAlive(icq_Link *icqlink) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_KEEP_ALIVE, icqlink->d->icq_UDPSeqNum1++);
-  icq_PacketAppend32(p, rand());
-  icq_UDPSockWriteDirect(icqlink, p); /* don't queue keep alive packets! */
-  icq_PacketDelete(p);
-
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Send Keep Alive packet to the server\n");
-
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-/**********************************
-This must be called to remove
-messages from the server
-***********************************/
-void icq_SendGotMessages(icq_Link *icqlink) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_ACK_MESSAGES);
-  icq_PacketAppend32(p, rand());
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/*************************************
-this sends over the contact list
-*************************************/
-void icq_SendContactList(icq_Link *icqlink) /* V5 */
-{
-  char num_used;
-  icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
-
-  while(ptr)
-  {
-    icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_CONT_LIST);
-
-    num_used = 0;
-    icq_PacketAdvance(p,1);
-    while(ptr && num_used<64)
-    {
-      icq_PacketAppend32(p, ptr->uin);
-      num_used++;
-      ptr = icq_ContactGetNext(ptr);
-    }
-    icq_PacketGotoUDPOutData(p, 0);
-    icq_PacketAppend8(p, num_used);
-    icq_UDPSockWrite(icqlink, p);
-  }
-}
-
-void icq_SendNewUser(icq_Link *icqlink, unsigned long uin) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_ADD_TO_LIST);
-  icq_PacketAppend32(p, uin);
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/*************************************
-this sends over the visible list
-that allows certain users to see you
-if you're invisible.
-*************************************/
-void icq_SendVisibleList(icq_Link *icqlink) /* V5 */
-{
-  char num_used;
-  icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_VIS_LIST);
-
-  num_used = 0;
-  icq_PacketAdvance(p,1);
-  while(ptr)
-  {
-    if(ptr->vis_list)
-    {
-      icq_PacketAppend32(p, ptr->uin);
-      num_used++;
-    }
-    ptr = icq_ContactGetNext(ptr);
-  }
-  if(num_used != 0)
-  {
-    icq_PacketGotoUDPOutData(p, 0);
-    icq_PacketAppend8(p, num_used);
-    icq_UDPSockWrite(icqlink, p);
-  }
-  else
-    icq_PacketDelete(p);
-}
-
-void icq_SendInvisibleList(icq_Link *icqlink) /* V5 */
-{
-  char num_used;
-  icq_ContactItem *ptr = icq_ContactGetFirst(icqlink);
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_INVIS_LIST);
-
-  num_used = 0;
-  icq_PacketAdvance(p,1);
-  while(ptr)
-  {
-    if(ptr->invis_list)
-    {
-      icq_PacketAppend32(p, ptr->uin);
-      num_used++;
-    }
-    ptr = icq_ContactGetNext(ptr);
-  }
-  if(num_used != 0)
-  {
-    icq_PacketGotoUDPOutData(p, 0);
-    icq_PacketAppend8(p, num_used);
-    icq_UDPSockWrite(icqlink, p);
-  }
-  else
-    icq_PacketDelete(p);
-}
-
-/**************************************
-This sends the second login command
-this is necessary to finish logging in.
-***************************************/
-void icq_SendLogin1(icq_Link *icqlink) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_LOGIN_1);
-  icq_PacketAppend32(p, rand());
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/************************************
-This procedure logins into the server with icq_Uin and pass
-on the socket icq_Sok and gives our ip and port.
-It does NOT wait for any kind of a response.
-*************************************/
-void icq_Login(icq_Link *icqlink, DWORD status) /* V5 */
-{
-  icq_Packet *p;
-
-  memset(icqlink->d->icq_UDPServMess, FALSE, sizeof(icqlink->d->icq_UDPServMess));
-  icqlink->d->icq_UDPSession = rand() & 0x3FFFFFFF;
-  icqlink->d->icq_UDPSeqNum1 = rand() & 0x7FFF;
-  icqlink->d->icq_UDPSeqNum2 = 1;
-
-  p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_LOGIN);
-  icq_PacketAppend32(p, time(0L));
-  icq_PacketAppend32n(p, icqlink->icq_TCPSrvPort);
-  /*icq_PacketAppend16(p, 0);
-  icq_PacketAppend16n(p, htons(icqlink->icq_OurPort));*/
-  icq_PacketAppendString(p, icqlink->icq_Password);
-  icq_PacketAppend32(p, LOGIN_X1_DEF);
-  if(icqlink->icq_UseTCP)
-  {
-    if(icqlink->icq_UseProxy)
-    {
-      icq_PacketAppend32n(p, htonl(icqlink->icq_ProxyIP));
-      icq_PacketAppend8(p, LOGIN_SNDONLY_TCP);
-    }
-    else
-    {
-      icq_PacketAppend32n(p, htonl(icqlink->icq_OurIP));
-      icq_PacketAppend8(p, LOGIN_SNDRCV_TCP);
-    }
-  }
-  else
-  {
-    icq_PacketAppend32n(p, htonl(icqlink->icq_ProxyIP));
-    icq_PacketAppend8(p, LOGIN_NO_TCP);
-  }
-  icq_PacketAppend32(p, status);
-  icq_PacketAppend32(p, LOGIN_X3_DEF);
-  icq_PacketAppend32(p, LOGIN_X4_DEF);
-  icq_PacketAppend32(p, LOGIN_X5_DEF);
-
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/**********************
-Logs off ICQ
-***********************/
-void icq_Logout(icq_Link *icqlink) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_SEND_TEXT_CODE, icqlink->d->icq_UDPSeqNum1++);
-  icq_PacketAppendString(p, "B_USER_DISCONNECTED");
-  icq_PacketAppend8(p, 5);
-  icq_PacketAppend8(p, 0);
-  icq_UDPSockWriteDirect(icqlink, p); /* don't queue */
-  icq_PacketDelete(p);
-}
-
-/*******************************
-This routine sends the acknowlegement cmd to the
-server it appears that this must be done after
-everything the server sends us
-*******************************/
-void icq_UDPAck(icq_Link *icqlink, int seq) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_ACK, seq);
-  icq_PacketAppend32(p, rand());
-
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Acking\n");
-  icq_UDPSockWriteDirect(icqlink, p);
-  icq_PacketDelete(p);
-}
-
-/***************************************************
-Sends a message thru the server to uin.  Text is the
-message to send.
-***************************************************/
-WORD icq_UDPSendMessage(icq_Link *icqlink, DWORD uin, const char *text) /* V5 */
-{
-  char buf[ICQ_MAX_UDP_MESSAGE_SIZE];
-  icq_Packet *p;
-
-  strncpy(buf, text, sizeof(buf));
-  buf[sizeof(buf)-1] = 0;
-  icq_RusConv("kw", buf);
-
-  p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
-  icq_PacketAppend32(p, uin);
-  icq_PacketAppend16(p, TYPE_MSG);
-  icq_PacketAppendString(p, buf);
-
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-WORD icq_UDPSendURL(icq_Link *icqlink, DWORD uin, const char *url, const char *descr) /* V5 */
-{
-  char buf1[ICQ_MAX_UDP_MESSAGE_SIZE], buf2[ICQ_MAX_UDP_MESSAGE_SIZE];
-  icq_Packet *p;
-
-  strncpy(buf1, descr, sizeof(buf1));
-  buf1[sizeof(buf1)-1] = 0;
-  icq_RusConv("kw", buf1);
-  strncpy(buf2, url, sizeof(buf2));
-  buf2[sizeof(buf2)-1] = 0;
-
-  p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
-  icq_PacketAppend32(p, uin);
-  icq_PacketAppend16(p, TYPE_URL);
-  icq_PacketAppend16(p, strlen(buf1)+strlen(buf2)+2); /* length + the NULL + 0xFE delimiter */
-  icq_PacketAppendStringFE(p, buf1);
-  icq_PacketAppendString0(p, buf2);
-
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-/**************************************************
-Sends a authorization to the server so the Mirabilis
-client can add the user.
-***************************************************/
-WORD icq_SendAuthMsg(icq_Link *icqlink, DWORD uin) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEND_THRU_SRV);
-  icq_PacketAppend32(p, uin);
-  icq_PacketAppend32(p, TYPE_AUTH);
-  icq_PacketAppend16(p, 0);
-  icq_UDPSockWrite(icqlink, p);
-
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-/**************************************************
-Changes the users status on the server
-***************************************************/
-void icq_ChangeStatus(icq_Link *icqlink, DWORD status) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_STATUS_CHANGE);
-  icq_PacketAppend32(p, status);
-  icqlink->icq_Status = status;
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/********************************************************
-Sends a request to the server for info on a specific user
-*********************************************************/
-WORD icq_SendInfoReq(icq_Link *icqlink, DWORD uin) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_INFO_REQ);
-  icq_PacketAppend32(p, uin);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-/********************************************************
-Sends a request to the server for info on a specific user
-*********************************************************/
-WORD icq_SendExtInfoReq(icq_Link *icqlink, DWORD uin) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_EXT_INFO_REQ);
-  icq_PacketAppend32(p, uin);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-/**************************************************************
-Initializes a server search for the information specified
-***************************************************************/
-void icq_SendSearchReq(icq_Link *icqlink, const char *email, const char *nick, const char *first,
-                       const char *last) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEARCH_USER);
-  icq_PacketAppendString(p, nick);
-  icq_PacketAppendString(p, first);
-  icq_PacketAppendString(p, last);
-  icq_PacketAppendString(p, email);
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/**************************************************************
-Initializes a server search for the information specified
-***************************************************************/
-void icq_SendSearchUINReq(icq_Link *icqlink, DWORD uin) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_SEARCH_UIN);
-  icq_PacketAppend32(p, uin);
-  icq_UDPSockWrite(icqlink, p);
-}
-
-/**************************************************
-Registers a new uin in the ICQ network
-***************************************************/
-void icq_RegNewUser(icq_Link *icqlink, const char *pass) /* V5 */
-{
-  char pass8[9];
-  icq_Packet *p = icq_UDPCreateStdSeqPacket(icqlink, UDP_CMD_REG_NEW_USER, icqlink->d->icq_UDPSeqNum1++);
-  strncpy(pass8, pass, 8);
-  icq_PacketAppendString(p, pass8);
-  icq_PacketAppend32(p, 0xA0);
-  icq_PacketAppend32(p, 0x2461);
-  icq_PacketAppend32(p, 0xA00000);
-  icq_PacketAppend32(p, 0x00);
-  icq_PacketGoto(p, 6);
-  icq_PacketAppend32(p, 0);
-  icq_PacketAppend32(p, rand());
-  icq_UDPSockWrite(icqlink, p);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Send RegNewUser packet to the server\n");
-}
-
-WORD icq_UpdateUserInfo(icq_Link *icqlink, const char *nick, const char *first, const char *last,
-                        const char *email) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_UPDATE_INFO);
-  icq_PacketAppendString(p, nick);
-  icq_PacketAppendString(p, first);
-  icq_PacketAppendString(p, last);
-  icq_PacketAppendString(p, email);
-/* auth (byte)? */
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-WORD icq_UpdateAuthInfo(icq_Link *icqlink, DWORD auth) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_UPDATE_AUTH);
-  icq_PacketAppend32(p, auth); /* NOT auth? */
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-WORD icq_UpdateMetaInfoSet(icq_Link *icqlink, const char *nick, const char *first, const char *last,
-                           const char *email, const char *email2, const char *email3,
-                           const char *city, const char *state, const char *phone, const char *fax,
-                           const char *street, const char *cellular, unsigned long zip,
-                           unsigned short cnt_code, unsigned char cnt_stat, unsigned char emailhide)
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
-  icq_PacketAppend16(p, META_CMD_SET_INFO);
-  icq_PacketAppendString(p, nick);
-  icq_PacketAppendString(p, first);
-  icq_PacketAppendString(p, last);
-  icq_PacketAppendString(p, email);
-  icq_PacketAppendString(p, email2);
-  icq_PacketAppendString(p, email3);
-  icq_PacketAppendString(p, city);
-  icq_PacketAppendString(p, state);
-  icq_PacketAppendString(p, phone);
-  icq_PacketAppendString(p, fax);
-  icq_PacketAppendString(p, street);
-  icq_PacketAppendString(p, cellular);
-  icq_PacketAppend32(p, zip);
-  icq_PacketAppend16(p, cnt_code);
-  icq_PacketAppend8(p, cnt_stat);
-  icq_PacketAppend8(p, emailhide);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum2-1;
-}
-
-WORD icq_UpdateMetaInfoHomepage(icq_Link *icqlink, unsigned char age, const char *homepage,
-                                unsigned char year, unsigned char month, unsigned char day,
-                                unsigned char lang1, unsigned char lang2, unsigned char lang3)
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
-  (void)lang1;
-  (void)lang2;
-  (void)lang3;
-  icq_PacketAppend16(p, META_CMD_SET_HOMEPAGE);
-  icq_PacketAppend8(p, age);
-  icq_PacketAppend16(p, 0x0200);
-  icq_PacketAppendString(p, homepage);
-  icq_PacketAppend8(p, year);
-  icq_PacketAppend8(p, month);
-  icq_PacketAppend8(p, day);
-  icq_PacketAppend8(p, 0xFF /* lang1 */);
-  icq_PacketAppend8(p, 0xFF /* lang2 */);
-  icq_PacketAppend8(p, 0xFF /* lang3 */);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum2-1;
-}
-
-WORD icq_UpdateMetaInfoAbout(icq_Link *icqlink, const char *about)
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
-  icq_PacketAppend16(p, META_CMD_SET_ABOUT);
-  icq_PacketAppendString(p, about);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum2-1;
-}
-
-WORD icq_UpdateMetaInfoSecurity(icq_Link *icqlink, unsigned char reqauth, unsigned char webpresence,
-                                unsigned char pubip)
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
-  icq_PacketAppend16(p, META_CMD_SET_SECURE);
-  icq_PacketAppend8(p, !reqauth);
-  icq_PacketAppend8(p, webpresence);
-  icq_PacketAppend8(p, pubip);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum2-1;
-}
-
-WORD icq_UpdateNewUserInfo(icq_Link *icqlink, const char *nick, const char *first, const char *last,
-                           const char *email) /* V5 */
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_NEW_USER_INFO);
-  icq_PacketAppendString(p, nick);
-  icq_PacketAppendString(p, first);
-  icq_PacketAppendString(p, last);
-  icq_PacketAppendString(p, email);
-  icq_PacketAppend8(p, 1);
-  icq_PacketAppend8(p, 1);
-  icq_PacketAppend8(p, 1);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum1-1;
-}
-
-WORD icq_SendMetaInfoReq(icq_Link *icqlink, unsigned long uin)
-{
-  icq_Packet *p = icq_UDPCreateStdPacket(icqlink, UDP_CMD_META_USER);
-  icq_PacketAppend16(p, META_CMD_REQ_INFO);
-  icq_PacketAppend32(p, uin);
-  icq_UDPSockWrite(icqlink, p);
-  return icqlink->d->icq_UDPSeqNum2-1;
-}
--- a/src/protocols/icq/udp.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,168 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: udp.h 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _UDP_H_
-#define _UDP_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "icq.h"
-#include "util.h"
-#include "icqpacket.h"
-
-#define UDP_CMD_ACK                0x000A 
-#define UDP_CMD_SEND_THRU_SRV      0x010E
-#define UDP_CMD_LOGIN              0x03E8
-#define UDP_CMD_CONT_LIST          0x0406
-#define UDP_CMD_SEARCH_UIN         0x041A
-#define UDP_CMD_SEARCH_USER        0x0424
-#define UDP_CMD_KEEP_ALIVE         0x042E
-#define UDP_CMD_KEEP_ALIVE2        0x051E
-#define UDP_CMD_SEND_TEXT_CODE     0x0438
-#define UDP_CMD_LOGIN_1            0x044C
-#define UDP_CMD_INFO_REQ           0x0460
-#define UDP_CMD_EXT_INFO_REQ       0x046A
-#define UDP_CMD_CHANGE_PW          0x049C
-#define UDP_CMD_STATUS_CHANGE      0x04D8
-#define UDP_CMD_LOGIN_2            0x0528
-#define UDP_CMD_UPDATE_INFO        0x050A
-#define UDP_CMD_UPDATE_AUTH        0x0514
-#define UDP_CMD_UPDATE_EXT_INFO    0x04B0
-#define UDP_CMD_ADD_TO_LIST        0x053C
-#define UDP_CMD_REQ_ADD_LIST       0x0456
-#define UDP_CMD_QUERY_SERVERS      0x04BA
-#define UDP_CMD_QUERY_ADDONS       0x04C4
-#define UDP_CMD_NEW_USER_1         0x04EC
-#define UDP_CMD_NEW_USER_INFO      0x04A6
-#define UDP_CMD_ACK_MESSAGES       0x0442
-#define UDP_CMD_MSG_TO_NEW_USER    0x0456
-#define UDP_CMD_REG_NEW_USER       0x03FC
-#define UDP_CMD_VIS_LIST           0x06AE
-#define UDP_CMD_INVIS_LIST         0x06A4
-#define UDP_CMD_META_USER          0x064A
-#define UDP_CMD_RAND_SEARCH        0x056E
-#define UDP_CMD_RAND_SET           0x0564
-#define UDP_CMD_REVERSE_TCP_CONN   0x015E
-
-#define UDP_SRV_ACK                0x000A
-#define UDP_SRV_LOGIN_REPLY        0x005A
-#define UDP_SRV_USER_ONLINE        0x006E
-#define UDP_SRV_USER_OFFLINE       0x0078
-#define UDP_SRV_USER_FOUND         0x008C
-#define UDP_SRV_OFFLINE_MESSAGE    0x00DC
-#define UDP_SRV_END_OF_SEARCH      0x00A0
-#define UDP_SRV_INFO_REPLY         0x0118
-#define UDP_SRV_EXT_INFO_REPLY     0x0122
-#define UDP_SRV_STATUS_UPDATE      0x01A4
-#define UDP_SRV_X1                 0x021C
-#define UDP_SRV_X2                 0x00E6
-#define UDP_SRV_UPDATE_OK          0x01E0
-#define UDP_SRV_UPDATE_FAIL        0x01EA
-#define UDP_SRV_UPDATE_EXT         0x00C8
-#define UDP_SRV_NEW_UIN            0x0046
-#define UDP_SRV_NEW_USER           0x00B4
-#define UDP_SRV_QUERY              0x0082
-#define UDP_SRV_SYSTEM_MESSAGE     0x01C2
-#define UDP_SRV_ONLINE_MESSAGE     0x0104
-#define UDP_SRV_GO_AWAY            0x00F0
-#define UDP_SRV_TRY_AGAIN          0x00FA
-#define UDP_SRV_FORCE_DISCONNECT   0x0028
-#define UDP_SRV_MULTI_PACKET       0x0212
-#define UDP_SRV_WRONG_PASSWORD     0x0064
-#define UDP_SRV_INVALID_UIN        0x012C
-#define UDP_SRV_META_USER          0x03DE
-#define UDP_SRV_RAND_USER          0x024E
-#define UDP_SRV_AUTH_UPDATE        0x01F4
-
-#define META_CMD_SET_INFO          1000
-#define META_CMD_SET_HOMEPAGE      1020
-#define META_CMD_SET_ABOUT         1030
-#define META_CMD_SET_SECURE        1060
-#define META_CMD_SET_PASS          1070
-#define META_CMD_REQ_INFO          1200
-#define META_SRV_RES_INFO          100
-#define META_SRV_RES_HOMEPAGE      120
-#define META_SRV_RES_ABOUT         130
-#define META_SRV_RES_SECURE        160
-#define META_SRV_RES_PASS          170
-#define META_SRV_USER_INFO         200
-#define META_SRV_USER_WORK         210
-#define META_SRV_USER_MORE         220
-#define META_SRV_USER_ABOUT        230
-#define META_SRV_USER_INTERESTS    240
-#define META_SRV_USER_AFFILIATIONS 250
-#define META_SRV_USER_HPCATEGORY   270
-#define META_SRV_USER_FOUND        410
-
-#define META_SRV_SUCCESS       10
-#define META_SRV_FAILURE       50
-
-#define TYPE_MSG               0x0001
-#define TYPE_CHAT              0x0002
-#define TYPE_FILE              0x0003
-#define TYPE_URL               0x0004
-#define TYPE_AUTH_REQ          0x0006
-#define TYPE_AUTH              0x0008
-#define TYPE_ADDED             0x000C
-#define TYPE_WEBPAGER          0x000D
-#define TYPE_EXPRESS           0x000E
-#define TYPE_CONTACT           0x0013
-#define TYPE_MASS_MASK         0x8000
-
-#define LOGIN_X1_DEF 0x00000098
-/*#define LOGIN_X1_DEF 0x000000D5*/
-#define LOGIN_X3_DEF 0x00000003
-/*#define LOGIN_X3_DEF 0x00000006*/
-#define LOGIN_X4_DEF 0x00000000
-#define LOGIN_X5_DEF 0x00980010
-/*#define LOGIN_X5_DEF 0x00D50008*/
-#define LOGIN_X6_DEF 0x00000050
-#define LOGIN_X7_DEF 0x00000003
-#define LOGIN_X8_DEF 0x00000000
-
-#define LOGIN_SNDONLY_TCP 0x02
-#define LOGIN_SNDRCV_TCP  0x04
-#define LOGIN_NO_TCP      0x06
-
-void icq_SendGotMessages(icq_Link *icqlink);
-void icq_SendLogin1(icq_Link *icqlink);
-void icq_StatusUpdate(icq_Link *icqlink, icq_Packet*);
-void icq_AckSrv(icq_Link *icqlink, int seq);
-void icq_HandleUserOffline(icq_Link *icqlink, icq_Packet*);
-void icq_HandleUserOnline(icq_Link *icqlink, icq_Packet*);
-void icq_DoMsg(icq_Link *icqlink, DWORD type, WORD len, char *data, DWORD uin,
-               BYTE hour, BYTE minute, BYTE day, BYTE month, WORD year);
-int icq_UDPSockWriteDirect(icq_Link *icqlink, icq_Packet*);
-int icq_UDPSockWrite(icq_Link *icqlink, icq_Packet*);
-int icq_UDPSockRead(icq_Link *icqlink, icq_Packet*);
-void icq_ServerResponse(icq_Link *icqlink, icq_Packet*);
-void icq_HandleMultiPacket(icq_Link *icqlink, icq_Packet*);
-
-void icq_UDPAck(icq_Link *icqlink, int seq);
-WORD icq_UDPSendMessage(icq_Link *icqlink, DWORD uin, const char *text);
-WORD icq_UDPSendURL(icq_Link *icqlink, DWORD uin, const char *url, const char *descr);
-
-#endif /* _UDP_H_ */
--- a/src/protocols/icq/udphandle.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,814 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: udphandle.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-
-#include "icqlib.h"
-#include "udp.h"
-#include "queue.h"
-#include "icqbyteorder.h"
-#include "contacts.h"
-
-void icq_DoMsg(icq_Link *icqlink, DWORD type, WORD len, char *data, DWORD uin, BYTE hour,
-               BYTE minute, BYTE day, BYTE month, WORD year)
-{
-  icq_List *strList;
-  int fieldCount;
-  int i, k, nr;
-  const char **contact_uin;
-  const char **contact_nick;
-  (void)len;
-
-  strList = icq_ListNew();
-  switch(type)
-  {
-    case TYPE_ADDED:
-      /* Format: Nick, 0xFE, FName, 0xFE, LName, 0xFE, EMail */
-      fieldCount = icq_SplitFields(strList, data);
-      if(fieldCount != 4 && fieldCount != 5)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad TYPE_ADDED packet (expected 4/5 args, received %i)!\n",
-                   fieldCount);
-        return;
-      }
-      icq_RusConv("wk", icq_ListAt(strList, 0)); /* Nick */
-      icq_RusConv("wk", icq_ListAt(strList, 1)); /* FName */
-      icq_RusConv("wk", icq_ListAt(strList, 2)); /* LName */
-      icq_RusConv("wk", icq_ListAt(strList, 3)); /* EMail */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "%lu has added you to their contact list, "
-                 "Nick: %s, First Name: %s, Last Name: %s, EMail: %s\n",
-                 uin, icq_ListAt(strList, 0), icq_ListAt(strList, 1),
-                 icq_ListAt(strList, 2), icq_ListAt(strList, 3));
-      invoke_callback(icqlink,icq_RecvAdded)(icqlink, uin, hour, minute, day, month, year,
-                                             icq_ListAt(strList, 0), icq_ListAt(strList, 1),
-                                             icq_ListAt(strList, 2), icq_ListAt(strList, 3));
-      break;
-    case TYPE_AUTH_REQ:
-      /* Format: Nick, 0xFE, FName, 0xFE, LName, 0xFE, EMail, 0xFE, 0, 0xFE, Reason */
-      fieldCount = icq_SplitFields(strList, data);
-      if(fieldCount != 6)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad TYPE_AUTH_REQ packet (expected 6 args, received %i)!\n",
-                   fieldCount);
-        return;
-      }
-      icq_RusConv("wk", icq_ListAt(strList, 0)); /* Nick */
-      icq_RusConv("wk", icq_ListAt(strList, 1)); /* FName */
-      icq_RusConv("wk", icq_ListAt(strList, 2)); /* LName */
-      icq_RusConv("wk", icq_ListAt(strList, 3)); /* EMail */
-      icq_RusConv("wk", icq_ListAt(strList, 5)); /* Reason */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "%lu has requested your authorization to be added to "
-                 "their contact list, Nick: %s, First Name: %s, Last Name: %s, "
-                 "EMail: %s, Reason: %s\n", uin, icq_ListAt(strList, 0), icq_ListAt(strList, 1),
-                 icq_ListAt(strList, 2), icq_ListAt(strList, 3), icq_ListAt(strList, 4));
-      invoke_callback(icqlink,icq_RecvAuthReq)(icqlink, uin, hour, minute, day, month, year,
-                                               icq_ListAt(strList, 0), icq_ListAt(strList, 1),
-                                               icq_ListAt(strList, 2), icq_ListAt(strList, 3),
-                                               icq_ListAt(strList, 5));
-      break;
-    case TYPE_URL:
-      /* Format: Description, 0xFE, URL */
-      fieldCount = icq_SplitFields(strList, data);
-      if(fieldCount != 2)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad TYPE_URL packet (expected 2 args, recived %i)!\n",
-                   fieldCount);
-        return;
-      }
-      icq_RusConv("wk", icq_ListAt(strList, 0)); /* Description */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "URL received from %lu, URL: %s, Description: %s\n",
-                 uin, icq_ListAt(strList, 1), icq_ListAt(strList, 0));
-      invoke_callback(icqlink,icq_RecvURL)(icqlink, uin, hour, minute, day, month, year,
-                                           icq_ListAt(strList, 1), icq_ListAt(strList, 0));
-      break;
-    case TYPE_WEBPAGER:
-      /* Format: Nick, 0xFE, Empty-FName, 0xFE, Empty-LName, 0xFE, EMail, 0xFE,
-       *         Reason(3), 0xFE, Message with IP & Subject */
-      fieldCount = icq_SplitFields(strList, data);
-      if(fieldCount != 6)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad TYPE_WEBPAGER packet (expected 6 args, received %i)!\n",
-                   fieldCount);
-        return;
-      }
-      icq_RusConv("wk", icq_ListAt(strList, 0)); /* Nick */
-      icq_RusConv("wk", icq_ListAt(strList, 5)); /* Message */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "WebPager message received, Nick: %s, EMail: %s, "
-                 "Message:\n%s\n", icq_ListAt(strList, 0), icq_ListAt(strList, 3),
-                 icq_ListAt(strList, 5));
-      invoke_callback(icqlink,icq_RecvWebPager)(icqlink, hour, minute, day, month, year,
-                                                icq_ListAt(strList, 0), icq_ListAt(strList, 3),
-                                                icq_ListAt(strList, 5));
-      break;
-    case TYPE_EXPRESS:
-      /* Format: Nick, 0xFE, Empty-FName, 0xFE, Empty-LName, 0xFE, EMail, 0xFE,
-       *         Reason(3), 0xFE, Message Subject */
-      fieldCount = icq_SplitFields(strList, data);
-      if(fieldCount != 6)
-      {
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Bad TYPE_EXPRESS packet (expected 6 args, received %i)!\n",
-                   fieldCount);
-        return;
-      }
-      icq_RusConv("wk", icq_ListAt(strList, 0)); /* Nick */
-      icq_RusConv("wk", icq_ListAt(strList, 5)); /* Message */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "MailExpress message received, Nick: %s, EMail: %s, "
-                 "Message:\n%s\n", icq_ListAt(strList, 0), icq_ListAt(strList, 3),
-                 icq_ListAt(strList, 5));
-      invoke_callback(icqlink, icq_RecvMailExpress)(icqlink, hour, minute, day, month, year,
-                                                   icq_ListAt(strList, 0), icq_ListAt(strList, 3),
-                                                   icq_ListAt(strList, 5));
-      break;
-    case TYPE_CONTACT:
-      /* Format: Number of contacts, 0xFE, UIN, 0xFE, Nick, 0xFE, ... */
-      nr = icq_SplitFields(strList, data);
-      contact_uin = (const char**)malloc((nr - 1) / 2);
-      contact_nick = (const char**)malloc((nr - 1) / 2);
-
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Contact List received from %lu (%i):\n", uin,
-                 atoi(icq_ListAt(strList, 0)));
-
-      for(i = 1, k = 0; i < (nr - 1); k++)
-      {
-        contact_uin[k] = icq_ListAt(strList, i);
-        contact_nick[k] = icq_ListAt(strList, i + 1);
-        i += 2;
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "\t%s - %s\n", contact_uin[k], contact_nick[k]);
-      }
-      invoke_callback(icqlink, icq_RecvContactList)(icqlink, uin, hour, minute, day, month, year,
-                                                 k, contact_uin, contact_nick);
-      free(contact_uin);
-      free(contact_nick);
-      break;
-    default:
-      icq_RusConv("wk", data); /* Entire message */
-      icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Instant message type %i from %lu:\n%s\n", type, uin, data);
-      invoke_callback(icqlink, icq_RecvMessage)(icqlink, uin, hour, minute, day, month, year, data);
-  }
-  icq_ListDelete(strList, free);
-}
-
-void icq_HandleInfoReply(icq_Link *icqlink, icq_Packet *p)
-{
-  char *ptr1, *ptr2, *ptr3, *ptr4;
-  DWORD uin;
-  icq_PacketGotoUDPInData(p, 0);
-  uin = icq_PacketRead32(p);
-  ptr1 = icq_PacketReadStringNew(p);
-  ptr2 = icq_PacketReadStringNew(p);
-  ptr3 = icq_PacketReadStringNew(p);
-  ptr4 = icq_PacketReadStringNew(p);
-  icq_RusConv("wk", ptr1);
-  icq_RusConv("wk", ptr2);
-  icq_RusConv("wk", ptr3);
-  icq_RusConv("wk", ptr4);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Info reply for %lu\n", uin);
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_InfoReply)(icqlink, uin, ptr1, ptr2, ptr3, ptr4, icq_PacketRead8(p));
-  free(ptr1);
-  free(ptr2);
-  free(ptr3);
-  free(ptr4);
-}
-
-void icq_HandleExtInfoReply(icq_Link *icqlink, icq_Packet *p)
-{
-  char *ptr1, *ptr2, *ptr3, *ptr4, *ptr5;
-  DWORD uin;
-  WORD cnt_code, age;
-  char cnt_stat, gender;
-
-  icq_PacketGotoUDPInData(p, 0);
-  uin = icq_PacketRead32(p);
-  ptr1 = icq_PacketReadStringNew(p);
-  cnt_code = icq_PacketRead16(p);
-  cnt_stat = icq_PacketRead8(p);
-  ptr2 = icq_PacketReadStringNew(p);
-  age = icq_PacketRead16(p);
-  gender = icq_PacketRead8(p);
-  ptr3 = icq_PacketReadStringNew(p);
-  ptr4 = icq_PacketReadStringNew(p);
-  ptr5 = icq_PacketReadStringNew(p);
-  icq_RusConv("wk", ptr1);
-  icq_RusConv("wk", ptr2);
-  icq_RusConv("wk", ptr3);
-  icq_RusConv("wk", ptr4);
-  icq_RusConv("wk", ptr5);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Extended info reply for %lu\n", uin);
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_ExtInfoReply)(icqlink, uin, (char*)ptr1, cnt_code, cnt_stat, (char*)ptr2,
-                                            age, gender, (char*)ptr3, (char*)ptr4, (char*)ptr5);
-  free(ptr1);
-  free(ptr2);
-  free(ptr3);
-  free(ptr4);
-  free(ptr5);
-}
-
-void icq_HandleSearchReply(icq_Link *icqlink, icq_Packet *p)
-{
-  char *ptr1, *ptr2, *ptr3, *ptr4, auth;
-  DWORD uin;
-  icq_PacketGotoUDPInData(p, 0);
-  uin = icq_PacketRead32(p);
-  ptr1 = icq_PacketReadStringNew(p);
-  ptr2 = icq_PacketReadStringNew(p);
-  ptr3 = icq_PacketReadStringNew(p);
-  ptr4 = icq_PacketReadStringNew(p);
-  icq_RusConv("wk", ptr1);
-  icq_RusConv("wk", ptr2);
-  icq_RusConv("wk", ptr3);
-  icq_RusConv("wk", ptr4);
-  auth = icq_PacketRead8(p);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "User found %lu, Nick: %s, First Name: %s, Last Name: %s, "
-             "EMail: %s, Auth: %s\n", uin, ptr1, ptr2, ptr3, ptr4, auth==1?"no":"yes");
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_UserFound)(icqlink, uin, (char*)ptr1, (char*)ptr2,
-                                         (char*)ptr3, (char*)ptr4, auth);
-  free(ptr1);
-  free(ptr2);
-  free(ptr3);
-  free(ptr4);
-}
-
-/************************************************
-This is called when a user goes offline
-*************************************************/
-void icq_HandleUserOffline(icq_Link *icqlink, icq_Packet *p)
-{
-  DWORD remote_uin;
-  icq_ContactItem *ptr;
-
-  icq_PacketGotoUDPInData(p, 0);
-  remote_uin = icq_PacketRead32(p);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "User %lu logged off\n", remote_uin);
-
-  ptr=icq_ContactFind(icqlink, remote_uin);
-  if(ptr)
-  {
-    ptr->remote_ip = 0;
-    ptr->remote_port = 0;
-  }
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_UserOffline)(icqlink, remote_uin);
-}
-
-void icq_HandleUserOnline(icq_Link *icqlink, icq_Packet *p)
-{
-  DWORD remote_uin, new_status, remote_ip, remote_real_ip;
-  DWORD remote_port; /* Why Mirabilis used 4 bytes for port? */
-  BYTE tcp_flag;
-  icq_ContactItem *ptr;
-
-  icq_PacketGotoUDPInData(p, 0);
-  remote_uin = icq_PacketRead32(p);
-  remote_ip = ntohl(icq_PacketRead32n(p));  /* icqtohl() */
-  remote_port = icqtohl(icq_PacketRead32n(p));
-  remote_real_ip = ntohl(icq_PacketRead32n(p)); /* icqtohl() */
-  tcp_flag = icq_PacketRead8(p);
-  new_status = icq_PacketRead32(p);
-
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE,
-             "User %lu (%s = 0x%X) logged on. tcp_flag=0x%X IP=%08X, real IP=%08X, port=%d\n",
-             remote_uin, icq_ConvertStatus2Str(new_status), new_status, tcp_flag, remote_ip,
-             remote_real_ip, remote_port);
-
-  ptr=icq_ContactFind(icqlink, remote_uin);
-  if(ptr)
-  {
-    ptr->remote_ip=remote_ip;
-    ptr->remote_real_ip=remote_real_ip;
-    ptr->remote_port = remote_port;
-    ptr->tcp_flag = tcp_flag;
-  }
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_UserOnline)(icqlink, remote_uin, new_status, remote_ip,
-                                          remote_port, remote_real_ip, tcp_flag);
-}
-
-void icq_HandleStatusChange(icq_Link *icqlink, icq_Packet *p)
-{
-  unsigned long remote_uin, new_status;
-
-  icq_PacketGotoUDPInData(p, 0);
-  remote_uin = icq_PacketRead32(p);
-  new_status = icq_PacketRead32(p);
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "%lu changed status to %s (0x%X)\n", remote_uin,
-             icq_ConvertStatus2Str(new_status), new_status);
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  invoke_callback(icqlink,icq_UserStatusUpdate)(icqlink, remote_uin, new_status);
-}
-
-void icq_HandleMetaUserInfo(icq_Link *icqlink, icq_Packet *p)
-{
-  unsigned short subcmd, country, seq2, age, occupation, wcountry;
-  char res, auth, timezone, webaware, hideip, gender;
-  char *nick, *first, *last, *email, *about, *city;
-  char *pri_eml, *sec_eml, *old_eml;
-  char *phone, *fax, *street, *cellular, *state;
-  char *wcity, *wstate, *wphone, *wfax, *waddress;
-  char *company, *department, *job, *whomepage;
-  char *homepage;
-  char byear, bmonth, bday, lang1, lang2, lang3, inum;
-  int i;
-  char anum, bnum, hnum;
-  unsigned long uin, zip, wzip;
-  char *empty = NULL;
-  char *interests[4] = {0, 0, 0, 0};
-  unsigned short icategory[4] = {0, 0, 0, 0};
-  char *affiliations[4] = {0, 0, 0, 0};
-  unsigned short acategory[4] = {0, 0, 0, 0};
-  char *backgrounds[4] = {0, 0, 0, 0};
-  unsigned short bcategory[4] = {0, 0, 0, 0};
-  char *hpcat[4] = {0, 0, 0, 0};
-  unsigned short hcategory[4] = {0, 0, 0, 0};
-
-  seq2 = icq_PacketReadUDPInSeq2(p);
-  icq_PacketGotoUDPInData(p, 0);
-  subcmd = icq_PacketRead16(p);
-  res = icq_PacketRead8(p);
-  icq_UDPAck(icqlink, icq_PacketReadUDPInSeq1(p));
-  if(res == META_SRV_FAILURE)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_WARNING, "META failure\n");
-    invoke_callback(icqlink,icq_RequestNotify)(icqlink, seq2, ICQ_NOTIFY_FAILED,
-                                               sizeof(subcmd), &subcmd);
-  }
-  else
-    switch(subcmd)
-    {
-      case META_SRV_USER_FOUND:
-        uin = icq_PacketRead32(p);
-        nick = icq_PacketReadStringNew(p);
-        first = icq_PacketReadStringNew(p);
-        last = icq_PacketReadStringNew(p);
-        email = icq_PacketReadStringNew(p);
-        auth = icq_PacketRead8(p);
-        icq_PacketRead16(p); /* ??? */
-        icq_PacketRead32(p); /* ??? */
-        icq_RusConv("wk", nick);
-        icq_RusConv("wk", first);
-        icq_RusConv("wk", last);
-        icq_RusConv("wk", email);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Found %lu, Nick: %s, First Name: %s, "\
-                   "Last Name: %s, EMail: %s, Auth: %s\n", seq2, uin, nick, first, last,
-                   email, auth==1?"no":"yes");
-        invoke_callback(icqlink,icq_MetaUserFound)(icqlink, seq2, uin, nick, first, last, email, auth);
-        free(nick);
-        free(first);
-        free(last);
-        free(email);
-        break;
-      case META_SRV_USER_INFO: /* finished! */
-        nick = icq_PacketReadStringNew(p);
-        first = icq_PacketReadStringNew(p);
-        last = icq_PacketReadStringNew(p);
-        pri_eml = icq_PacketReadStringNew(p);
-        sec_eml = icq_PacketReadStringNew(p);
-        old_eml = icq_PacketReadStringNew(p);
-        city = icq_PacketReadStringNew(p);
-        state = icq_PacketReadStringNew(p);
-        phone = icq_PacketReadStringNew(p);
-        fax = icq_PacketReadStringNew(p);
-        street = icq_PacketReadStringNew(p);
-        cellular = icq_PacketReadStringNew(p);
-        zip = icq_PacketRead32(p);
-        country = icq_PacketRead16(p);
-        timezone = icq_PacketRead8(p);         /* +1 = -30min, -1 = +30min (-4 = GMT+0200) */
-        auth = icq_PacketRead8(p);             /* 1 - no auth required, 0 - required */
-        webaware = icq_PacketRead8(p);         /* 1 - yes, 0 - no */
-        hideip = icq_PacketRead8(p);           /* 1 - yes, 0 - no */
-        icq_RusConv("wk", nick);
-        icq_RusConv("wk", first);
-        icq_RusConv("wk", last);
-        icq_RusConv("wk", pri_eml);
-        icq_RusConv("wk", sec_eml);
-        icq_RusConv("wk", old_eml);
-        icq_RusConv("wk", city);
-        icq_RusConv("wk", state);
-        icq_RusConv("wk", phone);
-        icq_RusConv("wk", fax);
-        icq_RusConv("wk", street);
-        icq_RusConv("wk", cellular);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Info: %s, %s, %s, "\
-                   "%s, %s, %s, %s, %s, %s, %s, %s, %s, %lu, %s, %i, %s, %s, %s\n",
-                   nick, first, last, pri_eml, sec_eml, old_eml, city, state, phone,
-                   fax, street, cellular, zip, icq_GetCountryName(country), timezone,
-                   auth?"false":"true", webaware?"true":"false", hideip?"true":"false");
-        invoke_callback(icqlink,icq_MetaUserInfo)(icqlink, seq2, nick, first, last, pri_eml,
-                                                  sec_eml, old_eml, city, state, phone, fax,
-                                                  street, cellular, zip, country, timezone,
-                                                  auth, webaware, hideip);
-        free(nick);
-        free(first);
-        free(last);
-        free(pri_eml);
-        free(sec_eml);
-        free(old_eml);
-        free(city);
-        free(state);
-        free(phone);
-        free(fax);
-        free(street);
-        free(cellular);
-        break;
-      case META_SRV_USER_WORK: /* finished! */
-        wcity = icq_PacketReadStringNew(p);
-        wstate = icq_PacketReadStringNew(p);
-        wphone = icq_PacketReadStringNew(p);
-        wfax = icq_PacketReadStringNew(p);
-        waddress = icq_PacketReadStringNew(p);
-        wzip = icq_PacketRead32(p);
-        wcountry = icq_PacketRead16(p);          /* icq_GetCountryName() */
-        company = icq_PacketReadStringNew(p);
-        department = icq_PacketReadStringNew(p);
-        job = icq_PacketReadStringNew(p);
-        occupation = icq_PacketRead16(p);        /* icq_GetMetaOccupationName() */
-        whomepage = icq_PacketReadStringNew(p);
-        icq_RusConv("wk", wcity);
-        icq_RusConv("wk", wstate);
-        icq_RusConv("wk", wphone);
-        icq_RusConv("wk", wfax);
-        icq_RusConv("wk", waddress);
-        icq_RusConv("wk", company);
-        icq_RusConv("wk", department);
-        icq_RusConv("wk", job);
-        icq_RusConv("wk", whomepage);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Work: %s, %s, %s, "\
-                   "%s, %s,   %lu, %s, %s, %s, %s, %s, %s\n", wcity, wstate,
-                   wphone, wfax, waddress, wzip, icq_GetCountryName(wcountry),
-                   company, department, job, icq_GetMetaOccupationName(occupation),
-                   whomepage);
-        invoke_callback(icqlink, icq_MetaUserWork)(icqlink, seq2, wcity, wstate, wphone,
-                                                   wfax, waddress, wzip, wcountry, company,
-                                                   department, job, occupation, whomepage);
-        free(wcity);
-        free(wstate);
-        free(wphone);
-        free(wfax);
-        free(waddress);
-        free(company);
-        free(department);
-        free(job);
-        free(whomepage);
-        break;
-      case META_SRV_USER_MORE: /* finished! */
-        age = icq_PacketRead16(p);    /* 0xFFFF - not entered */
-        gender = icq_PacketRead8(p);  /* 1 - female, 2 - male */
-        homepage = icq_PacketReadStringNew(p);
-        byear = icq_PacketRead8(p);   /* starting from 1900 */
-        bmonth = icq_PacketRead8(p);
-        bday = icq_PacketRead8(p);
-        lang1 = icq_PacketRead8(p);   /* icq_GetMetaLanguageName() */
-        lang2 = icq_PacketRead8(p);   /* icq_GetMetaLanguageName() */
-        lang3 = icq_PacketRead8(p);   /* icq_GetMetaLanguageName() */
-        icq_RusConv("wk", homepage);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User More: %i, %s, %s, "\
-                   "%02i/%02i/%04i, %s, %s, %s\n", age,
-                   gender==1?"female":gender==2?"male":"not entered",
-                   homepage, bday, bmonth, byear+1900, icq_GetMetaLanguageName(lang1),
-                   icq_GetMetaLanguageName(lang2), icq_GetMetaLanguageName(lang3));
-        if(icqlink->icq_MetaUserMore)
-          (*icqlink->icq_MetaUserMore)(icqlink, seq2, age, gender, homepage, byear,
-                                    bmonth, bday, lang1, lang2, lang3);
-        free(homepage);
-        break;
-      case META_SRV_USER_ABOUT: /* finished! */
-        about = icq_PacketReadStringNew(p);
-        icq_RusConv("wk", about);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User About: %s\n", about);
-        invoke_callback(icqlink,icq_MetaUserAbout)(icqlink, seq2, about);
-        free(about);
-        break;
-      case META_SRV_USER_INTERESTS: /* finished! */
-        inum = icq_PacketRead8(p);
-        for(i=0; i<inum && i<4; i++)
-        {
-          icategory[i] = icq_PacketRead16(p);
-          interests[i] = icq_PacketReadStringNew(p);
-          icq_RusConv("wk", interests[i]);
-        }
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Interests: %i, %i - %s, "\
-                   "%i - %s, %i - %s, %i - %s\n", inum, icategory[0],
-                   interests[0]?interests[0]:empty, icategory[1], interests[1]?interests[1]:empty,
-                   icategory[2], interests[2]?interests[2]:empty, icategory[3],
-                   interests[3]?interests[3]:empty);
-        invoke_callback(icqlink, icq_MetaUserInterests)(icqlink, seq2, inum,
-                                                        icategory[0], interests[0], icategory[1], 
-                                                        interests[1], icategory[2], interests[2],
-                                                        icategory[3], interests[3]);
-        for(i=0; i<inum && i<4; i++)
-          free(interests[i]);
-        break;
-      case META_SRV_USER_AFFILIATIONS: /* finished! */
-        bnum = icq_PacketRead8(p);
-        for(i=0; i<bnum && i<4; i++)
-        {
-          bcategory[i] = icq_PacketRead16(p);           /* icq_GetMetaBackgroundName() */
-          backgrounds[i] = icq_PacketReadStringNew(p);
-          icq_RusConv("wk", backgrounds[i]);
-        }
-        anum = icq_PacketRead8(p);
-        for(i=0; i<anum && i<4; i++)
-        {
-          acategory[i] = icq_PacketRead16(p);           /* icq_GetMetaAffiliationName() */
-          affiliations[i] = icq_PacketReadStringNew(p);
-          icq_RusConv("wk", affiliations[i]);
-        }
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Affiliations: %i, %s - %s, "\
-                   "%s - %s, %s - %s, %s - %s; Backgrounds: %i, %s - %s, %s - %s, "\
-                   "%s - %s, %s - %s\n", anum,
-                   icq_GetMetaAffiliationName(acategory[0]), affiliations[0]?affiliations[0]:empty,
-                   icq_GetMetaAffiliationName(acategory[1]), affiliations[1]?affiliations[1]:empty,
-                   icq_GetMetaAffiliationName(acategory[2]), affiliations[2]?affiliations[2]:empty,
-                   icq_GetMetaAffiliationName(acategory[3]), affiliations[3]?affiliations[3]:empty,
-                   bnum, icq_GetMetaBackgroundName(bcategory[0]), backgrounds[0]?backgrounds[0]:empty,
-                   icq_GetMetaBackgroundName(bcategory[1]), backgrounds[1]?backgrounds[1]:empty,
-                   icq_GetMetaBackgroundName(bcategory[2]), backgrounds[2]?backgrounds[2]:empty,
-                   icq_GetMetaBackgroundName(bcategory[3]), backgrounds[3]?backgrounds[3]:empty);
-        invoke_callback(icqlink, icq_MetaUserAffiliations)(icqlink, seq2, anum, acategory[0],
-                                                           affiliations[0], acategory[1], affiliations[1],
-                                                           acategory[2], affiliations[2], acategory[3],
-                                                           affiliations[3], bnum, bcategory[0],
-                                                           backgrounds[0], bcategory[1], backgrounds[1],
-                                                           bcategory[2], backgrounds[2], bcategory[3],
-                                                           backgrounds[3]);
-        for(i=0; i<bnum && i<4; i++)
-          free(backgrounds[i]);
-        for(i=0; i<anum && i<4; i++)
-          free(affiliations[i]);
-        break;
-      case META_SRV_USER_HPCATEGORY: /* finished! */
-        hnum = icq_PacketRead8(p);
-        for(i=0; i<hnum && i<1; i++)
-        {
-          hcategory[i] = icq_PacketRead16(p);
-          hpcat[i] = icq_PacketReadStringNew(p);
-          icq_RusConv("wk", hpcat[i]);
-        }
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User Homepage Category: %i, %i - %s\n",
-                   hnum, hcategory[0], hpcat[0]);
-        invoke_callback(icqlink,icq_MetaUserHomePageCategory)(icqlink, seq2,
-                                                              hnum, hcategory[0], hpcat[0]?hpcat[0]:empty);
-        for(i=0; i<hnum && i<1; i++)
-          free(hpcat[i]);
-        break;
-      case META_SRV_RES_INFO:
-      case META_SRV_RES_HOMEPAGE:
-      case META_SRV_RES_ABOUT:
-      case META_SRV_RES_SECURE:
-      case META_SRV_RES_PASS:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META success\n");
-        invoke_callback(icqlink,icq_RequestNotify)(icqlink, seq2, ICQ_NOTIFY_SUCCESS,
-                                                   sizeof(subcmd), &subcmd);
-        break;
-      default:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "META User - 0x%04X\n", subcmd);
-        icq_PacketUDPDump(p);
-        break;
-    }
-}
-
-void icq_HandleMultiPacket(icq_Link *icqlink, icq_Packet *p)
-{
-  icq_Packet *tmp;
-  int num, i;
-  icq_PacketGotoUDPInData(p, 0);
-  num = icq_PacketRead8(p);
-
-  icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "MultiPacket: %i packets\n", num);
-
-  for(i = 0; i < num; i++)
-  {
-    tmp = icq_PacketNew();
-    tmp->length = icq_PacketRead16(p);
-    memcpy(tmp->data, &(p->data[p->cursor]), tmp->length);
-    icq_PacketAdvance(p, tmp->length);
-    icq_ServerResponse(icqlink, tmp);
-    icq_PacketDelete(tmp);
-  }
-}
-
-void icq_ServerResponse(icq_Link *icqlink, icq_Packet *p)
-{
-  time_t cur_time;
-  struct tm *tm_str;
-  int len;
-  struct in_addr in_a;
-  DWORD uin;
-  WORD year, type, seq, cmd, ver;
-  BYTE month, day, hour, minute;
-
-  seq = icq_PacketReadUDPInSeq1(p);
-  cmd = icq_PacketReadUDPInCmd(p);
-  ver = icq_PacketReadUDPInVer(p);
-
-  if(ver == 5) /* We understand only V5 packets! */
-  {
-    switch(cmd)
-    {
-      case UDP_SRV_ACK:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "The server acknowledged the command\n");
-        invoke_callback(icqlink,icq_RequestNotify)(icqlink, seq, ICQ_NOTIFY_ACK, 0, 0);
-        invoke_callback(icqlink,icq_RequestNotify)(icqlink, seq, ICQ_NOTIFY_SUCCESS, 0, 0);
-        icq_UDPQueueDelSeq(icqlink, seq);
-        break;
-      case UDP_SRV_MULTI_PACKET:
-        icq_HandleMultiPacket(icqlink, p);
-        break;
-      case UDP_SRV_NEW_UIN:
-        uin = icq_PacketReadUDPInUIN(p);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "The new uin is %lu\n", uin);
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink,icq_NewUIN)(icqlink, uin);
-        break;
-      case UDP_SRV_LOGIN_REPLY:
-        icq_PacketGotoUDPInData(p, 0);
-        icqlink->icq_OurIP = ntohl(icq_PacketRead32n(p));
-/*       icq_OurIp = icq_PacketRead32(p); */
-        in_a.s_addr = htonl(icqlink->icq_OurIP);
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Login successful, UIN: %lu, IP: %s\n",
-                   icqlink->icq_Uin, inet_ntoa(in_a));
-        icq_UDPAck(icqlink, seq);
-        icq_SendLogin1(icqlink);
-        icq_SendContactList(icqlink);
-        icq_SendVisibleList(icqlink);
-        icq_SendInvisibleList(icqlink);
-        invoke_callback(icqlink,icq_Logged)(icqlink);
-        break;
-      case UDP_SRV_OFFLINE_MESSAGE: /* Offline message through the server */
-        icq_PacketGotoUDPInData(p, 0);
-        uin = icq_PacketRead32(p);
-        year = icq_PacketRead16(p);
-        month = icq_PacketRead8(p);
-        day = icq_PacketRead8(p);
-        hour = icq_PacketRead8(p);
-        minute = icq_PacketRead8(p);
-        type = icq_PacketRead16(p);
-        len = icq_PacketRead16(p);
-        icq_UDPAck(icqlink, seq);
-        icq_DoMsg(icqlink, type, len, (char*)&p->data[p->cursor], uin, hour, minute, day, month, year);
-        break;
-      case UDP_SRV_X1: /* unknown message sent after login*/
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Acknowleged UDP_SRV_X1 (Begin messages)\n");
-        icq_UDPAck(icqlink, seq);
-        break;
-      case UDP_SRV_X2: /* unknown message sent after login*/
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Acknowleged UDP_SRV_X2 (Done old messages)\n");
-        icq_UDPAck(icqlink, seq);
-        icq_SendGotMessages(icqlink);
-        break;
-      case UDP_SRV_INFO_REPLY:
-        icq_HandleInfoReply(icqlink, p);
-        break;
-      case UDP_SRV_EXT_INFO_REPLY:
-        icq_HandleExtInfoReply(icqlink, p);
-        break;
-      case UDP_SRV_USER_ONLINE:
-        icq_HandleUserOnline(icqlink, p);
-        break;
-      case UDP_SRV_USER_OFFLINE:
-        icq_HandleUserOffline(icqlink, p);
-        break;
-      case UDP_SRV_TRY_AGAIN:
-        icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Server is busy, please try again\n");
-        icq_Login(icqlink, icqlink->icq_Status);
-        break;
-      case UDP_SRV_STATUS_UPDATE:
-        icq_HandleStatusChange(icqlink, p);
-        break;
-      case UDP_SRV_GO_AWAY:
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Server has forced us to disconnect\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink, icq_Disconnected)(icqlink);
-        break;
-      case UDP_SRV_END_OF_SEARCH:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "Search done\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink, icq_SearchDone)(icqlink);
-        break;
-      case UDP_SRV_UPDATE_OK:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "User info successfully updated\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink, icq_UpdateSuccess)(icqlink);
-        break;
-      case UDP_SRV_UPDATE_FAIL:
-        icq_FmtLog(icqlink, ICQ_LOG_MESSAGE, "User info update failed\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink, icq_UpdateFailure)(icqlink);
-        break;
-      case UDP_SRV_USER_FOUND:
-        icq_HandleSearchReply(icqlink, p);
-        break;
-      case UDP_SRV_ONLINE_MESSAGE: /* Online message through the server */
-        cur_time = time(0L);
-        tm_str = localtime(&cur_time);
-        icq_PacketGotoUDPInData(p, 0);
-        uin = icq_PacketRead32(p);
-        type = icq_PacketRead16(p);
-        len = icq_PacketRead16(p);
-        icq_UDPAck(icqlink, seq);
-        icq_DoMsg(icqlink, type, len, (char*)&p->data[p->cursor], uin, tm_str->tm_hour,
-                  tm_str->tm_min, tm_str->tm_mday, tm_str->tm_mon+1, tm_str->tm_year+1900);
-        break;
-      case UDP_SRV_WRONG_PASSWORD:
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Wrong password\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink,icq_WrongPassword)(icqlink);
-        break;
-      case UDP_SRV_INVALID_UIN:
-        icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Invalid UIN\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink,icq_InvalidUIN)(icqlink);
-        break;
-      case UDP_SRV_META_USER:
-        icq_HandleMetaUserInfo(icqlink, p);
-        break;
-      default: /* commands we dont handle yet */
-        icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Unhandled message %04x, Version: %x, "
-                   "Sequence: %04x, Size: %d\n", cmd, ver, seq, p->length);
-        icq_UDPAck(icqlink, seq); /* fake like we know what we're doing */
-        break;
-    }
-  }
-  else if(ver == 3) /* And some of V3... */
-  {
-    cmd = icq_PacketReadUDPInCmdV3(p);
-    switch(cmd)
-    {
-      case UDP_SRV_WRONG_PASSWORD:
-        icq_FmtLog(icqlink, ICQ_LOG_ERROR, "Wrong password\n");
-        icq_UDPAck(icqlink, seq);
-        invoke_callback(icqlink,icq_WrongPassword)(icqlink);
-        break;
-      default: /* commands we dont handle yet */
-        icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Unhandled message %04x, Version: %x, "
-                   "Sequence: %04x, Size: %d\n", cmd, ver, seq, p->length);
-        icq_UDPAck(icqlink, seq); /* fake like we know what we're doing */
-        break;
-    }
-  }
-  else
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Unhandled protocol version! Message %04x, Version: %x, "
-               "Sequence: %04x, Size: %d\n", cmd, ver, seq, p->length);
-/*    icq_UDPAck(icqlink, seq);  DO NOT ACK unhandled protocol version! */
-  }
-}
-
-/******************************************
-Handles packets that the server sends to us.
-*******************************************/
-void icq_HandleServerResponse(icq_Link *icqlink)
-{
-  WORD seq, cmd;
-  int s;
-  icq_Packet *p;
-
-  p = icq_PacketNew();
-  s = icq_UDPSockRead(icqlink, p);
-  p->length = s;
-  if(s<=0)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_FATAL, "Connection terminated\n");
-    icq_Disconnect(icqlink);
-    invoke_callback(icqlink,icq_Disconnected)(icqlink);
-    return;
-  }
-  seq = icq_PacketReadUDPInSeq1(p);
-  cmd = icq_PacketReadUDPInCmd(p);
-  if(icq_GetServMess(icqlink, seq) && cmd != UDP_SRV_NEW_UIN && cmd != UDP_SRV_GO_AWAY && cmd != UDP_SRV_ACK)
-  {
-    icq_FmtLog(icqlink, ICQ_LOG_WARNING, "Ignored a message cmd %04x, seq %04x\n", cmd, seq);
-    icq_UDPAck(icqlink, seq); /* LAGGGGG!! */
-    icq_PacketDelete(p);
-    return;
-  }
-  if(cmd != UDP_SRV_ACK)
-    icq_SetServMess(icqlink, seq);
-
-  icq_ServerResponse(icqlink, p);
-
-  icq_PacketDelete(p);
-}
--- a/src/protocols/icq/util.c	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,513 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: util.c 2096 2001-07-31 01:00:39Z warmenhoven $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#include <stdlib.h>
-#include <ctype.h>
-
-#include "icqlib.h"
-#include "stdpackets.h"
-
-/*
- * This list of countries should be sorted according to country code.
- * When adding new country, please preserve the order!
- */
-icq_ArrayType icq_Countries[] = {
-  {"USA",1},
-  {"Russia",7},
-  {"Egypt",20},
-  {"South Africa",27},
-  {"Greece",30},
-  {"Netherlands",31},
-  {"Belgium",32},
-  {"France",33},
-  {"Monaco",33},
-  {"Spain",34},
-  {"Hungary",36},
-  {"Yugoslavia",38},
-  {"Italy",39},
-  {"San Marino",39},
-  {"Vatican City",39},
-  {"Romania",40},
-  {"Liechtenstein",41},
-  {"Switzerland",41},
-  {"Czech Republic",42},
-  {"Austria",43},
-  {"UK",44},
-  {"Denmark",45},
-  {"Sweden",46},
-  {"Norway",47},
-  {"Poland",48},
-  {"Germany",49},
-  {"Peru",51},
-  {"Mexico",52},
-  {"Guantanomo Bay",53},
-  {"Argentina",54},
-  {"Brazil",55},
-  {"Chile",56},
-  {"Columbia",57},
-  {"Venezuela",58},
-  {"Malaysia",60},
-  {"Australia",61},
-  {"Indonesia",62},
-  {"Philippines",63},
-  {"New Zealand",64},
-  {"Singapore",65},
-  {"Thailand",66},
-  {"Japan",81},
-  {"South Korea",82},
-  {"Vietnam",84},
-  {"China",86},
-  {"Turkey",90},
-  {"India",91},
-  {"Pakistan",92},
-  {"Sri Lanka",94},
-  {"Iran",98},
-  {"Canada",107},
-  {"Morocco",212},
-  {"Algeria",213},
-  {"Tunisia",216},
-  {"Libya",218},
-  {"Senegal",221},
-  {"Mali",223},
-  {"Ivory Coast",225},
-  {"Liberia",231},
-  {"Ghana",233},
-  {"Nigeria",234},
-  {"Cameroon",237},
-  {"Gabon",241},
-  {"Zaire",243},
-  {"Ethiopia",251},
-  {"Kenya",254},
-  {"Tanzania",255},
-  {"Zimbabwe",263},
-  {"Namibia",264},
-  {"Malawi",265},
-  {"Aruba",297},
-  {"Portugal",351},
-  {"Luxembourg",352},
-  {"Ireland",353},
-  {"Iceland",354},
-  {"Malta",356},
-  {"Cyprus",357},
-  {"Finland",358},
-  {"Bulgaria",359},
-  {"Ukraine",380},
-  {"Belize",501},
-  {"Guatemala",502},
-  {"El Salvador",503},
-  {"Honduras",504},
-  {"Nicaragua",505},
-  {"Costa Rice",506},
-  {"Panama",507},
-  {"Haiti",509},
-  {"Guadeloupe",590},
-  {"Bolivia",591},
-  {"Guyana",592},
-  {"Ecuador",593},
-  {"Paraguay",595},
-  {"French Antilles",596},
-  {"Suriname",597},
-  {"Uruguay",598},
-  {"Netherlands Antilles",599},
-  {"Saipan",670},
-  {"Saipan",670},
-  {"Guam",671},
-  {"Papua New Guinea",675},
-  {"Fiji",679},
-  {"American Samoa",684},
-  {"New Caledonia",687},
-  {"French Polynesia",689},
-  {"Hong Kong",852},
-  {"Trinidad and Tobago",868},
-  {"Bangladesh",880},
-  {"Taiwan",886},
-  {"Jordan",962},
-  {"Iraq",964},
-  {"Kuwait",965},
-  {"Saudia Arabia",966},
-  {"Yemen",967},
-  {"Oman",968},
-  {"United Arab Emirates",971},
-  {"Israel",972},
-  {"Bahrain",973},
-  {"Qatar",974},
-  {"Nepal",977},
-  {"Slovak Republic",4201},
-  {"Not entered",0xffff},
-};
-
-icq_ArrayType icq_MetaOccupation[] = {
-  {"Academic", 1},
-  {"Administrative", 2},
-  {"Art/Entertainment", 3},
-  {"College Student", 4},
-  {"Computers", 5},
-  {"Community & Social", 6},
-  {"Education", 7},
-  {"Engineering", 8},
-  {"Financial Services", 9},
-  {"Government", 10},
-  {"High School Student", 11},
-  {"Home", 12},
-  {"ICQ - Providing Help", 13},
-  {"Law", 14},
-  {"Managerial", 15},
-  {"Manufacturing", 16},
-  {"Medical/Health", 17},
-  {"Military", 18},
-  {"Non-Government Organization", 19},
-  {"Professional", 20},
-  {"Retail", 21},
-  {"Retired", 22},
-  {"Science & Research", 23},
-  {"Sports", 24},
-  {"Technical", 25},
-  {"University Student", 26},
-  {"Web Building", 27},
-  {"Other Services", 99},
-};
-
-icq_ArrayType icq_MetaPastBackgrounds[] = {
-  {"Elementary School", 300},
-  {"High School", 301},
-  {"College", 302},
-  {"University", 303},
-  {"Military", 304},
-  {"Past Work Place", 305},
-  {"Past Organization", 306},
-  {"Other", 399},
-};
-
-icq_ArrayType icq_MetaAffiliations[] = {
-  {"Alumni Org.", 200},
-  {"Charity Org.", 201},
-  {"Club/Social Org.", 202},
-  {"Community Org.", 203},
-  {"Cultural Org.", 204},
-  {"Fan Clubs", 205},
-  {"Fraternity/Sorority", 206},
-  {"Hobbyists Org.", 207},
-  {"International Org.", 208},
-  {"Nature and Environment Org.", 209},
-  {"Professional Org.", 210},
-  {"Scientific/Technical Org.", 211},
-  {"Self Improvement Group", 212},
-  {"Spiritual/Religious Org.", 213},
-  {"Sports Org.", 214},
-  {"Support Org.", 215},
-  {"Trade and Business Org.", 216},
-  {"Union", 217},
-  {"Voluntary Org.", 218},
-  {"Other", 299},
-};
-
-icq_ArrayType icq_MetaLanguages[] = {
-  {"Not Entered", 0},
-  {"Arabic", 1},
-  {"Bhojpuri", 2},
-  {"Bulgarian", 3},
-  {"Burmese", 4},
-  {"Cantonese", 5},
-  {"Catalan", 6},
-  {"Chinese", 7},
-  {"Croatian", 8},
-  {"Czech", 9},
-  {"Danish", 10},
-  {"Dutch", 11},
-  {"English", 12},
-  {"Esperanto", 13},
-  {"Estonian", 14},
-  {"Farsi", 15},
-  {"Finnish", 16},
-  {"French", 17},
-  {"Gaelic", 18},
-  {"German", 19},
-  {"Greek", 20},
-  {"Hebrew", 21},
-  {"Hindi", 22},
-  {"Hungarian", 23},
-  {"Icelandic", 24},
-  {"Indonesian", 25},
-  {"Italian", 26},
-  {"Japanese", 27},
-  {"Khmer", 28},
-  {"Korean", 29},
-  {"Lao", 30},
-  {"Latvian", 31},
-  {"Lithuanian", 32},
-  {"Malay", 33},
-  {"Norwegian", 34},
-  {"Polish", 35},
-  {"Portuguese", 36},
-  {"Romanian", 37},
-  {"Russian", 38},
-  {"Serbian", 39},
-  {"Slovak", 40},
-  {"Slovenian", 41},
-  {"Somali", 42},
-  {"Spanish", 43},
-  {"Swahili", 44},
-  {"Swedish", 45},
-  {"Tagalog", 46},
-  {"Tatar", 47},
-  {"Thai", 48},
-  {"Turkish", 49},
-  {"Ukrainian", 50},
-  {"Urdu", 51},
-  {"Vietnamese", 52},
-  {"Yiddish", 53},
-  {"Yoruba", 54},
-  {"Afrikaans", 55},
-  {"Bosnian", 56},
-  {"Persian", 57},
-  {"Albanian", 58},
-  {"Armenian", 59},
-  {"Punjabi", 60},
-  {"Chamorro", 61},
-  {"Mongolian", 62},
-  {"Mandarin", 63},
-  {"Taiwaness", 64},
-  {"Macedonian", 65},
-  {"Sindhi", 66},
-  {"Welsh", 67},
-};
-
-icq_ArrayType icq_Genders[] = {
-  {"Not Specified", 0},
-  {"Female", 1},
-  {"Male", 2},
-};
-
-void hex_dump(char *data, long size)
-{
-  long i;
-  long x;
-  int r=1;
-  char d[32];
-  unsigned char bfr[64];
-  for(i=0, x=0;;i++)
-  {
-    if(i<size)
-    {
-      if(x==0)
-        printf("%04lx: ", i);
-#ifdef _WIN32
-      sprintf(d, "%08x", data[i]);
-#else
-      snprintf(d, 9, "%08x", data[i]);
-#endif
-      printf("%c%c ", d[6], d[7]);
-      bfr[x]=data[i];
-      if(bfr[x]<0x20)
-        bfr[x]='.';
-      if(bfr[x]>0x7f)
-        bfr[x]='.';
-    }
-    else
-    {
-      if(x==0)
-        break;
-      else
-      {
-        printf("   ");
-        bfr[x]=' ';
-        r=0;
-      }
-    }
-    x++;
-    if(!(x<16))
-    {
-      bfr[x]=0;
-      printf("%s\n", bfr);
-      x=0;
-      if(!r)
-        break;
-    }
-  }
-}
-
-/* simple mapping for udp status->tcp status translation function */
-struct icq_TCPStatusRec
-{
-    unsigned long udp_status;
-    long tcp_status;
-} icq_TCPStatusMap[] = {
-    { STATUS_OFFLINE     , 0                        }, 
-    { STATUS_ONLINE      , ICQ_TCP_STATUS_ONLINE    }, 
-    { STATUS_INVISIBLE   , ICQ_TCP_STATUS_INVISIBLE },
-    { STATUS_NA          , ICQ_TCP_STATUS_NA        },
-    { STATUS_FREE_CHAT   , ICQ_TCP_STATUS_FREE_CHAT },
-    { STATUS_OCCUPIED    , ICQ_TCP_STATUS_OCCUPIED  },
-    { STATUS_AWAY        , ICQ_TCP_STATUS_AWAY      },
-    { STATUS_DND         , ICQ_TCP_STATUS_DND       },
-};
-
-long icq_TCPXlateStatus(unsigned long udp_status)
-{
-  unsigned int i;
-  for(i=0;i<sizeof(icq_TCPStatusMap)/sizeof(struct icq_TCPStatusRec);i++)
-    if(icq_TCPStatusMap[i].udp_status==udp_status) 
-      return icq_TCPStatusMap[i].tcp_status;
-  /* warning: "couldn't find tcp status for %d, assuming 0", udp_status */
-  return 0;
-}
-
-void icq_FmtLog(icq_Link *icqlink, int level, const char *fmt, ...)
-{
-  char buffer[2048];
-  va_list ap;
-  va_start(ap, fmt);
-  
-  if(!icqlink)
-    return;
-#ifdef _MSVC_
-  _vsnprintf(buffer, 1024, fmt, ap);
-#else
-  (void)vsnprintf(buffer, 1024, fmt, ap);
-#endif
-  va_end(ap);
-
-  if(icqlink->icq_Log && icq_LogLevel>=level)
-    (*icqlink->icq_Log)(icqlink, time(0L), level, buffer);
-}
-
-/**
- * Following functions used by qsort and bsearch to
- * compare 2 pointers to icq_ArrayType object.
- */
-int array_code_compare(const void *x, const void *y)
-{
-  return ((icq_ArrayType*)x)->code - ((icq_ArrayType*)y)->code;
-}
-
-const char *icq_GetCountryName(unsigned short code)
-{
-  icq_ArrayType *res,key;
-    
-  key.code=code;
-  res=bsearch(&key, icq_Countries, sizeof(icq_Countries)/sizeof(icq_ArrayType),
-              sizeof(icq_ArrayType), array_code_compare);
-    
-  return res?res->name:"Unknown";
-}
-
-const char *icq_GetMetaOccupationName(unsigned short code)
-{
-  icq_ArrayType *res,key;
-    
-  key.code=code;
-  res=bsearch(&key, icq_MetaOccupation, sizeof(icq_MetaOccupation)/sizeof(icq_ArrayType),
-              sizeof(icq_ArrayType), array_code_compare);
-    
-  return res?res->name:"Unknown";
-}
-
-const char *icq_GetMetaBackgroundName(unsigned short code)
-{
-  icq_ArrayType *res,key;
-    
-  key.code=code;
-  res=bsearch(&key, icq_MetaPastBackgrounds, sizeof(icq_MetaPastBackgrounds)/sizeof(icq_ArrayType),
-              sizeof(icq_ArrayType), array_code_compare);
-    
-  return res?res->name:"Unknown";
-}
-
-const char *icq_GetMetaAffiliationName(unsigned short code)
-{
-  icq_ArrayType *res,key;
-    
-  key.code=code;
-  res=bsearch(&key, icq_MetaAffiliations, sizeof(icq_MetaAffiliations)/sizeof(icq_ArrayType),
-              sizeof(icq_ArrayType), array_code_compare);
-    
-  return res?res->name:"Unknown";
-}
-
-const char *icq_GetMetaLanguageName(unsigned short code)
-{
-  icq_ArrayType *res,key;
-    
-  key.code=code;
-  res=bsearch(&key, icq_MetaLanguages, sizeof(icq_MetaLanguages)/sizeof(icq_ArrayType),
-              sizeof(icq_ArrayType), array_code_compare);
-    
-  return res?res->name:"Unknown";
-}
-
-/********************************************
-returns a string describing the status or
-a "Error" if no such string exists
-*********************************************/
-const char *icq_ConvertStatus2Str(unsigned long status)
-{
-  if((unsigned long)STATUS_OFFLINE == status) /* this because -1 & 0x01FF is not -1 */
-    return "Offline";
-
-  if((status & STATUS_INVISIBLE) == STATUS_INVISIBLE)
-    return "Invisible";
-  else if((status & STATUS_FREE_CHAT) == STATUS_FREE_CHAT)
-    return "Free for chat";
-  else if((status & STATUS_DND) == STATUS_DND)
-    return "Do not disturb";
-  else if((status & STATUS_OCCUPIED) == STATUS_OCCUPIED)
-    return "Occupied";
-  else if((status & STATUS_NA) == STATUS_NA)
-    return "Not available";
-  else if((status & STATUS_AWAY) == STATUS_AWAY)
-    return "Away";
-  else if(!(status & 0x01FF))
-    return "Online";
-  else
-    return "Error";
-}
-
-int icq_SplitFields(icq_List *strList, const char *str)
-{
-  char *tmpBuf, *tmp, *ptr;
-  int count = 0;
- 
-  tmpBuf = (char*)malloc(strlen(str)+1);
-  strcpy(tmpBuf, str);
-  ptr = tmpBuf;
- 
-  while(ptr)
-  {
-    char *p;
-    tmp = strchr(ptr, 0xFE);
-    if(tmp != 0L)
-    {
-      *tmp = 0;
-      tmp++;
-    }
-    count++;
-    p = (char *)malloc(strlen(ptr)+1);
-    strcpy(p, ptr);
-    icq_ListEnqueue(strList, p);
-    ptr = tmp;
-  }
- 
-  free(tmpBuf);
-  return count;
-}
--- a/src/protocols/icq/util.h	Wed Sep 08 02:47:13 2004 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/* -*- Mode: C; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-
-/*
- * $Id: util.h 8967 2004-02-12 19:54:18Z hermanator $
- *
- * Copyright (C) 1998-2001, Denis V. Dmitrienko <denis@null.net> and
- *                          Bill Soudan <soudan@kde.org>
- *
- * 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.
- *
- */
-
-#ifndef _UTIL_H_
-#define _UTIL_H_
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <sys/types.h>
-
-#ifndef _WIN32
-#include <netinet/in.h>
-#else
-#include "libc_interface.h"
-#endif
-
-#include "icqtypes.h"
-#include "list.h"
-
-#ifndef FALSE
-#define FALSE 0
-#endif
-
-#ifndef TRUE
-#define TRUE !FALSE
-#endif
-
-void hex_dump(char *data, long size);
-
-WORD Chars_2_Word(unsigned char *buf);
-DWORD Chars_2_DW(unsigned char *buf);
-void DW_2_Chars(unsigned char *buf, DWORD num);
-void Word_2_Chars(unsigned char *buf, WORD num);
-
-const char *icq_ConvertStatus2Str(unsigned long status);
-int icq_SplitFields(icq_List *strList, const char *str);
-
-#endif /* _UTIL_H_ */
--- a/src/protocols/oscar/oscar.c	Wed Sep 08 02:47:13 2004 +0000
+++ b/src/protocols/oscar/oscar.c	Wed Sep 08 03:11:41 2004 +0000
@@ -296,7 +296,7 @@
 /* remove these at some point? */
 /* Because I don't like forward declarations?  I think that was why... */
 static void oscar_set_info(GaimConnection *gc, const char *text);
-static void oscar_set_away(GaimConnection *gc, const char *state, const char *message);
+static void oscar_set_status(GaimConnection *gc, const char *state, const char *message);
 
 static void recent_buddies_cb(const char *name, GaimPrefType type, gpointer value, gpointer data);
 
@@ -679,7 +679,8 @@
 		return g_strdup_printf(_("Online"));
 }
 
-static void oscar_string_append(GString *str, char *newline, char *name, char *value)
+static void
+oscar_string_append(GString *str, const char *newline, const char *name, const char *value)
 {
 	gchar *utf8;
 
@@ -689,7 +690,7 @@
 	}
 }
 
-static void oscar_string_append_info(GaimConnection *gc, GString *str, char *newline, GaimBuddy *b, aim_userinfo_t *userinfo)
+static void oscar_string_append_info(GaimConnection *gc, GString *str, const char *newline, GaimBuddy *b, aim_userinfo_t *userinfo)
 {
 	OscarData *od = gc->proto_data;
 	GaimAccount *account = gaim_connection_get_account(gc);
@@ -4989,16 +4990,6 @@
 }
 #endif
 
-static void oscar_string_append(GString *str, char *name, char *value)
-{
-	gchar *utf8;
-
-	if (value && value[0] && (utf8 = gaim_utf8_try_convert(value))) {
-		g_string_append_printf(str, "\n<br><b>%s:</b> %s", name, utf8);
-		g_free(utf8);
-	}
-}
-
 static int gaim_icqinfo(aim_session_t *sess, aim_frame_t *fr, ...)
 {
 	GaimConnection *gc = sess->aux_data;
@@ -5532,7 +5523,7 @@
 	return;
 }
 
-static void oscar_set_away_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text)
+static void oscar_set_status_aim(GaimConnection *gc, OscarData *od, const char *state, const char *text)
 {
 	int charset = 0;
 	gchar *text_html = NULL;
@@ -5612,7 +5603,7 @@
 	return;
 }
 
-static void oscar_set_away_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message)
+static void oscar_set_status_icq(GaimConnection *gc, OscarData *od, const char *state, const char *message)
 {
 	GaimAccount *account = gaim_connection_get_account(gc);
 	if (gc->away) {
@@ -5659,14 +5650,14 @@
 	return;
 }
 
-static void oscar_set_away(GaimConnection *gc, const char *state, const char *message)
+static void oscar_set_status(GaimConnection *gc, const char *state, const char *message)
 {
 	OscarData *od = (OscarData *)gc->proto_data;
 
 	if (od->icq)
-		oscar_set_away_icq(gc, od, state, message);
+		oscar_set_status_icq(gc, od, state, message);
 	else
-		oscar_set_away_aim(gc, od, state, message);
+		oscar_set_status_aim(gc, od, state, message);
 
 	return;
 }
@@ -6083,7 +6074,7 @@
 								   "ssi: changing permdeny from %d to %hhu\n", account->perm_deny, permdeny);
 						account->perm_deny = permdeny;
 						if (od->icq && account->perm_deny == 0x03) {
-							serv_set_away(gc, "Invisible", "");
+							serv_set_status(gc, "Invisible", "");
 						}
 					}
 				}
@@ -6814,11 +6805,13 @@
 #endif
 }
 
-static GList *oscar_away_states(GaimConnection *gc)
+static GList *oscar_status_types(GaimAccount *account)
 {
 	OscarData *od = gc->proto_data;
 	GList *m = NULL;
 
+	g_return_val_if_fail(account != NULL, NULL);
+
 	if (od->icq) {
 		m = g_list_append(m, _("Online"));
 		m = g_list_append(m, _("Away"));
@@ -7351,7 +7344,7 @@
 	oscar_list_emblems,		/* list_emblems */
 	oscar_status_text,		/* status_text */
 	oscar_tooltip_text,		/* tooltip_text */
-	oscar_away_states,		/* away_states */
+	oscar_status_types,		/* status_types */
 	oscar_blist_node_menu,	/* blist_node_menu */
 	oscar_chat_info,		/* chat_info */
 	oscar_chat_info_defaults, /* chat_info_defaults */
@@ -7361,7 +7354,7 @@
 	oscar_set_info,			/* set_info */
 	oscar_send_typing,		/* send_typing */
 	oscar_get_info,			/* get_info */
-	oscar_set_away,			/* set_away */
+	oscar_set_status,		/* set_status */
 	oscar_set_idle,			/* set_idle */
 	oscar_change_passwd,	/* change_passwd */
 	oscar_add_buddy,		/* add_buddy */
@@ -7376,7 +7369,7 @@
 	oscar_warn,				/* warn */
 	oscar_join_chat,		/* join_chat */
 	NULL,					/* reject_chat */
-	oscar_get_chat_name,		/* get_chat_name */
+	oscar_get_chat_name,	/* get_chat_name */
 	oscar_chat_invite,		/* chat_invite */
 	oscar_chat_leave,		/* chat_leave */
 	NULL,					/* chat_whisper */