Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Apr 2001 00:22:38 +0400 (MSD)
From:      Seva Gluschenko <gvs@staff.rinet.ru>
To:        FreeBSD-gnats-submit@freebsd.org
Subject:   ports/26387: numerous fixes and improvements to micq-0.4.6 (latest)
Message-ID:  <200104062022.AAA11577@staff.rinet.ru>

next in thread | raw e-mail | index | archive | help

>Number:         26387
>Category:       ports
>Synopsis:       numerous fixes and improvements to micq-0.4.6 (latest)
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Fri Apr 06 13:30:01 PDT 2001
>Closed-Date:
>Last-Modified:
>Originator:     Seva Gluschenko
>Release:        FreeBSD 3.5-STABLE i386
>Organization:
Cronyx Plus LLC
>Environment:

	

>Description:

Micq, Matt's ICQ clone, has some non-critical bugs that may cause to
segmentation faults. The quick fix (which is changing sprintfs to snprintfs)
to the security issues has been released many weeks ago, but it does not
cover all the issues. More again, some improvements and fixes to the
user interface were introduced. Due to the death of Micq's author, and
nobody seems to continue his work, I'm submitting this patch directly to
you. Here is the complete list of changes:

	- sprint to snprintf has been changed and some work-around created
	  for systems which haven't snprintf.
	- Reconnect feature is added. Micq is now staying online as far
	  as possible
	- Auto-Again feature is added. Micq is now considering anything
	  entered except the precise commands as "again" command (sends
	  the message to the last contacted uin).
	- UID 0 checking is added. Unless otherwise specified, micq
	  refuses now to run as root.
	- Getting Log_Dir is improved. Micq did not tried to find its
	  Log_Dir until the event to log is received. Then it blindly
	  used getenv( "HOME" ) which might result to segfaults. It is
	  fixed now.
	- Fixed and improved russian.h include file for Russian language.
	- The "reset" command is added to restore tty settings. Also
	  modified the "clear" command to do terminal reset after clearing.

>How-To-Repeat:

	About segfaulting micq with Log_Dir problem it's pretty enough not
	to specify Log_Dir in the .micqrc file, then log in and leave about
	half-hour w/o events to log. Then, when you try to send, toggle
	visibility to uin, or if the message is received, the segmentation
	fault happens.

	About broken tty modes it is pretty enough to suspend micq and then
	return to it.

>Fix:

	Apply the patch below, then recompile and install micq:

	# cd src/
	# patch < micq-0.4.6-erra.diff
	# cd micq-0.4.6

	Now edit Makefile and config.h for your purposes. Then do:

	# make
	# install -c -s -o bin -g bin -m 0555 micq /usr/local/bin

	Micq will now report itself as version 0.4.7.


diff -u -r micq-0.4.6/config.h micq-0.4.7/config.h
--- micq-0.4.6/config.h	Fri Apr  6 20:30:42 2001
+++ micq-0.4.7/config.h	Fri Apr  6 20:27:10 2001
@@ -45,3 +45,9 @@
 
 /* remove this line to disable shell commands from within micq */
 #define SHELL_COMMANDS
+
+/* undef this if your system hasn't snprintf */
+#define HAVE_SNPRINTF
+
+/* undef this if you REALLY want to allow root access */
+#define DENY_ROOT
diff -u -r micq-0.4.6/english.h micq-0.4.7/english.h
--- micq-0.4.6/english.h	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/english.h	Mon Apr  2 14:18:03 2001
@@ -5,23 +5,6 @@
 #define CHANGE_STATUS_STR " changed status to "
 #define UNKNOWN_COMMAND_STR "Unknown command %s, type /help for help."
 
-#define Puerto_Rico_COUNTRY_STR "Puerto Rico"
-#define Tinian_Island_COUNTRY_STR "Tinian Island"
-#define Togo_COUNTRY_STR "Togo"
-#define Tokelau_COUNTRY_STR "Tokelau"
-#define Tonga_COUNTRY_STR "Tonga"
-#define Trinadad_and_Tabago_COUNTRY_STR "Trinadad and Tabago"
-#define Turkmenistan_COUNTRY_STR "Turkmenistan"
-#define Turks_and_Caicos_Islands_COUNTRY_STR "Turks and Caicos Islands"
-#define Tuvalu_COUNTRY_STR "Tuvalu"
-#define Uganda_COUNTRY_STR "Uganda"
-#define US_Virgin_Islands "United States Virgin Islands"
-#define Uzbekistan_COUNTRY_STR "Uzbekistan"
-#define Vanuatu_COUNTRY_STR "Vanuatu"
-#define Wallis_and_Futuna_Islands_COUNTRY_STR "Wallis and Futuna Islands"
-#define Western_Samoa_COUNTRY_STR "Western Samoa"
-#define Zambia_COUNTRY_STR "Zambia"
-
 #define NICKNAME_INFO_STR "Nickname     : "
 #define NAME_INFO_STR     "Name         : "
 #define EMAIL_INFO_STR    "Email        : "
@@ -57,15 +40,14 @@
 #else
 #define SEX_UNKNOWN_INFO_STR "Sex : Not Specified"
 #endif
-#define HOMEPAGE_INFO_STR "Homepage     : "
-#define BIRTH_INFO_STR "Born         : "
-#define LANGUAGE_INFO_STR "Languages    : "
+#define HOMEPAGE_INFO_STR	"Homepage     : "
+#define BIRTH_INFO_STR		"Born         : "
+#define LANGUAGE_INFO_STR	"Languages    : "
 
 #define STATUS_OFFLINE_STR "Offline"
 /***************************************************************************/
 #define STATUS_HELP_STR "\t\tShows locally stored info on user\n"
 #define UPDATE_OTHER_HELP_STR "\t\tUpdates other user info like age and sex\n"
-#define ARMENIAN_LANG_STR "Armenian"
 #define UPDATE_LANG_STR "Enter a language by number or L for a list: "
 #define UPDATE_AGE_STR "Enter new age: "
 #define UPDATE_SEX_STR "Enter new sex: "
@@ -90,8 +72,8 @@
 #define TIME_ZONE_UPDATE_STR "Enter your time zone (+/- 0-12): "
 #define LAST_HELP_STR "\t\tDisplays the last message received from <nick>.\n\t\t\tThey must be in your Contact List.\n"
 
-#define KAZAKHSTAN_COUNTRY_STR "Kazakhstan"
 #define ARABIC_LANG_STR "Arabic"
+#define ARMENIAN_LANG_STR "Armenian"
 #define BHOJPURI_LANG_STR "Bhojpuri"
 #define BULGARIAN_LANG_STR "Bulgarian"
 #define BURMESE_LANG_STR "Burmese"
@@ -118,6 +100,7 @@
 #define INDONESIAN_LANG_STR "Indonesian"
 #define ITALIAN_LANG_STR "Italian"
 #define JAPANESE_LANG_STR "Japanese"
+#define KAZAKHSTAN_COUNTRY_STR "Kazakhstan"
 #define KHMER_LANG_STR "Khmer"
 #define KOREAN_LANG_STR "Korean"
 #define LAO_LANG_STR "Lao"
@@ -234,6 +217,7 @@
 #define ALTER_HELP_STR "\tThis command allows you to alter your command set on the fly.\n"
 #define VERBOSE_HELP_STR "\t\t\tSet the verbosity level ( default = 0 ).\n"
 #define CLEAR_HELP_STR "\t\t\t\tClears the screen.\n"
+#define RESET_HELP_STR "\t\t\t\tResets the terminal attributes.\n"
 #define SOUND_HELP_STR "\t\t\t\tToggles beeping when recieving new messages.\n"
 #define COLOR_HELP_STR "\t\t\t\tToggles displaying colors.\n"
 #define QUIT_HELP_STR "\t\t\tLogs off and quits\n"
@@ -283,6 +267,8 @@
 /* will hopefully solve any potential word order problems */
 #define MESSAGE_SENT_1_STR  "Message sent to "
 #define MESSAGE_SENT_2_STR  "!\n"
+#define MESSAGE_QUEUED_1_STR "Queued message for "
+#define MESSAGE_QUEUED_2_STR "...\n"
 
 /********************************************************************/
 /* Simple Yes no response*/
@@ -465,6 +451,7 @@
 #define Philippines_COUNTRY_STR "Philippines"
 #define Poland_COUNTRY_STR "Poland"
 #define Portugal_COUNTRY_STR "Portugal"
+#define Puerto_Rico_COUNTRY_STR "Puerto Rico"
 #define Qatar_COUNTRY_STR "Qatar"
 #define Romania_COUNTRY_STR "Romania"
 #define Russia_COUNTRY_STR "Russia"
