1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133
|
/*
GameSpy Chat SDK
Dan "Mr. Pants" Schoenblum
dan@gamespy.com
Copyright 1999-2007 GameSpy Industries, Inc
devsupport@gamespy.com
*/
#ifndef _CHATMAIN_H_
#define _CHATMAIN_H_
/*************
** INCLUDES **
*************/
#include "chat.h"
#include "chatSocket.h"
#include "chatHandlers.h"
#include "../hashtable.h"
#include "../darray.h"
#include "../md5.h"
/************
** DEFINES **
************/
#define MAX_NICK 64
#define MAX_CHAT_NICK 21
#define MAX_NAME 128
#define MAX_USER 128
#define MAX_SERVER 128
#define MAX_PARAM 512
#define MAX_SECRETKEY 128
#define MAX_EMAIL 64
#define MAX_PROFILENICK 32
#define MAX_UNIQUENICK 64
#define MAX_PASSWORD 32
#define MAX_AUTHTOKEN 256
#define MAX_PARTNERCHALLENGE 256
#define CONNECTION ciConnection * connection;\
assert(chat != NULL);\
connection = (ciConnection *)chat;\
GSI_UNUSED(connection);
#define CONNECTED if(!connection || !connection->connected) return; //ERRCON
#if 0
ciConnection * connection; // for visual assist
#endif
#define VALID_NICK_CHARS "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\"#$%&'()*+,-./:;<=>?@[]^_`{|}~"
#define CI_DEFAULT_SERVER_ADDRESS "peerchat." GSI_DOMAIN_NAME
#define CI_DEFUILT_SERVER_PORT 6667
/**********
** TYPES **
**********/
typedef enum
{
CINoLogin,
CIUniqueNickLogin,
CIProfileLogin,
CIPreAuthLogin
} CILoginType;
typedef struct ciConnection
{
CHATBool connected;
CHATBool connecting;
CHATBool disconnected;
chatNickErrorCallback nickErrorCallback;
chatFillInUserCallback fillInUserCallback;
chatConnectCallback connectCallback;
void * connectParam;
ciSocket chatSocket;
char nick[MAX_NICK];
char name[MAX_NAME];
char user[MAX_USER];
int namespaceID;
char email[MAX_EMAIL];
char profilenick[MAX_PROFILENICK];
char uniquenick[MAX_UNIQUENICK];
char password[MAX_PASSWORD];
char authtoken[MAX_AUTHTOKEN];
char partnerchallenge[MAX_PARTNERCHALLENGE];
#ifdef GSI_UNICODE
unsigned short nickW[MAX_NICK];
unsigned short userW[MAX_NAME];
#endif
unsigned int IP;
char server[MAX_SERVER];
int port;
chatGlobalCallbacks globalCallbacks;
HashTable channelTable;
DArray enteringChannelList;
ciServerMessageFilter * filterList;
ciServerMessageFilter * lastFilter;
int nextID;
DArray callbackList;
CHATBool quiet;
char secretKey[MAX_SECRETKEY];
CILoginType loginType;
int userID;
int profileID;
} ciConnection;
void ciSendNickAndUser(CHAT chat);
void ciSendNick(CHAT chat);
void ciSendUser(CHAT chat);
void ciSendLogin(CHAT chat);
void ciHandleDisconnect(CHAT chat, const char * reason);
int ciNickIsValid(const char* nick);
void ciNickError(CHAT chat, int type, const char * nick, int numSuggestedNicks, char ** suggestedNicks);
#define strzcpy(dest, src, len) { strncpy(dest, src, (len)); (dest)[(len) - 1] = '\0'; }
#define wcszcpy(dest, src, len) { wcsncpy(dest, src, (len)); (dest)[(len) - 1] = 0; }
#endif
|