add the ability to have an 'after connect' script called 'connected'
authorminima <minima>
Thu, 26 Oct 2000 17:44:31 +0000 (17:44 +0000)
committerminima <minima>
Thu, 26 Oct 2000 17:44:31 +0000 (17:44 +0000)
Changes
src/client.c

diff --git a/Changes b/Changes
index 5b2a78ece9eff4a31f56f13996d34cc9cf5bf117..1fdd338a0b5958256f4f4da6df1a75ca9ec68bfb 100644 (file)
--- a/Changes
+++ b/Changes
@@ -1,3 +1,6 @@
+26Oct00=======================================================================
+1. if there is a 'connected' file in /spider/data then the client will send
+it out to the user after connection.
 25Oct00=======================================================================
 1. fix catchup and uncatchup commands so that they accept ranges
 24Oct00=======================================================================
index d2ed0c473ed01731063a2a689e8825c75c37fe68..0fd8950e4d76f5d88523ac809d0af2c0b9630ae6 100644 (file)
@@ -300,6 +300,26 @@ void send_msg(fcb_t *f, char let, UC *s, int l)
        f->sp->flags |= SEL_OUTPUT;
 }
 
+/* 
+ * send a file out to the user
+ */
+void send_file(char *name)
+{
+       int i;
+       char buf[MAXPACLEN+1];
+       
+       FILE *f = xopen("data", name, "r");
+       if (f) {
+               while (fgets(buf, paclen, f)) {
+                       i = strlen(buf);
+                       if (i && buf[i-1] == '\n') 
+                               buf[--i] = 0;
+                       send_text(in, buf, i, 1);
+               }
+               fclose(f);
+       }
+}
+
 /*
  * the callback (called by sel_run) that handles all the inputs and outputs
  */
@@ -852,19 +872,7 @@ main(int argc, char *argv[])
 
        /* is this a login? */
        if (eq(call, "LOGIN") || eq(call, "login")) {
-       
-               char buf[MAXPACLEN+1];
-               int r, i;
-               FILE *f = xopen("data", "issue", "r");
-               if (f) {
-                       while (fgets(buf, paclen, f)) {
-                               i = strlen(buf);
-                               if (i && buf[i-1] == '\n') 
-                                       buf[--i] = 0;
-                               send_text(in, buf, i, 1);
-                       }
-                       fclose(f);
-               }
+               send_file("issue");
                signal(SIGALRM, login_timeout);
                alarm(timeout);
                send_text(in, "login: ", 7, 0);
@@ -880,6 +888,8 @@ main(int argc, char *argv[])
                send_msg(node, 'A', connsort, strlen(connsort));
        
                chgstate(CONNECTED);
+
+               send_file("connected");
        }