/* * copyright David J. Binette * ALL RIGHTS RESERVED */ /* ------------------------------------------------------------------------ */ /* tab stops are set to 4 */ /* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */ /* to login and get cookie */ #define SERVERAUTHHOST "edit.yahoo.com" #define SERVERAUTHPORT 80 /* to chat on */ #define SERVERCHATHOST "cs.chat.yahoo.com" #define SERVERCHATPORT 8001 #ifndef INADDR_NONE #define INADDR_NONE 0xffffffff #endif /* #define SOLARIS */ #define FREEBSD /* #define LINUX */ /* ------------------------------------------------------------------------ */ /* As of DEC 1999 Yahooseems to limit to 512 byte packets */ #define YAHOOMAXTEXTOUT 512 /* enough room for any header */ /* A nonauuthoritative guess at the maximum possible packet size */ #define YAHOOBUFOUTSIZE ( YAHOOMAXTEXTOUT + CHATNAMESIZE + CHATPASSSIZE + CHATROOMSIZE + CHATCOOKSIZE + CHATSERVSIZE + 16 + 6) /* YAHOODATAINSIZE ,normal chat packets * are limited to about 512 bytes * however there is at least one type of packet * a 'grafitti' packet that is 4096 bytes * So.. * since we dont do grafitti ,and 4096 bytes causes * stack probes to be instantiated ,we limit this * to 2048 bytes and ignore grafitti */ #define YAHOODATAINSIZE 2048 #define CHATNAMESIZE 32 #define CHATPASSSIZE 32 #define CHATROOMSIZE 32 #define CHATCOOKSIZE 512 #define CHATSERVSIZE 256 /* ------------------------------------------------------------------------ */ #ifndef YPKTIN_DEFINED #define YPKTIN_DEFINED 1 /* structure of a yahoo packet */ typedef struct YPKTIN_DEF { int type; /* packet type */ short errs; /* packet error code */ u_short size; /* size of that data */ char data[YAHOODATAINSIZE+1]; /* raw yahoo data */ char zero; /* a safety guard byte */ } YPKTIN; #endif /*YPKTIN_DEFINED*/ /* ------------------------------------------------------------------------ */ #ifndef SESSION_DEFINED #define SESSION_DEFINED 1 typedef struct SESSION_DEF { SOCKET sock; /* a network socket */ short ansi; /* DEFAULTHIGHLITE set by the /color comand */ short move; /* DEFAULTSHOWMOVE set by the /showenter command */ short away; /* DEFAULTSHOWAWAY set by the /showaway command */ short ping; /* DEFAULTPINGTIME ping time in minutes */ BOOL quit; /* set when the user closes an active session */ int rval; /* return value of program */ IOHAND i; /* input handle to terminal/iostream */ IOHAND o; /* output handle to terminal/iostream */ #if !WIN32 #if USETERMIOS struct termios tstate; /* the original terminal state */ struct termios tsetup; /* a scribble-upon copy */ #else struct termio tstate; /* the original terminal state */ struct termio tsetup; /* a scribble-upon copy */ #endif /*USETERMIOS*/ #endif /*WIN32*/ char user[CHATNAMESIZE+1]; char pass[CHATPASSSIZE+1]; char room[CHATROOMSIZE+1]; char cook[CHATCOOKSIZE+1]; YPKTIN yin; } SESSION; #endif /*SESSION_DEFINED*/ /* ANSI ,ISO 6429 color escape sequences */ #define ATTR_RESET "\033[0m\033[37m" #define ATTR_BOLD "\033[1m" #define ATTR_RED "\033[1;31m" #define ATTR_LGREEN "\033[0;32m" #define ATTR_HGREEN "\033[1;32m" #define ATTR_YELLOW "\033[1;33m" #define ATTR_PURPLE "\033[1;35m" #define ATTR_BLUE "\033[1;36m" #define ATTR_CYAN "\033[0;36m" #define EOS '\0' /* ------------------------------------------------------------------------ */ /* yahmini 'exports this function */ extern BOOL YahooTextCommand(SESSION *sess ,const char *cmd ,const char *txt); /* ------------------------------------------------------------------------ */ /* dos and unix clients must supply these functions */ extern void ClearScreen(SESSION *sess); extern char *Ask(SESSION *sess ,const char *prompt ,char *buf ,int n ,short hide); extern BOOL KeybDataAvailable(SESSION *sess); extern int SessionHook(SESSION *sess ,short state, short argc, void *args); /* ------------------------------------------------------------------------ */ /* Session hooks. * as the main function steps through each procedure * it makes calls to session hooks at strategic places * * these are all made negative so that it would be possible * if someone wanted to, to make hooks based upon the yahoo * packet type itself. */ #define SHOOK_PROG -10 #define SHOOK_NET -20 #define SHOOK_CHAT -30 #define SHOOK_RECV -40 #define SHOOK_DATA -50 #define SHOOK_INPUT -60 #define SHOOK_DECODE -70 #define SHOOK_CHATEND -80 #define SHOOK_NETEND -90 #define SHOOK_EXIT -100 /* ------------------------------------------------------------------------ */ /* end */