@@ -483,18 +470,33 @@
 #define Taiwan_COUNTRY_STR "Taiwan"
 #define Tanzania_COUNTRY_STR "Tanzania"
 #define Thailand_COUNTRY_STR "Thailand"
+#define Tinian_Island_COUNTRY_STR "Tinian Island"
+#define Togo_COUNTRY_STR "Togo"
+#define Tokelau_COUNTRY_STR "Tokelau"
+#define Tonga_COUNTRY_STR "Tonga"
+#define Trinadad_and_Tabago_COUNTRY_STR "Trinadad and Tabago"
 #define Tunisia_COUNTRY_STR "Tunisia"
 #define Turkey_COUNTRY_STR "Turkey"
+#define Turkmenistan_COUNTRY_STR "Turkmenistan"
+#define Turks_and_Caicos_Islands_COUNTRY_STR "Turks and Caicos Islands"
+#define Tuvalu_COUNTRY_STR "Tuvalu"
+#define Uganda_COUNTRY_STR "Uganda"
 #define United_Arab_Emirates_COUNTRY_STR "United Arab Emirates"
 #define Uruguay_COUNTRY_STR "Uruguay"
 #define UK_COUNTRY_STR "UK"
 #define Ukraine_COUNTRY_STR "Ukraine"
+#define US_Virgin_Islands "United States Virgin Islands"
+#define Uzbekistan_COUNTRY_STR "Uzbekistan"
+#define Vanuatu_COUNTRY_STR "Vanuatu"
 #define Vatican_City_COUNTRY_STR "Vatican City"
 #define Venezuela_COUNTRY_STR "Venezuela"
 #define Vietnam_COUNTRY_STR "Vietnam"
+#define Wallis_and_Futuna_Islands_COUNTRY_STR "Wallis and Futuna Islands"
+#define Western_Samoa_COUNTRY_STR "Western Samoa"
 #define Yemen_COUNTRY_STR "Yemen"
 #define Yugoslavia_COUNTRY_STR "Yugoslavia"
 #define Zaire_COUNTRY_STR "Zaire"
+#define Zambia_COUNTRY_STR "Zambia"
 #define Zimbabwe_COUNTRY_STR "Zimbabwe"
 #define NON_COUNTRY_FUNNY_STR "Illegal alien"
 #define NON_COUNTRY_STR "Not entered"
diff -u -r micq-0.4.6/file_util.c micq-0.4.7/file_util.c
--- micq-0.4.6/file_util.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/file_util.c	Fri Apr  6 21:32:23 2001
@@ -26,7 +26,6 @@
 #endif
 
 BOOL Log_Dir_Normal( void );
