Mercurial > hg > nnchat
comparison nnchat.c @ 39:bb25bdfc0d71
Sync.
author | Matti Hamalainen <ccr@tnsp.org> |
---|---|
date | Thu, 23 Oct 2008 02:13:39 +0300 |
parents | 34864d021d7e |
children | 3e2548c3eb51 |
comparison
equal
deleted
inserted
replaced
38:cfbdd75946f4 | 39:bb25bdfc0d71 |
---|---|
1 /* NNChat - Custom chat client for NewbieNudes.com chatrooms | |
2 * Written by Matti 'ccr' Hämäläinen | |
3 * (C) Copyright 2008 Tecnic Software productions (TNSP) | |
4 */ | |
1 #include <sys/socket.h> | 5 #include <sys/socket.h> |
2 #include <sys/types.h> | 6 #include <sys/types.h> |
3 #include <arpa/inet.h> | 7 #include <arpa/inet.h> |
4 #include <sys/time.h> | 8 #include <sys/time.h> |
5 #include <netdb.h> | 9 #include <netdb.h> |
21 #define SET_DELAY_USEC (SET_DELAY * 1000) | 25 #define SET_DELAY_USEC (SET_DELAY * 1000) |
22 | 26 |
23 /* Options | 27 /* Options |
24 */ | 28 */ |
25 int optPort = 8005; | 29 int optPort = 8005; |
26 int optUserColor = 0x408060; | 30 int optUserColor = 0x006080; |
27 char *optServer = "www11.servemedata.com", | 31 char *optServer = "www11.servemedata.com", |
28 *optUserName = NULL, | 32 *optUserName = NULL, |
29 *optUserName2 = NULL, | 33 *optUserName2 = NULL, |
30 *optPassword = NULL, | 34 *optPassword = NULL, |
31 *optLogFilename = NULL, | 35 *optLogFilename = NULL, |
1027 hstrerror(h_errno)); | 1031 hstrerror(h_errno)); |
1028 return -3; | 1032 return -3; |
1029 } | 1033 } |
1030 THMSG(2, "True hostname: %s\n", tmpHost->h_name); | 1034 THMSG(2, "True hostname: %s\n", tmpHost->h_name); |
1031 | 1035 |
1036 #if 0 | |
1032 /* To emulate the official client, we first make a fake connection ... */ | 1037 /* To emulate the official client, we first make a fake connection ... */ |
1033 if ((tmpSocket = openConnection((struct in_addr *) tmpHost->h_addr, optPort)) < 0) { | 1038 if ((tmpSocket = openConnection((struct in_addr *) tmpHost->h_addr, optPort)) < 0) { |
1034 THERR("Fakeprobe connection setup failed!\n"); | 1039 THERR("Fakeprobe connection setup failed!\n"); |
1035 goto err_exit; | 1040 goto err_exit; |
1036 } | 1041 } |
1045 gotBuf = recv(tmpSocket, tmpBuf, sizeof(tmpBuf), 0); | 1050 gotBuf = recv(tmpSocket, tmpBuf, sizeof(tmpBuf), 0); |
1046 tmpBuf[gotBuf-1] = 0; | 1051 tmpBuf[gotBuf-1] = 0; |
1047 THMSG(2, "Probe got: %s\n", tmpBuf); | 1052 THMSG(2, "Probe got: %s\n", tmpBuf); |
1048 closeConnection(tmpSocket); | 1053 closeConnection(tmpSocket); |
1049 } | 1054 } |
1055 #endif | |
1050 | 1056 |
1051 /* Okay, now do the proper connection ... */ | 1057 /* Okay, now do the proper connection ... */ |
1052 if ((tmpSocket = openConnection((struct in_addr *) tmpHost->h_addr, optPort)) < 0) { | 1058 if ((tmpSocket = openConnection((struct in_addr *) tmpHost->h_addr, optPort)) < 0) { |
1053 THERR("Main connection setup failed!\n"); | 1059 THERR("Main connection setup failed!\n"); |
1054 goto err_exit; | 1060 goto err_exit; |