summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
64c557a)
* src/ttt-curses-client.c: added error checking to ttt_create_client
call. Added ability to escape server commands by prepending with /.
Added ability so override port number with port=xxxx entry in
~/.ttt/client.conf.
+2005-12-09 Bryan Worth <bryan@theworths.org>
+ * src/ttt-curses-client.c: added error checking to ttt_create_client
+ call. Added ability to escape server commands by prepending with "/".
+ Added ability so override port number with port=xxxx entry in
+ ~/.ttt/client.conf.
+
2005-12-08 Carl Worth <cworth@cworth.org>
* src/ttt-server.c (main): When detached dup stdout to stderr so
2005-12-08 Carl Worth <cworth@cworth.org>
* src/ttt-server.c (main): When detached dup stdout to stderr so
int _socket;
char buffer[BUFSIZ];
char inplin[1024];
int _socket;
char buffer[BUFSIZ];
char inplin[1024];
static WINDOW *mainwnd;
static WINDOW *dispwin;
static WINDOW *mainwnd;
static WINDOW *dispwin;
refresh ();
dispwin = newwin (dlines - 5, cols - 2, 0, 0);
statwin = newwin (4, cols - 2, dlines -3, 0);
refresh ();
dispwin = newwin (dlines - 5, cols - 2, 0, 0);
statwin = newwin (4, cols - 2, dlines -3, 0);
- inpwin = newwin (1, cols - 2, dlines, 0);
+ inpwin = newwin (2, cols - 2, dlines, 0);
keypad (mainwnd, TRUE); // enable keyboard mapping
keypad (inpwin, TRUE); // enable keyboard mapping
nodelay (inpwin, TRUE);
keypad (mainwnd, TRUE); // enable keyboard mapping
keypad (inpwin, TRUE); // enable keyboard mapping
nodelay (inpwin, TRUE);
wrefresh (dispwin);
wrefresh (inpwin);
wrefresh (dispwin);
wrefresh (inpwin);
-
- ttt_socket_create_client (host, port, &_socket);
- sockin=fdopen(_socket,"r");
- sockout=fdopen(_socket,"w");
-
-
xasprintf(&confpath,"%s/.ttt/",getenv("HOME"));
xasprintf(&conffile,"%s/.ttt/client.conf",getenv("HOME"));
username="user";
xasprintf(&confpath,"%s/.ttt/",getenv("HOME"));
xasprintf(&conffile,"%s/.ttt/client.conf",getenv("HOME"));
username="user";
}
if ((conf_file = fopen(conffile,"r")) != NULL) {
while (fgets(buffer,BUFSIZ,conf_file)) {
}
if ((conf_file = fopen(conffile,"r")) != NULL) {
while (fgets(buffer,BUFSIZ,conf_file)) {
+ if (buffer[strlen(buffer)-1] == 10) buffer[strlen(buffer)-1] = '\0';
if (strncmp(buffer,"username=",9) == 0) {
xasprintf (&username, "%s", &buffer[9]);
if (strncmp(buffer,"username=",9) == 0) {
xasprintf (&username, "%s", &buffer[9]);
+ }
+ if (strncmp(buffer,"port=",5) == 0) {
+ xasprintf (&port, "%s",&buffer[5]);
+ status=ttt_socket_create_client (host, port, &_socket);
+ if (status) {
+ endwin();
+ printf("Unable to connect to server! Connection status: %d\n",status);
+ exit(1);
+ }
+ sockin=fdopen(_socket,"r");
+ sockout=fdopen(_socket,"w");
+
+
fprintf(sockout, "HELO %s\r\n",username);
fflush(sockout);
fprintf(sockout, "HELO %s\r\n",username);
fflush(sockout);
if (fgets(buffer,BUFSIZ,sockin)) {
if ((strncmp(buffer,"NOTICE MESSAGE ",15) == 0) && (strlen(buffer) > 15)) {
wprint (dispwin, buffer);
if (fgets(buffer,BUFSIZ,sockin)) {
if ((strncmp(buffer,"NOTICE MESSAGE ",15) == 0) && (strlen(buffer) > 15)) {
wprint (dispwin, buffer);
wrefresh (dispwin);
wrefresh (statwin);
}
wrefresh (dispwin);
wrefresh (statwin);
}
+
+ fprintf(sockout, "WHO \r\n");
+ fflush(sockout);
+
inplin[0]='\0';
while (1) {
curs_set (1);
inplin[0]='\0';
while (1) {
curs_set (1);
}
if (((int) c == 13) || ((int) c == 10)) {
curs_set (0);
}
if (((int) c == 13) || ((int) c == 10)) {
curs_set (0);
- fprintf(sockout,"MESSAGE \"%s\"\r\n",inplin);
+ if (inplin[0] == '/') {
+ fprintf(sockout,"%s\r\n",&inplin[1]);
+ }
+ else {
+ fprintf(sockout,"MESSAGE \"%s\"\r\n",inplin);
+ }
fflush(sockout);
inplin[0] = '\0';
if (fgets(buffer,BUFSIZ,sockin)) {
fflush(sockout);
inplin[0] = '\0';
if (fgets(buffer,BUFSIZ,sockin)) {