-char * Get_Log_Dir( void );
 
 #define      ADD_COMMAND(a, b)     else if ( ! strcasecmp( tmp, a) )   \
           {                                                          \
@@ -42,30 +41,13 @@
 
 void Set_rcfile( char * name )
 {
-   char *path;
-   char *home;
+	char *path;
 
 	if ( NULL == name ) {
-		
-#ifdef _WIN32
-   path = ".\\";
-#endif
-
-#ifdef UNIX
-   home = getenv( "HOME" );
-   path = malloc( strlen( home ) + 2 );
-   strcpy( path, home );
-   if ( path[ strlen( path ) - 1 ] != '/' )
-      strcat( path, "/" );
-#endif
-
-#ifdef __amigaos__
-   path = "PROGDIR:";
-#endif
-
-   strcpy( rcfile, path );
-   strcat( rcfile, ".micqrc" );
-
+		path = Get_Default_Path();
+		strcpy( rcfile, path );
+		strcat( rcfile, ".micqrc" );
+		free( path );
 	} else {
 		strncpy( rcfile, name, 256 );
 		name[255] = 0;
@@ -218,6 +200,7 @@
     strcpy(update_cmd, "update");
     strcpy(togig_cmd, "togig");
     strcpy(iglist_cmd, "i");
+    strcpy(reset_cmd, "reset");
    
    Current_Status = STATUS_ONLINE;
    
@@ -280,6 +263,7 @@
    togig_cmd[0]='\0';   /* for error checking later */
    iglist_cmd[0]='\0';   /* for error checking later */
    about_cmd[0]='\0';   /* for error checking later */
+   reset_cmd[0]='\0';	/* same sh!t */
    passwd[0] = 0;
    UIN = 0;
    away_time = default_away_time;
@@ -346,6 +330,10 @@
             {  set_status = atoi( strtok( NULL, " \n\t" ) ); }
          else if ( ! strcasecmp( tmp, "Auto" ) )
             { auto_resp = TRUE; }
+         else if ( ! strcasecmp( tmp, "Reconnect" ) )
+            { force_link = TRUE; }
+         else if ( ! strcasecmp( tmp, "Auto-Again" ) )
+            { auto_again = TRUE; }
          ADD_COMMAND( "clear_cmd", clear_cmd )
          ADD_COMMAND( "message_cmd", message_cmd )
          ADD_COMMAND( "info_cmd", info_cmd )
@@ -402,6 +390,7 @@
          ADD_COMMAND( "update_cmd", update_cmd )
          ADD_COMMAND( "url_cmd", url_cmd )
          ADD_COMMAND( "about_cmd", about_cmd )
+         ADD_COMMAND( "reset_cmd", reset_cmd )
          else if ( ! strcasecmp( tmp, "Tab" ) )
          {
             if ( spooled_tab_nicks < TAB_SLOTS )
@@ -584,8 +573,8 @@
        strcpy(iglist_cmd, "i");
    if(about_cmd[0]=='\0')
        strcpy(about_cmd, "about");
-
-
+   if(reset_cmd[0]=='\0')
+       strcpy(reset_cmd, "reset");
    if(change_cmd[0]=='\0')
        strcpy(change_cmd, "change");
    if ( Verbose )
@@ -677,24 +666,28 @@
 
 #if 0
    /* Deprecated */
-   if ( Logging )
-      M_fdprint( rcf, "#No_Log\n" );
-   else
-      M_fdprint( rcf, "No_Log\n" );
+   if ( Logging ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "No_Log\n" );
 #endif
-   if ( Color )
-      M_fdprint( rcf, "#No_Color\n" );
-   else
-      M_fdprint( rcf, "No_Color\n" );
-   if ( Russian )
-      M_fdprint( rcf, "\nRussian\n#if you want KOI8-R/U to CP1251 Cyrillic translation uncomment the above line.\n" );
-   else
-      M_fdprint( rcf, "\n#Russian\n#if you want KOI8-R/U to CP1251 Cyrillic translation uncomment the above line.\n" );
-  if( JapaneseEUC ) {
-    M_fdprint( rcf, "\nJapaneseEUC\n#if you want Shift-JIS <-> EUC Japanese translation uncomment the above line.\n" );
-  } else {
-    M_fdprint( rcf, "\n#JapaneseEUC\n#if you want Shift-JIS <-> EUC Japanese translation uncomment the above line.\n" );
-  }
+   if ( Color ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "No_Color\n" );
+
+   M_fdprint( rcf, "# uncomment to stay on the unstable connection and reconnect after network lag\n");
+   if ( ! force_link ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "Reconnect\n");
+
+   M_fdprint( rcf, "# uncomment to consider again_cmd is used by default\n");
+   if ( ! auto_again ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "Auto-Again\n");
+
+   M_fdprint( rcf, "# uncomment if you want KOI8-R/U to CP1251 Cyrillic translation\n" );
+   if ( ! Russian ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "Russian\n");
+
+   M_fdprint( rcf, "# uncomment if you want Shift-JIS <-> EUC Japanese translation\n" );
+   if( ! JapaneseEUC ) M_fdprint( rcf, "#");
+   M_fdprint( rcf, "JapaneseEUC\n");
+
    if ( auto_resp )
       M_fdprint( rcf, "\n#Automatic responses on.\nAuto\n" );
    else
@@ -736,6 +729,7 @@
    M_fdprint( rcf, "url_cmd %s\n",url_cmd);
    M_fdprint( rcf, "update_cmd %s\n",update_cmd);
    M_fdprint( rcf, "about_cmd %s\n",about_cmd);
+   M_fdprint( rcf, "reset_cmd %s\n",reset_cmd);
 
    M_fdprint( rcf, "\n#Now auto response messages\n" );     
    M_fdprint( rcf, "auto_rep_str_away %s\n",auto_rep_str_away);
diff -u -r micq-0.4.6/icq_response.c micq-0.4.7/icq_response.c
--- micq-0.4.6/icq_response.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/icq_response.c	Tue Apr  3 17:18:59 2001
@@ -723,10 +723,10 @@
 void Do_Msg( SOK_T sok, DWORD type, WORD len, char * data, DWORD uin )
 {
    char *tmp;
-	int   x,m;
-   char message[1024];
-   char url_data[1024];
-   char url_desc[1024];
+   int  x,m;
+   char message[URLMSGSIZE];
+   char url_data[URLDATASIZE];
+   char url_desc[URLDESCSIZE];
 
    add_tab( uin );
 
@@ -870,13 +870,28 @@
       }
       *tmp = 0;
       char_conv ("wc",data);
-      strcpy (url_desc,data);
+      strncpy (url_desc, data, URLDESCSIZE);
+      if (strlen(data) >= URLDESCSIZE) url_desc[URLDESCSIZE - 1] = '\0';
       tmp++;
       data = tmp;
       char_conv ("wc",data);
-      strcpy (url_data,data);
-      
-      sprintf (message,"Description: %s \n                          URL: %s",url_desc,url_data);  
+      strncpy (url_data, data, URLDATASIZE);
+      if (strlen(data) >= URLDATASIZE) url_data[URLDATASIZE - 1] = '\0';
+#ifdef HAVE_SNPRINTF
+      snprintf (message, sizeof(message),
+      		 "        URL: %s\nDescription: %s", url_data,url_desc);
+#else
+      strcpy (message, "        URL: ");
+      strncat (message, url_data, sizeof(message));
+      if (message[sizeof(message) - 1] != '\0')
+		message[sizeof(message) - 1] != '\0';
+      if (strlen(message) < sizeof(message)) {
+	strncat( message, "Description: ", sizeof(message));
+	strncat( message, url_desc, sizeof(message));
+	if (message[sizeof(message) - 1] != '\0')
+		message[sizeof(message) - 1] != '\0';
+      }
+#endif
       if ( UIN2nick( uin ) != NULL )
          log_event( uin, LOG_MESS, "You received URL message from %s\n%s\n", UIN2nick(uin), message );
       else
diff -u -r micq-0.4.6/micq.c micq-0.4.7/micq.c
--- micq-0.4.6/micq.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/micq.c	Fri Apr  6 21:28:05 2001
@@ -119,6 +119,8 @@
 WORD s5DestPort;
 /* SOCKS5 stuff end */
 
+BOOL force_link = FALSE;
+BOOL auto_again = FALSE;
 BOOL auto_resp=FALSE;
 char auto_rep_str_dnd[450] = { DND_DEFAULT_STR };
 char auto_rep_str_away[450] = { AWAY_DEFAULT_STR };
@@ -159,6 +161,7 @@
 char rand_cmd[16];
 char color_cmd[16];
 char sound_cmd[16];
+char reset_cmd[16];
 
 /*** auto away values ***/
 int idle_val=0;
@@ -444,7 +447,7 @@
 {
    srv_net_icq_pak pak;
    static DWORD last_seq=-1;
-   int s;
+   int s, t;
    
    s = SOCKREAD( sok, &pak.head.ver, sizeof( pak ) - 2  );
    if ( s < 0 )
@@ -456,14 +459,20 @@
    M_print( "Seq : %08X\t",Chars_2_DW( pak.head.seq ) );
    M_print( "Ses : %08X\n",Chars_2_DW( pak.head.session ) );
 #endif
-   if ( Chars_2_Word( pak.head.ver ) != ICQ_VER ) {
-       	R_undraw();
+   t = Chars_2_Word( pak.head.ver );
+   if ( t != ICQ_VER ) {
+     R_undraw();
+     if ( t == BADPASS_VER ) {
+	M_print( "Incorrect password\n" );
+	Quit = TRUE;
+     } else {
 	   M_print( "Invalid server response:\tVersion: %d\n", Chars_2_Word( pak.head.ver ) );
 	if ( Verbose ) {
 		Hex_Dump( pak.head.ver, s );
 	}
-	R_redraw();
-	return;
+     }
+     R_redraw();
+     return;
    }
   if ( Chars_2_DW( pak.head.session ) != our_session ) {
      if ( Verbose ) {
@@ -482,8 +491,8 @@
     if ( ( Chars_2_Word( pak.head.cmd ) != SRV_NEW_UIN ) &&
 	( Is_Repeat_Packet( Chars_2_Word( pak.head.seq ) ) ) )
     {
-      if ( Chars_2_Word( pak.head.seq ) == 0 ) {;} else {  /*yes ugly*/
-      if ( Chars_2_Word( pak.head.cmd ) != SRV_ACK ) /* ACKs don't matter */
+      if ( Chars_2_Word( pak.head.seq ) != 0 &&
+           Chars_2_Word( pak.head.cmd ) != SRV_ACK ) /* ACKs don't matter */
       {
          if ( Verbose ) {
        	    R_undraw();
@@ -493,7 +502,6 @@
          ack_srv( sok, Chars_2_DW( pak.head.seq ) ); /* LAGGGGG!! */
          return;
       }
-      }
    }
    if ( Chars_2_Word( pak.head.cmd ) != SRV_ACK )
    {
@@ -612,6 +620,17 @@
    M_print( "No reverse engineering or decompilation of any Mirabilis code took place\nto make this program.\n" );
 #endif
 
+#ifdef DENY_ROOT
+   if (getuid() == 0 || geteuid() == 0) {
+#ifdef FUNNY_MSGS
+   M_print( "\nSorry, no roots allowed. " SERVCOL "KIA." NOCOL "\n\n" );
+#else
+   M_print( "\nDenied to run under superuser privileges.\n\n" );
+#endif
+	exit( 0 );
+   }
+#endif
+
    /* aaron
     "tabs" is a neat feature, but if you've talked to less than TAB_SLOTS
     people, the first person in the list will repeat. This appears to be
@@ -694,6 +713,7 @@
    R_init ();
    M_print ("\n");
    Prompt();
+   Get_Log_Dir();
    for ( ; !Quit; )
    {
       Idle_Check( sok );
diff -u -r micq-0.4.6/micq.h micq-0.4.7/micq.h
--- micq-0.4.6/micq.h	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/micq.h	Fri Apr  6 21:34:16 2001
@@ -19,7 +19,7 @@
    2-26-99 Added TAB_SLOTS, tab_array, add_tab() and get_tab() (Lalo)
 **********************************************
 **********************************************/
-#define MICQ_VERSION "0.4.6 now with word wrapping to fit the screen.\t"
+#define MICQ_VERSION "0.4.7 now with force-link (Reconnect) and Auto-Again features.\t"
 
 #include "config.h"
 #include "datatype.h"
@@ -76,6 +76,7 @@
 #define default_away_time 600
 
 #define ICQ_VER 0x0005
+#define BADPASS_VER 0x0003
 
 #define STDIN 0
 #define STDOUT 1
@@ -288,6 +289,12 @@
 #define VIS_LIST_UPDATE 0x02
 #define CONT_LIST_UPDATE 0x00
 
+/* subject to define all the sizes needed */
+/* #define URLMSGSIZE	1024 */ 
+#define URLDATASIZE	1024
+#define URLDESCSIZE	1024
+#define URLMSGSIZE	URLDATASIZE + URLDESCSIZE + 82
+
 /*#define USA_COUNTRY_CODE 0x01
 #define UK_COUNTRY_CODE 0x2C*/
 #if ICQ_VER == 0x0005
@@ -580,7 +587,9 @@
 void Set_rcfile( char * name );
 void Got_SEQ( WORD this_seq );
 BOOL Is_Repeat_Packet( WORD this_seq );
-char * Set_Log_Dir( const char *newpath );
+char * Set_Log_Dir( char *newpath );
+char * Get_Default_Path( void );
+char * Get_Log_Dir( void );
 
 extern Contact_Member Contacts[ MAX_CONTACTS ]; /* no more than 100 contacts max */
 extern int Num_Contacts;
@@ -613,6 +622,8 @@
 /* SOCKS5 stuff end */
  
 extern DWORD set_status;
+extern BOOL force_link;
+extern BOOL auto_again;
 extern BOOL auto_resp;
 extern char auto_rep_str_na[450];
 extern char auto_rep_str_away[450];
@@ -655,6 +666,7 @@
 extern char online_list_cmd[16];
 extern char togig_cmd[16];
 extern char iglist_cmd[16];
+extern char reset_cmd[16];
 
 extern BOOL Russian;
 extern BOOL JapaneseEUC;
diff -u -r micq-0.4.6/msg_queue.c micq-0.4.7/msg_queue.c
--- micq-0.4.6/msg_queue.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/msg_queue.c	Wed Jan 24 19:07:33 2001
@@ -135,14 +135,12 @@
                M_print( "\nRemoved message with SEQ %04X CMD ", queued_msg->seq>>16);
 	       Print_CMD( Chars_2_Word( &queued_msg->body[CMD_OFFSET] ) );
 	       M_print( " from resend queue because of ack.\n" );
+	       if ( Chars_2_Word( &queued_msg->body[CMD_OFFSET] ) == CMD_SENDM ) {
+		 M_print( MESSAGE_QUEUED_1_STR );
+		 Print_UIN_Name( Chars_2_DW( &queued_msg->body[PAK_DATA_OFFSET] ) );
+		 M_print( MESSAGE_QUEUED_2_STR );
+               }
 	       R_redraw ();
-           }
-	   if ( Chars_2_Word( &queued_msg->body[CMD_OFFSET] ) == CMD_SENDM ) {
-		R_undraw();
-		M_print( MESSAGE_SENT_1_STR );
-		Print_UIN_Name( Chars_2_DW( &queued_msg->body[PAK_DATA_OFFSET] ) );
-		M_print( MESSAGE_SENT_2_STR );
-		R_redraw();
            }
            free(queued_msg->body);
            free(queued_msg);
diff -u -r micq-0.4.6/russian.h micq-0.4.7/russian.h
--- micq-0.4.6/russian.h	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/russian.h	Tue Apr  3 22:54:53 2001
@@ -2,6 +2,7 @@
 It is the header for Matt's ICQ clone with russian words, written by
 Dima Veselov, 2:5030/175.1002.UIN #6809219  email:kab00m@zyzop.da.ru. Version 2.4
 slightly corrected: sts@card.ru 19990525
+corrected further: gvs@rinet.ru 20010316
 */
 
 #define LOGGED_OFF_STR " отключился."
@@ -11,63 +12,55 @@
 #define CHANGE_STATUS_STR " сменил статус на "
 #define UNKNOWN_COMMAND_STR "Неизвестная команда %s, неберите /help для справки."
 
-#define Puerto_Rico_COUNTRY_STR "Пуэрто Рико"
-#define Tinian_Island_COUNTRY_STR "Остров Тинии"
-#define Togo_COUNTRY_STR "Того"
-#define Tokelau_COUNTRY_STR "Токелау"
-#define Tonga_COUNTRY_STR "Тонга"
-#define Trinadad_and_Tabago_COUNTRY_STR "Тринидад и Табако"
-#define Turkmenistan_COUNTRY_STR "Туркменистан"
-#define Turks_and_Caicos_Islands_COUNTRY_STR "Острова Турк и Кайкос"
-#define Tuvalu_COUNTRY_STR "Тувалу"
-#define Uganda_COUNTRY_STR "Уганда"
-#define US_Virgin_Islands "Соединенные Штаты Островов Вирджинии"
-#define Uzbekistan_COUNTRY_STR "Узбекистан"
-#define Vanuatu_COUNTRY_STR "Вануату"
-#define Wallis_and_Futuna_Islands_COUNTRY_STR "Острова Валлис и Футуна"
-#define Western_Samoa_COUNTRY_STR "Западная Самоя"
-#define Zambia_COUNTRY_STR "Замбия"
-
+#define EMAIL_INFO_STR    	"E-mail         : "
+#ifdef FUNNY_MSGS
+#define NICKNAME_INFO_STR 	"Кликуха        : "
+#define NAME_INFO_STR     	"Звать          : "
+#define OTHER_EMAIL_INFO_STR	"Ещё e-mail     : "
+#define LOCATION_INFO_STR 	"Местность      : "
+#define CELLULAR_INFO_STR 	"Мобила         : "
+#define SEX_UNKNOWN_INFO_STR "Пол : паркетный"
+#define BIRTH_INFO_STR		"День варенья   : "
+#else
 #define NICKNAME_INFO_STR 	"Ник            : "
 #define NAME_INFO_STR     	"Имя            : "
-#define EMAIL_INFO_STR    	"E-mail         : "
 #define OTHER_EMAIL_INFO_STR 	"Другой e-mail  : "
-#define OLD_EMAIL_INFO_STR 	"Старый e-mail  : "
 #define LOCATION_INFO_STR 	"Местоположение : "
+#define CELLULAR_INFO_STR 	"Мобильный      : "
+#define BIRTH_INFO_STR		"День рожденья  : "
+#define SEX_UNKNOWN_INFO_STR "Пол : Не указан"
+#endif
+#define OLD_EMAIL_INFO_STR 	"Старый e-mail  : "
 #define PHONE_INFO_STR 		"Телефон        : "
 #define FAX_INFO_STR   		"Факс           : "
 #define STREET_INFO_STR 	"Улица          : "
-#define CELLULAR_INFO_STR 	"Cellular       : "
-#define ZIP_INFO_STR 		"Zip            : "
+#define ZIP_INFO_STR 		"Индекс         : "
 #define COUNTRY_INFO_STR 	"Страна         : "
 #define COUNTRY_CODE_INFO_STR 	"Код страны     : "
 #define WORK_COUNTRY_CODE_INFO_STR  "Код страны работы : " 
 #define WORK_COUNTRY_INFO_STR	"Страна работы  : " 
-#define WORK_HOMEPAGE_INFO_STR 	"Странца работы : " 
+#define WORK_HOMEPAGE_INFO_STR 	"Сайт работы    : " 
 #define WORK_OCCUPATION_INFO_STR "Занятие        : "
 #define WORK_JOB_POS_INFO_STR 	"Должность      : " 
-#define WORK_DEPT_INFO_STR 	"Департамент    : " 
+#define WORK_DEPT_INFO_STR 	"Подразделение  : " 
 #define WORK_COMP_NAME_INFO_STR "Место работы   : " 
-#define WORK_ZIP_INFO_STR       "Zip работы     : " 
+#define WORK_ZIP_INFO_STR       "Индекс работы  : " 
 #define WORK_FAX_INFO_STR 	"Рабочий факс   : " 
-#define WORK_ADDRESS_INFO_STR 	"Раюочий адрес  : " 
+#define WORK_ADDRESS_INFO_STR 	"Рабочий адрес  : " 
 #define WORK_PHONE_INFO_STR 	"Рабочий телефон: " 
 #define WORK_LOCATION_INFO_STR 	"Местоположение работы : "
 #define ABOUT_INFO_STR "Инфа : "
 #define INFO_NE_STR "Не указано"
-#define AGE_INFO_STR "Возраст      : "
+#define AGE_INFO_STR		"Возраст        : "
 #define FEMALE_INFO_STR "Пол : Женский"
 #define MALE_INFO_STR "Пол : Мужской"
-#define SEX_UNKNOWN_INFO_STR "Пол : Не указан"
-#define HOMEPAGE_INFO_STR "Homepage     : "
-#define BIRTH_INFO_STR "Родился      : "
-#define LANGUAGE_INFO_STR "Языки        : "
+#define HOMEPAGE_INFO_STR	"Homepage       : "
+#define LANGUAGE_INFO_STR "Языки          : "
 
 #define STATUS_OFFLINE_STR "Отключен"
 /***************************************************************************/
 #define STATUS_HELP_STR "\t\tПоказывает сохраненную информацию о пользователе\n"
 #define UPDATE_OTHER_HELP_STR "\t\tОбновляет другую инфу о пользователе, типа возраста и пола\n"
-#define ARMENIAN_LANG_STR "Армянский"
 #define UPDATE_LANG_STR "Выберите язык по номеру или нажмите L: "
 #define UPDATE_AGE_STR "Введите возраст: "
 #define UPDATE_SEX_STR "Введите пол: "
@@ -86,14 +79,15 @@
 #define PHONE_UPDATE_STR "Введите телефон: "
 #define FAX_UPDATE_STR "Введите факс: "
 #define STREET_UPDATE_STR "Введите адрес: "
-#define CELLULAR_UPDATE_STR "Введите номер квартиры: "
-#define ZIP_UPDATE_STR "Введите zip (должен быть числовым): "
+#define CELLULAR_UPDATE_STR "Введите номер мобилы: "
+#define ZIP_UPDATE_STR "Введите почтовый индекс (число): "
 #define COUNTRY_UPDATE_STR "Введите телефонный код страны: "
 #define TIME_ZONE_UPDATE_STR "Введите свою временную зону (+/- 0-12): "
 #define LAST_HELP_STR "\t\tПоказывает последнее сообщение от <nick>.\n\t\t\tОни должны быть в Вашем контакт листе.\n"
 
-#define KAZAKHSTAN_COUNTRY_STR "Казахский"
+/* languages - so far so many */
 #define ARABIC_LANG_STR "Арабский"
+#define ARMENIAN_LANG_STR "Армянский"
 #define BHOJPURI_LANG_STR "Бжоржпурский"
 #define BULGARIAN_LANG_STR "Болгарский"
 #define BURMESE_LANG_STR "Боурмезийский"
@@ -107,20 +101,21 @@
 #define ENGLISH_LANG_STR "Английский"
 #define ESPERANTO_LANG_STR "Эсперанто"
 #define ESTONIAN_LANG_STR "Эстонский"
-#define FARSI_LANG_STR "Фарзи"
+#define FARSI_LANG_STR "Фарси"
 #define FINNISH_LANG_STR "Финский"
 #define FRENCH_LANG_STR "Французский"
 #define GAELIC_LANG_STR "Гальский"
 #define GERMAN_LANG_STR "Немецкий"
 #define GREEK_LANG_STR "Грецкий"
-#define HEBREW_LANG_STR "Хебрев"
+#define HEBREW_LANG_STR "Иврит"
 #define HINDI_LANG_STR "Хинди"
 #define HUNGARIAN_LANG_STR "Венгерский"
 #define ICELANDIC_LANG_STR "Островитянский"
 #define INDONESIAN_LANG_STR "Индонезийский"
 #define ITALIAN_LANG_STR "Итальянский"
 #define JAPANESE_LANG_STR "Японский"
-#define KHMER_LANG_STR "Хмер"
+#define KAZAKHSTAN_COUNTRY_STR "Казахский"
+#define KHMER_LANG_STR "Кхмерский"
 #define KOREAN_LANG_STR "Корейский"
 #define LAO_LANG_STR "Ляо"
 #define LATVIAN_LANG_STR "Латвийский"
@@ -132,7 +127,7 @@
 #define ROMANIAN_LANG_STR "Румынский"
 #define RUSSIAN_LANG_STR "Русский"
 #define SERBOCROATIAN_LANG_STR "Сербо-хорватский"
-#define SLOVAK_LANG_STR "Словакский"
+#define SLOVAK_LANG_STR "Словацкий"
 #define SLOVENIAN_LANG_STR "Словенский"
 #define SOMALI_LANG_STR "Сомали"
 #define SPANISH_LANG_STR "Испанский"
@@ -147,7 +142,7 @@
 #define VIETNAMESE_LANG_STR "Вьетнамский"
 #define YIDDISH_LANG_STR "Идиш"
 #define YORUBA_LANG_STR "Йоруба"
-#define AFRIKAANS_LANG_STR "Африканский"
+#define AFRIKAANS_LANG_STR "Африкаанс"
 #define BOSNIAN_LANG_STR "Боснийский"
 #define PERSIAN_LANG_STR "Персидский"
 #define ALBANIAN_LANG_STR "Албанский"
@@ -156,7 +151,11 @@
 #define NONE_LANG_STR "нет"
 
 /********************************************************************/
+#ifdef FUNNY_MSGS
 #define NON_MONTH_STR "Фиг"
+#else
+#define NON_MONTH_STR "---"
+#endif
 #define JAN_MONTH_STR "Янв"
 #define FEB_MONTH_STR "Фев"
 #define MAR_MONTH_STR "Мар"
@@ -180,8 +179,8 @@
 #define ONLINE_LIST_HELP_STR "\t\t\tТекущий статус подключенных людей из вашей книжки\n"
 #define ENTER_PW_STR "Введите пароль : "
 #define AUTO_STATUS_CHANGE_STR "\nСтатус автоматически изменен на "
-#define INTEL_BO_STR "Используется intel byte ordering."
-#define MOTOROLA_BO_STR "Используется motorola byte ordering."
+#define INTEL_BO_STR "Используется порядок байт intel."
+#define MOTOROLA_BO_STR "Используется порядок байт motorola."
 #define IGNORE_CMD_STR "\nИгнорирована команда сообщения %04x\n"
 
 /* Networking Error Messages */
@@ -207,7 +206,7 @@
 #define AWAY_DEFAULT_STR "Пользователя нет [Auto-Message]"
 #define NA_DEFAULT_STR "Пользователь недоступен [Auto-Message]"
 #define OCC_DEFAULT_STR "Пользователь занят [Auto-Message]"
-#define INV_DEFAULT_STR "Пользователь отключен"
+#define INV_DEFAULT_STR "Пользователь отсутствует"
 #endif
 
 
@@ -234,6 +233,7 @@
 #define ALTER_HELP_STR "\tПереопределить команды на лету.\n"
 #define VERBOSE_HELP_STR "\t\t\tУстановить уровень скрин-лога.\n\t\t\t\t(по умолчанию 0).\n"
 #define CLEAR_HELP_STR "\t\t\t\tОчистить экран.\n"
+#define RESET_HELP_STR "\t\t\t\tВосстановить аттрибуты терминала.\n"
 #define SOUND_HELP_STR "\t\t\t\tОтключить звук приема новых сообщений.\n"
 #define COLOR_HELP_STR "\t\t\t\tИзменить цвета.\n"
 #define QUIT_HELP_STR "\t\t\tОтключится от сервера и выйти\n"
@@ -276,13 +276,15 @@
 #define EMAIL_UPDATE_STR "e-mail : "
 #define AUTH_QUESTION_STR "Требовать авторизации у других пользователей? : "
 
-#define YESNO_RESPONSE_STR "Пожалуйста введите " YES_STR " or " NO_STR "\n"
+#define YESNO_RESPONSE_STR "Пожалуйста, введите " YES_STR " or " NO_STR "\n"
 #define MESSAGE_BUFFER_FULL_STR "Сообщение было послано, когда закончился буфер\n"
 #define MESSAGE_CANCELED_STR "Сообщение не послано\n"
 /* Having 2 strings with the nickname inserted in the middle */
 /* will hopefully solve any potential word order problems */
 #define MESSAGE_SENT_1_STR  "Сообщение ушло "
 #define MESSAGE_SENT_2_STR  "!\n"
+#define MESSAGE_QUEUED_1_STR "Сообщение для "
+#define MESSAGE_QUEUED_2_STR "поставлено в очередь...\n"
 
 /********************************************************************/
 /* Simple Yes no response*/
@@ -330,7 +332,7 @@
 #define ACCOUNT_CAT_STR "Account"
 
 /* Help strings for each command */
-#define PASS_HELP_STR "\t\tСменить Ваш пароль на секретный.\n"
+#define PASS_HELP_STR "\t\tСменить Ваш пароль на <пароль>.\n"
 #define MSG_HELP_STR "\t\tПослать сообщение на uin\n"
 #define URL_HELP_STR "\tПослать сообщение и URL на uin\n"
 #define MSGA_HELP_STR "\t\tПослать многостроковое сообщение всем .\n\t\t\t\tв контакт-листе.\n"
@@ -358,8 +360,8 @@
 #define NA_HELP_STR "\t\tРежим 'Не доступен'.\n"
 #define OCC_HELP_STR "\t\tРежим 'Занят'.\n"
 #define DND_HELP_STR "\t\tРежим 'Не беспокоить'.\n"
-#define FFC_HELP_STR "\t\tРежим 'Готов пообщатся'.\n"
-#define INV_HELP_STR "\t\tРежим 'Невидимость'.\n"
+#define FFC_HELP_STR "\t\tРежим 'Готов пообщаться'.\n"
+#define INV_HELP_STR "\t\tРежим 'Невидим'.\n"
 #define UPDATE_HELP_STR "\t\tИзменить информацию о Вас на сервере (email, имя, и т.д..)\n"
 #define SET_RAND_HELP_STR "\t\tУказать вашу группу для случайных пользователей.\n"
 
@@ -374,8 +376,8 @@
 #define W_OFFLINE_STR "Отсутствующие люди: "
 #define W_ONLINE_STR "Люди на линии: "
 
-#define MSG_PROMPT_STR "msg> "
-#define MSGA_PROMPT_STR "msg all> "
+#define MSG_PROMPT_STR "Вам> "
+#define MSGA_PROMPT_STR "Всем!> "
 
 /* These are used durring user info updates. */
 #define NICK_NAME_UPDATE_STR "Ваша новая кличка : "
@@ -391,6 +393,8 @@
 /* will hopefully solve any potential word order problems */
 #define MESSAGE_SENT_1_STR  "Сообщение ушло "
 #define MESSAGE_SENT_2_STR  "\n"
+#define MESSAGE_QUEUED_1_STR "Сообщение для "
+#define MESSAGE_QUEUED_2_STR "поставлено в очередь... "
 
 /********************************************************************/
 /* Simple Yes no response*/
@@ -423,10 +427,10 @@
 
 /* Various Strings */
 #define LENGTH_STR "Длина"
-#define EXTRA_DATA_STR "Extra Data"
+#define EXTRA_DATA_STR "Доп. данные"
 #define SEQ_STR "SEQ"
 #define VER_STR "Ver"
-#define LOGIN_SUCCESS_STR "Логин на сервер прошел нормально!"
+#define LOGIN_SUCCESS_STR "Вход на сервер прошел нормально!"
 #define SERVER_ACK_STR "Сервер послал Вам команду %04x."
 
 #endif
@@ -436,10 +440,10 @@
 #define Afghanistan_COUNTRY_STR "Афганистан"
 #define Albania_COUNTRY_STR "Албания"
 #define Algeria_COUNTRY_STR "Алжир"
-#define American_Samoa_COUNTRY_STR "American Samoa"
+#define American_Samoa_COUNTRY_STR "Американское Самоа"
 #define Andorra_COUNTRY_STR "Андорра"
 #define Angola_COUNTRY_STR "Ангола"
-#define Anguilla_COUNTRY_STR "Анжилла"
+#define Anguilla_COUNTRY_STR "Ангилла"
 #define Antigua_COUNTRY_STR "Антигуа"
 #define Argentina_COUNTRY_STR "Аргентина"
 #define Armenia_COUNTRY_STR "Армения"
@@ -463,7 +467,7 @@
 #define Bosnia_Herzegovina_COUNTRY_STR "Босния и Герцеговина"
 #define Botswana_COUNTRY_STR "Ботсвана"
 #define Brazil_COUNTRY_STR "Бразилия"
-#define British_Virgin_Islands_COUNTRY_STR "British Virgin Islands"
+#define British_Virgin_Islands_COUNTRY_STR "Британские ненаселённые острова"
 #define Brunei_COUNTRY_STR "Брюней"
 #define Bulgaria_COUNTRY_STR "Болгария"
 #define Burkina_Faso_COUNTRY_STR "Буркина Фасо"
@@ -471,15 +475,15 @@
 #define Cambodia_COUNTRY_STR "Камбоджа"
 #define Cameroon_COUNTRY_STR "Камерун"
 #define Canada_COUNTRY_STR "Канада"
-#define Cape_Verde_Islands_COUNTRY_STR "Cape Verde Islands"
-#define Cayman_Islands_COUNTRY_STR "Cayman Islands"
+#define Cape_Verde_Islands_COUNTRY_STR "Острова Капе Верде"
+#define Cayman_Islands_COUNTRY_STR "Острова Каймана"
 #define Central_African_Republic_COUNTRY_STR "Центральноафриканская Республика"
 #define Chad_COUNTRY_STR "Чад"
-#define Christmas_Island_COUNTRY_STR "Christmas Island"
+#define Christmas_Island_COUNTRY_STR "Остров Рождества"
 #define Cocos_Keeling_Islands_COUNTRY_STR "Cocos-Keeling Islands"
 #define Comoros_COUNTRY_STR "Comoros"
 #define Congo_COUNTRY_STR "Конго"
-#define Cook_Islands_COUNTRY_STR "Cook Islands"
+#define Cook_Islands_COUNTRY_STR "Острова Кука"
 #define Chile_COUNTRY_STR "Чили"
 #define China_COUNTRY_STR "Китай"
 #define Columbia_COUNTRY_STR "Колумбия"
@@ -494,7 +498,7 @@
 #define Dominica_COUNTRY_STR "Доминика"
 #define Dominican_Republic_COUNTRY_STR "Доминиканская республика"
 #define Ecuador_COUNTRY_STR "Эквадор"
-#define Egypt_COUNTRY_STR "Египт"
+#define Egypt_COUNTRY_STR "Египет"
 #define El_Salvador_COUNTRY_STR "Сальвадор"
 #define Equitorial_Guinea_COUNTRY_STR "Экваториальная Гвинея"
 #define Eritrea_COUNTRY_STR "Эритрия"
@@ -508,7 +512,7 @@
 #define Finland_COUNTRY_STR "Финляндия"
 #define France_COUNTRY_STR "Франция"
 #define French_Antilles_COUNTRY_STR "Антильские острова (Франция)"
-#define French_Guiana_COUNTRY_STR "French Guiana"
+#define French_Guiana_COUNTRY_STR "Французская Гвиана"
 #define French_Polynesia_COUNTRY_STR "Французская Полинезия"
 #define Gabon_COUNTRY_STR "Габон"
 #define Gambia_COUNTRY_STR "Гамбия"
@@ -524,8 +528,8 @@
 #define Guantanomo_Bay_COUNTRY_STR "Гуантанамо"
 #define Guatemala_COUNTRY_STR "Гватемала"
 #define Guinea_COUNTRY_STR "Гвинея"
-#define Guinea_Bissau_COUNTRY_STR "Гвинея Бисау"
-#define Guyana_COUNTRY_STR "Guyana"
+#define Guinea_Bissau_COUNTRY_STR "Гвинея Биссау"
+#define Guyana_COUNTRY_STR "Гайана"
 #define Haiti_COUNTRY_STR "Гаити"
 #define Honduras_COUNTRY_STR "Гондурас"
 #define Hong_Kong_COUNTRY_STR "Гонконг"
@@ -556,7 +560,7 @@
 #define Malta_COUNTRY_STR "Мальта"
 #define Mexico_COUNTRY_STR "Мексика"
 #define Monaco_COUNTRY_STR "Монако"
-#define Morocco_COUNTRY_STR "Морокко"
+#define Morocco_COUNTRY_STR "Марокко"
 #define Namibia_COUNTRY_STR "Намибия"
 #define Nepal_COUNTRY_STR "Непал"
 #define Netherlands_COUNTRY_STR "Нидерланды"
@@ -566,7 +570,7 @@
 #define Nicaragua_COUNTRY_STR "Никарагуа"
 #define Nigeria_COUNTRY_STR "Нигерия"
 #define Norway_COUNTRY_STR "Норвегия"
-#define Oman_COUNTRY_STR "Оман"
+#define Oman_COUNTRY_STR "Омен"
 #define Pakistan_COUNTRY_STR "Пакистан"
 #define Panama_COUNTRY_STR "Панама"
 #define Papua_New_Guinea_COUNTRY_STR "Папуа Новая Гвинея"
@@ -575,6 +579,7 @@
 #define Philippines_COUNTRY_STR "Филиппины"
 #define Poland_COUNTRY_STR "Польша"
 #define Portugal_COUNTRY_STR "Португалия"
+#define Puerto_Rico_COUNTRY_STR "Пуэрто Рико"
 #define Qatar_COUNTRY_STR "Катар"
 #define Romania_COUNTRY_STR "Румыния"
 #define Russia_COUNTRY_STR "Российская Федерация"
@@ -593,18 +598,33 @@
 #define Taiwan_COUNTRY_STR "Тайвань"
 #define Tanzania_COUNTRY_STR "Танзания"
 #define Thailand_COUNTRY_STR "Таиланд"
+#define Tinian_Island_COUNTRY_STR "Остров Тинии"
+#define Togo_COUNTRY_STR "Того"
+#define Tokelau_COUNTRY_STR "Токелау"
+#define Tonga_COUNTRY_STR "Тонга"
+#define Trinadad_and_Tabago_COUNTRY_STR "Тринидад и Тобаго"
 #define Tunisia_COUNTRY_STR "Тунис"
 #define Turkey_COUNTRY_STR "Турция"
+#define Turkmenistan_COUNTRY_STR "Туркменистан"
+#define Turks_and_Caicos_Islands_COUNTRY_STR "Острова Турк и Кайкос"
+#define Tuvalu_COUNTRY_STR "Тувалу"
+#define Uganda_COUNTRY_STR "Уганда"
 #define United_Arab_Emirates_COUNTRY_STR "Объединенные Арабские Эмираты"
 #define Uruguay_COUNTRY_STR "Уругвай"
-#define UK_COUNTRY_STR "Объединенное Королевство"
+#define US_Virgin_Islands "США - Острова Вирджиния"
+#define Uzbekistan_COUNTRY_STR "Узбекистан"
+#define UK_COUNTRY_STR "Соединенное Королевство Великобритании и Ирландии"
 #define Ukraine_COUNTRY_STR "Украина"
+#define Vanuatu_COUNTRY_STR "Вануату"
 #define Vatican_City_COUNTRY_STR "Ватикан"
 #define Venezuela_COUNTRY_STR "Венесуэла"
 #define Vietnam_COUNTRY_STR "Вьетнам"
+#define Wallis_and_Futuna_Islands_COUNTRY_STR "Острова Уоллис и Футуна"
+#define Western_Samoa_COUNTRY_STR "Западное Самоа"
 #define Yemen_COUNTRY_STR "Йемен"
 #define Yugoslavia_COUNTRY_STR "Югославия"
 #define Zaire_COUNTRY_STR "Заир"
+#define Zambia_COUNTRY_STR "Замбия"
 #define Zimbabwe_COUNTRY_STR "Зимбабве"
 #define NON_COUNTRY_FUNNY_STR "БОМЖ :-("
 #define NON_COUNTRY_STR "не определено"
diff -u -r micq-0.4.6/sendmsg.c micq-0.4.7/sendmsg.c
--- micq-0.4.6/sendmsg.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/sendmsg.c	Tue Apr  3 17:23:44 2001
@@ -121,8 +121,14 @@
 	       M_print( " packet." );
 	       if ( ( CMD_LOGIN == Chars_2_Word( pak.head.cmd ) ) ||
 	            ( CMD_KEEP_ALIVE == Chars_2_Word( pak.head.cmd ) ) ) {
-                  M_print( "\n\aConnection unstable. Exiting...." );
-		  Quit = TRUE;
+                  M_print( "\n\aConnection unstable. ");
+                  if ( force_link ) {
+                  	M_print( "Message is discarded.");
+                  	sleep( 5 );
+                  } else {
+                  	M_print( "Exiting...." );
+		  	Quit = TRUE;
+		  }
 	       }
 	    }
 	    M_print ("\n");
@@ -975,9 +981,15 @@
 
 void icq_sendurl( SOK_T sok, DWORD uin, char *description, char *url )
 {
-   char buf[450];
-   
-   sprintf( buf, "%s\xFE%s", url, description );
+   char buf[URLMSGSIZE];
+
+#ifdef HAVE_SNPRINTF   
+   snprintf( buf, sizeof(buf), "%s\xFE%s", url, description );
+#else
+   strncpy( buf, url, sizeof(buf) - 2);
+   strcat( buf, "\xFE" );
+   strncat( buf, description, sizeof(buf));
+#endif
    icq_sendmsg( sok, uin, buf, URL_MESS );
 }
 
diff -u -r micq-0.4.6/server.c micq-0.4.7/server.c
--- micq-0.4.6/server.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/server.c	Sun Apr  1 17:15:00 2001
@@ -239,19 +239,17 @@
    case SRV_TRY_AGAIN:
       R_undraw ();
       M_print( MESSCOL "Server is busy please try again.\nTrying again...\n");
-#ifdef UNIX
-  #ifndef __BEOS__
+#if defined( UNIX ) && !defined( __BEOS__ )
       if ( fork() == 0 )
       {
          sleep( 5 );
          Login( sok, UIN, &passwd[0], our_ip, our_port, set_status );
+         R_resume();
          exit( 0 );
       }
-  #else
-      Login( sok, UIN, &passwd[0], our_ip, our_port, set_status );
-  #endif
 #else
       Login( sok, UIN, &passwd[0], our_ip, our_port, set_status );
+      R_resume();
 #endif
      R_redraw ();
      break;
@@ -273,9 +271,26 @@
       M_print( "Server has forced us to disconnect.  This may be because of network lag.\t" );
       #endif
       Time_Stamp();
-      Quit = TRUE;
-      M_print ("\n");
-      R_redraw ();
+      if ( force_link ) {
+	M_print( ". Reconnect issued...\n");
+	R_redraw();
+#if defined( UNIX ) && !defined( __BEOS__ )
+        if ( fork() == 0 )
+        {
+          sleep( 5 );
+          Login( sok, UIN, &passwd[0], our_ip, our_port, set_status );
+          R_resume();
+          exit( 0 );
+        }
+#else
+        Login( sok, UIN, &passwd[0], our_ip, our_port, set_status );
+        R_resume();
+#endif
+      } else {
+        M_print ("\n");
+        R_redraw ();
+        Quit = TRUE;
+      }
       break;
    case SRV_END_OF_SEARCH:
       R_undraw ();
diff -u -r micq-0.4.6/ui.c micq-0.4.7/ui.c
--- micq-0.4.6/ui.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/ui.c	Mon Apr  2 14:19:00 2001
@@ -544,6 +544,7 @@
 {
    char buf[1024]; /* This is hopefully enough */
    char *cmd;
+   char *buf2;
    char *arg1;
    char *arg2;
    int i;
@@ -609,10 +610,12 @@
            Prompt();
            return;
         }
+	 buf2 = ( auto_again && buf != NULL ) ? strdup( buf ) : NULL;
          cmd = strtok( buf, " \n\t" );
         if ( NULL == cmd )
         {
            Prompt();
+           if ( buf2 != NULL ) free( buf2 );
            return;
         }
          /* goto's removed and code fixed by Paul Laufer. Enjoy! */
@@ -748,10 +751,10 @@
             }
          }
          else if ( ! strcasecmp( cmd, again_cmd ) ) /* again command */
-         {  Again_Function( sok ); }
+         {  Again_Function( sok, NULL ); }
          else if ( ! strcasecmp( cmd, clear_cmd))
    	   { /* GRYN */ *idle_val = idle_save; 
-             clrscr(); }
+             clrscr(); R_resume(); }
          else if ( ! strcasecmp( cmd, info_cmd ) )
          {  Info_Function( sok ); }
          else if ( ! strcasecmp( cmd, togig_cmd ) )
@@ -942,6 +945,8 @@
          }
          else if ( strcasecmp( cmd, auto_cmd ) == 0 )
          {  Auto_Function( sok ); }
+         else if ( ! strcasecmp( cmd, reset_cmd ) ) /* reset tty */
+         {  R_resume(); }
          else if ( strcasecmp( cmd, "tabs" ) == 0 )
          {
              /* aaron
@@ -1046,19 +1051,18 @@
 		 } else if (strcasecmp(cmd, "wide") == 0) {
 		 	PrintContactWide();
          } /* end of aaron's code */
-         else 
+         else if ( auto_again )
+         {  Again_Function( sok, buf2 ); }
+         else
          {  M_print( UNKNOWN_COMMAND_STR "\n", cmd ); }
+
+         if ( buf2 != NULL) free( buf2 );
       }
    }
    multi_uin = last_uin;
    if ( ( status == 0 ) || ( status == 2) )
    {
-      if ( ! Quit )
-#ifndef USE_MREADLINE
-         Prompt();
-#else
-         Prompt();
-#endif
+      if ( ! Quit ) Prompt();
    }
 }
 
@@ -1427,6 +1431,7 @@
    } else if ( !strcasecmp( arg1, CLIENT_CAT_STR ) ){
 	    M_print( MESSCOL "verbose #" NOCOL VERBOSE_HELP_STR);
             M_print( MESSCOL "%s" NOCOL CLEAR_HELP_STR, clear_cmd );
+            M_print( MESSCOL "%s" NOCOL RESET_HELP_STR, reset_cmd );
             M_print( MESSCOL "%s" NOCOL SOUND_HELP_STR, sound_cmd);
             M_print( MESSCOL "%s" NOCOL COLOR_HELP_STR, color_cmd);
             M_print( MESSCOL "%s\t" NOCOL QUIT_HELP_STR,quit_cmd );
@@ -1665,6 +1670,8 @@
           strncpy(msga_cmd,strtok(NULL," \n\t"),16);
    else if (!strcasecmp(cmd,about_cmd))
           strncpy(about_cmd,strtok(NULL," \n\t"),16);
+   else if (!strcasecmp(cmd,reset_cmd))
+          strncpy(reset_cmd,strtok(NULL," \n\t"),16);
    else
      M_print("Type help to see your current command, because this  one you typed wasn't one!\n");
 }
@@ -1754,7 +1761,7 @@
    }
 }
 
