]> code.citadel.org Git - citadel.git/commitdiff
Attachments continued...
authorArt Cancro <ajc@citadel.org>
Tue, 22 Sep 1998 20:29:11 +0000 (20:29 +0000)
committerArt Cancro <ajc@citadel.org>
Tue, 22 Sep 1998 20:29:11 +0000 (20:29 +0000)
citadel/messages.c
citadel/routines.c

index fd08ea0afad2a69e491e7d74ad6b13cfb1746dca..8a5d31ddec79eb8201bfabed2f660995919d7a41 100644 (file)
@@ -26,6 +26,11 @@ struct cittext {
        char text[MAXWORDBUF];
        };
 
+struct AttachedFile {
+       struct AttachedFile *next;
+       char filename[256];
+       };
+
 char inkey(void);
 void sttybbs(int cmd);
 int struncmp(char *lstr, char *rstr, int len);
@@ -530,6 +535,9 @@ int make_message(char *filename, char *recipient, int anon_type, int format_type
        long now,beg;
        char datestr[64];
        int cksum = 0;
+       struct AttachedFile *AttachList = NULL;
+       struct AttachedFile *Aptr;
+       char buf[256];
 
        if (mode==2) if (strlen(editor_path)==0) {
                printf("*** No editor available, using built-in editor\n");
@@ -652,13 +660,26 @@ MECR2:    b=inkey();
                printf("Hold message\n");
                return(2);
                }
-       if ((b=='f')&&(rc_allow_attachments==1)) {
+       /* if ((b=='f')&&(rc_allow_attachments==1)) { */
+       if (b=='f') {
                printf("attach File\n");
                if (strlen(boundary)==0) {
                        sprintf(boundary, "Citadel-Attachment-%ld.%d",
                                time(NULL), getpid() );
                        }
-               /* FIX FIX now you have to attach the file, stupid */
+               newprompt("Filename: ", buf, 68);
+               if (access(buf, R_OK)==0) {
+                       Aptr = (struct AttachedFile *)
+                               malloc(sizeof(struct AttachedFile));
+                       strcpy(Aptr->filename, buf);
+                       Aptr->next = AttachList;
+                       AttachList = Aptr;
+                       }
+               else {
+                       printf("*** Cannot open %s: %s\n",
+                               buf, strerror(errno));
+                       }
+               goto MECR;
                }
        goto MECR2;
 
index 71291673347c3c0c2e52e8bdc42726a2915a038c..e8332de0153c6d90e5f89a0d6d12439baac144f4 100644 (file)
@@ -393,88 +393,6 @@ void strproc(char *string)
        }
 
 
-int alias(char *name)          /* process alias and routing info for mail */
-             {
-       FILE *fp;
-       int a,b;
-       char aaa[300],bbb[300];
-       
-       fp=fopen("network/mail.aliases","r");
-       if (fp==NULL) return(2);
-GNA:   strcpy(aaa,""); strcpy(bbb,"");
-       do {
-               a=getc(fp);
-               if (a==',') a=0;
-               if (a>0) { b=strlen(aaa); aaa[b]=a; aaa[b+1]=0; }
-               } while(a>0);
-       do {
-               a=getc(fp);
-               if (a==10) a=0;
-               if (a>0) { b=strlen(bbb); bbb[b]=a; bbb[b+1]=0; }
-               } while(a>0);
-       if (a<0) {
-               fclose(fp);
-               goto DETYPE;
-               }
-       if (strucmp(name,aaa)) goto GNA;
-       fclose(fp);
-       strcpy(name,bbb);
-       printf("*** Mail is being forwarded to %s\n",name);
-
-DETYPE:        /* determine local or remote type, see citadel.h */
-       for (a=0; a<strlen(name); ++a) if (name[a]=='!') return(M_INTERNET);
-       for (a=0; a<strlen(name); ++a)
-               if (name[a]=='@')
-                       for (b=a; b<strlen(name); ++b)
-                               if (name[b]=='.') return(M_INTERNET);
-       b=0; for (a=0; a<strlen(name); ++a) if (name[a]=='@') ++b;
-       if (b>1) {
-               printf("Too many @'s in address\n");
-               return(M_ERROR);
-               }
-       if (b==1) {
-               for (a=0; a<strlen(name); ++a)
-                       if (name[a]=='@') strcpy(bbb,&name[a+1]);
-               while (bbb[0]==32) strcpy(bbb,&bbb[1]);
-               fp = fopen("network/mail.sysinfo","r");
-               if (fp==NULL) return(M_ERROR);
-GETSN:         do {
-                       a=getstring(fp,aaa);
-                       } while ((a>=0)&&(strucmp(aaa,bbb)));
-               a=getstring(fp,aaa);
-               if (!strncmp(aaa,"use ",4)) {
-                       strcpy(bbb,&aaa[4]);
-                       fseek(fp,0L,0);
-                       goto GETSN;
-                       }
-               fclose(fp);
-               if (!strncmp(aaa,"uum",3)) {
-                       strcpy(bbb,name);
-                       for (a=0; a<strlen(bbb); ++a) {
-                               if (bbb[a]=='@') bbb[a]=0;
-                               if (bbb[a]==' ') bbb[a]='_';
-                               }
-                       while(bbb[strlen(bbb)-1]=='_') bbb[strlen(bbb)-1]=0;
-                       sprintf(name,&aaa[4],bbb);
-                       return(M_INTERNET);
-                       }
-               if (!strncmp(aaa,"bin",3)) {
-                       strcpy(aaa,name); strcpy(bbb,name);
-                       while (aaa[strlen(aaa)-1]!='@') aaa[strlen(aaa)-1]=0;
-                       aaa[strlen(aaa)-1]=0;
-                       while (aaa[strlen(aaa)-1]==' ') aaa[strlen(aaa)-1]=0;
-                       while (bbb[0]!='@') strcpy(bbb,&bbb[1]);
-                       strcpy(bbb,&bbb[1]);
-                       while (bbb[0]==' ') strcpy(bbb,&bbb[1]);
-                       sprintf(name,"%s @%s",aaa,bbb);
-                       return(M_BINARY);
-                       }
-               return(M_ERROR);
-               }
-       return(M_LOCAL);
-       }
-
-
 #ifdef NO_STRERROR
 /*
  * replacement strerror() for systems that don't have it