-static void Again_Function( SOK_T sok )
+static void Again_Function( SOK_T sok, char * buf )
 {
    char * arg1;
    
@@ -1765,9 +1772,9 @@
    }
    add_tab( last_uin );
    arg1 = strtok( NULL, "" );
-   if ( arg1 != NULL )
+   if ( arg1 != NULL || buf != NULL )
    {
-      icq_sendmsg( sok, last_uin, arg1, NORM_MESS );
+      icq_sendmsg( sok, last_uin, ( buf != NULL ) ? buf : arg1, NORM_MESS );
       M_print( MESSAGE_SENT_1_STR );
       Print_UIN_Name( last_uin );
       M_print( MESSAGE_SENT_2_STR );					 
diff -u -r micq-0.4.6/ui.h micq-0.4.7/ui.h
--- micq-0.4.6/ui.h	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/ui.h	Sat Mar 17 00:14:54 2001
@@ -55,7 +55,7 @@
 static void Alter_Function( void );
 static void Message_Function( SOK_T sok );
 static void Reply_Function( SOK_T sok );
-static void Again_Function( SOK_T sok );
+static void Again_Function( SOK_T sok, char * buf );
 static void Verbose_Function( void );
 static void Random_Function( SOK_T sok );
 static void Random_Set_Function( SOK_T sok );
diff -u -r micq-0.4.6/util.c micq-0.4.7/util.c
--- micq-0.4.6/util.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/util.c	Fri Apr  6 21:33:57 2001
@@ -40,6 +40,7 @@
 #endif
 #ifdef UNIX
    #include <unistd.h>
+   #include <pwd.h>
    #include <termios.h>
    #include "mreadline.h"
 #endif
@@ -789,49 +790,77 @@
 }
 
 /************************************************************************
-Sets the Log directory to newpath 
-if newpath is null it will set it to a reasonable default
-if newpath doesn't end with a valid directory seperator one is added.
+Find a default path for logging, etc
+if path doesn't end with a valid directory seperator one is added.
 the path used is returned.
 *************************************************************************/
-char * Set_Log_Dir( const char *newpath )
-{
-	if ( NULL == newpath ) {
-	   char *path;
-	   char *home;
-	   Normal_Log = TRUE;
-#ifdef _WIN32
-	   path = ".\\";
-#endif
 
+char * Get_Default_Path( void ) {
+	char *path;
 #ifdef UNIX
-	   home = getenv( "HOME" );
-	   path = malloc( strlen( home ) + 2 );
-	   strcpy( path, home );
-	   if ( path[ strlen( path ) - 1 ] != '/' )
-	      strcat( path, "/" );
+	char *home;
+	struct passwd * PW_Entry;
+
+	home = getenv( "HOME" );
+	if ( home == NULL ) {			/* oops */
+
+		if ( ( PW_Entry = getpwuid( getuid() ) ) != NULL )
+			home = PW_Entry->pw_dir;
+	}
+	if ( home == NULL ) {			/* oops, I did it again */
+#ifdef FUNNY_MSGS
+		M_print( "Oops, we're homeless. Doing here...\n" );
+#else
+	   	M_print( "No HOME in our environment. Using current dir...\n" );
+#endif
+		path = "./";
+	} else {
+		path = malloc( strlen( home ) + 2 );
+		strcpy( path, home );
+	}
+	if ( path[ strlen( path ) - 1 ] != '/' ) strcat( path, "/" );
+#endif
+
+#ifdef _WIN32
+	path = ".\\";
 #endif
 
 #ifdef __amigaos__
-	   path = "PROGDIR:";
+	path = "PROGDIR:";
 #endif
-		Log_Dir = path;
-		return path;
-	} else {
+	return path;
+} 
+
+/************************************************************************
+Sets the Log directory to newpath 
+if newpath is null it will set it to a reasonable default
+if newpath doesn't end with a valid directory seperator one is added.
+the path used is returned.
+*************************************************************************/
+char * Set_Log_Dir( char *newpath )
+{
+	if ( newpath != NULL ) {
 #ifdef _WIN32
 		char sep = '\\';
 #else
 		char sep = '/';
 #endif
 		Normal_Log=FALSE;
+
 		if ( newpath[ strlen( newpath ) - 1 ] != sep ) {
 			Log_Dir = malloc( strlen( newpath ) + 2 );
 			sprintf( Log_Dir, "%s%c", newpath, sep );
 		} else {
 			Log_Dir = strdup( newpath );
+			if (Log_Dir == NULL) {	/* insufficient memory */
+				Log_Dir = newpath; /* last resort action */
+			}
 		}
-		return Log_Dir;
+	} else {
+		Normal_Log = TRUE;
+		Log_Dir = Get_Default_Path();
 	}
+	return Log_Dir;
 }
 
 /************************************************************************
@@ -855,7 +884,9 @@
  *************************************************************************/
 int log_event( DWORD uin, int type, char *str, ... )
 {
+#ifdef UNIX
    char symbuf[256]; /* holds the path for a sym link */
+#endif
    FILE    *msgfd;
    va_list args;
    int k;
@@ -863,7 +894,6 @@
    char    buffer[256];
    time_t  timeval;
    char *path;
-/*   char *home; */
    struct stat statbuf;
 
    if ( ! LogType )
@@ -876,33 +906,14 @@
    va_start( args, str );
    sprintf( buf, "\n%-24.24s ", ctime(&timeval) );
    vsprintf( &buf[ strlen( buf ) ], str, args );
-
-/*************************************************      
-#ifdef _WIN32
-   path = ".\\";
-#endif
-
-#ifdef UNIX
-   home = getenv( "HOME" );
-   path = malloc( strlen( home ) + 2 );
-   strcpy( path, home );
-   if ( path[ strlen( path ) - 1 ] != '/' )
-      strcat( path, "/" );
-#endif
-
-#ifdef __amigaos__
-   path = "PROGDIR:";
-#endif
-
-   strcpy( buffer, path );
-*************************************************/
+   va_end( args );
 
    path = Get_Log_Dir();
    strcpy( buffer, path );
 
-switch (LogType) {
+   switch (LogType) {
 	case 1:
-		strcat(buffer,"micq_log");
+		strcat( buffer, "micq_log" );
 		break;
 	case 2:
 	case 3:
@@ -918,31 +929,34 @@
 #ifdef _WIN32
    	strcat( buffer, "\\" );
 #else
-  	 strcat( buffer, "/" );
+  	strcat( buffer, "/" );
 #endif
-		strcpy( symbuf, buffer);
-	   sprintf( &buffer[ strlen( buffer ) ], "%ld.log", uin );
+	sprintf( &buffer[ strlen( buffer ) ], "%ld.log", uin );
       
 #ifdef UNIX
 	if ( NULL != UIN2nick(uin) ) {
-     		 sprintf( &symbuf[strlen(symbuf)],"%s.log",UIN2nick(uin) );
-	      symlink(buffer,symbuf);
+		strcpy( symbuf, buffer);
+     		sprintf( &symbuf[strlen(symbuf)],"%s.log",UIN2nick(uin) );
+		symlink(buffer,symbuf);
 	}
 #endif        
        
 
-	   break;
-}
+	break;
+   }
+
    if( ( msgfd = fopen(buffer, "a") ) == (FILE *) NULL ) 
    {
            fprintf(stderr, "\nCouldn't open %s for logging\n",
                             buffer);
            return(-1);
    }
-/*    if ( ! strcasecmp(UIN2nick(uin),"Unknow UIN"))
+/*
+   if ( ! strcasecmp(UIN2nick(uin),"Unknown UIN"))
        fprintf(msgfd, "\n%-24.24s %s %ld\n%s\n", ctime(&timeval), desc, uin, msg);
-    else
-       fprintf(msgfd, "\n%-24.24s %s %s\n%s\n", ctime(&timeval), desc, UIN2nick(uin), msg);*/
+   else
+       fprintf(msgfd, "\n%-24.24s %s %s\n%s\n", ctime(&timeval), desc, UIN2nick(uin), msg);
+*/
 
    if ( strlen( buf ) ) {
    	fwrite( "<", 1, 1, msgfd );
@@ -954,13 +968,12 @@
    	}
    	fwrite( ">\n", 1, 2, msgfd );
    }
-   va_end( args );
      
    fclose(msgfd);
 #ifdef UNIX
    chmod( buffer, 0600 );
 #endif
-   return(0);
+   return 0;
 }
 
 /*************************************************
diff -u -r micq-0.4.6/util_ui.c micq-0.4.7/util_ui.c
--- micq-0.4.6/util_ui.c	Sat Jun 10 02:18:39 2000
+++ micq-0.4.7/util_ui.c	Tue Apr  3 17:26:15 2001
@@ -102,7 +102,11 @@
    assert( 2048 >= strlen( str ) );
    
    va_start( args, str );
-   vsprintf( buf, str, args );
+#ifdef HAVE_SNPRINTF
+   vsnprintf( buf, sizeof(buf), str, args );
+#else
+   vsprintf( buf, str, args );	/* this is still unsafe */
+#endif
    k = write( fd, buf, strlen( buf ) );
    if ( k != strlen( buf ) )
    {
@@ -292,7 +296,11 @@
    
    va_start( args, str );
 #ifndef CURSES_UI
-   vsprintf( buf, str, args );
+#ifdef HAVE_SNPRINTF
+   vsnprintf( buf, sizeof(buf), str, args );
+#else
+   vsprintf( buf, str, args );	/* this is still unsafe */
+#endif
    str2 = buf;
    while ( (void *) NULL != ( str1 = strchr( str2, '\x1b' ) ) )
    {
>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200104062022.AAA11577>