Example #1
0
void rexxyesno(struct RexxMsg *mess)
{
        char foo[2],ja,nej,def,*pek;
        pek=hittaefter(mess->rm_Args[0]);
        if(!pek[0]) {
                ja='j'; nej='n'; def=1;
        } else {
                ja=pek[0];
                pek=hittaefter(pek);
                if(!pek[0]) {
                        nej='n'; def=1;
                } else {
                        nej=pek[0];
                        pek=hittaefter(pek);
                        if(!pek[0]) def=1;
                        else def=pek[0]-'0';
                }
        }
        foo[0]=jaellernej(ja,nej,def)+'0';
        foo[1]=0;
        if(carrierdropped()) {
                mess->rm_Result1=100;
                return;
        }
        mess->rm_Result1=0;
        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(foo,1)))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #2
0
int parsemot(char *skri) {
    struct Mote *motpek=(struct Mote *)Servermem->mot_list.mlh_Head;
    int going2=TRUE,found=-1;
    char *faci,*skri2;
    if(skri[0]==0 || skri[0]==' ') return(-3);
    for(; motpek->mot_node.mln_Succ; motpek=(struct Mote *)motpek->mot_node.mln_Succ) {
        if(!MaySeeConf(motpek->nummer, inloggad, &Servermem->inne[nodnr])) continue;
        faci=motpek->namn;
        skri2=skri;
        going2=TRUE;
        if(matchar(skri2,faci)) {
            while(going2) {
                skri2=hittaefter(skri2);
                faci=hittaefter(faci);
                if(skri2[0]==0) return((int)motpek->nummer);
                else if(faci[0]==0) going2=FALSE;
                else if(!matchar(skri2,faci)) {
                    faci=hittaefter(faci);
                    if(faci[0]==0 || !matchar(skri2,faci)) going2=FALSE;
                }
            }
        }
    }
    return(found);
}
Example #3
0
void rexxgetstring(struct RexxMsg *mess) {
  char *rexxargs1, *rexxargs2;
  char defaultstring[257] = "";
  int echo = EKO, maxchrs = 50;

  rexxargs1 = hittaefter(mess->rm_Args[0]);
  rexxargs2 = hittaefter(rexxargs1);

  if(rexxargs1[0]) {
    maxchrs = atoi(rexxargs1);
    if(maxchrs == 0) {
      maxchrs = 50;
    }
  }

  if(rexxargs2[0]) {
    if(strncmp(rexxargs2,"NOECHO",6) == 0) {
      echo = EJEKO;
    } else if(strncmp(rexxargs2,"STARECHO",8) == 0) {
      echo = STAREKO;
    } else {
      strcpy(defaultstring,rexxargs2);
    }
  }

  if(getstring(echo, maxchrs, defaultstring)) {
    SetRexxErrorResult(mess, 100);
  } else {
    SetRexxResultString(mess, inmat);
  }
}
Example #4
0
void kommando(struct RexxMsg *tempmess) {
        int parseret;
        if((parseret=parse(hittaefter(tempmess->rm_Args[0])))==-1) {
                sprintf(outbuffer,"\r\nFelaktigt kommando: %s\r\n",hittaefter(tempmess->rm_Args[0]));
                puttekn(outbuffer,-1);
                tempmess->rm_Result1=0;
                tempmess->rm_Result2=NULL;
        } else if(parseret==-3) {
                tempmess->rm_Result1=0;
                tempmess->rm_Result2=NULL;
        } else if(parseret==-4) {
                sprintf(outbuffer,"Du har ingen rätt att utföra kommandot: %s",hittaefter(tempmess->rm_Args[0]));
                puttekn(outbuffer,-1);
                tempmess->rm_Result1=0;
                tempmess->rm_Result2=NULL;
        } else {
                if((sendrexxrc=dokmd(parseret,0))==-8) {
                        tempmess->rm_Result1=100;
                        tempmess->rm_Result2=NULL;
                } else {
                        tempmess->rm_Result1=0;
                        tempmess->rm_Result2=NULL;
                }
        }
}
Example #5
0
void rxvisatext(struct RexxMsg *mess) {
        struct Mote *motpek;
        int text,mote,type;
        char *pek;
        pek=hittaefter(mess->rm_Args[0]);
        if(!pek[0]) {
                mess->rm_Result1=10;
                mess->rm_Result2=NULL;
                return;
        }
        text=atoi(pek);
        pek=hittaefter(pek);
        if(!pek[0]) type=MOTE_ORGINAL;
        else {
                mote=atoi(pek);
                motpek=getmotpek(mote);
                if(!motpek) {
                        mess->rm_Result1=10;
                        mess->rm_Result2=NULL;
                        return;
                }
                type=motpek->type;
        }
        if(type==MOTE_ORGINAL) org_visatext(text);
        mess->rm_Result1=0;
        mess->rm_Result2=NULL;
}
Example #6
0
void rxchglatestinfo(struct RexxMsg *mess) {
        char *what,retstr[15];
        int ammount,retval;
        what = hittaefter(mess->rm_Args[0]);
        ammount = atoi(hittaefter(what));
        switch(what[0]) {
                case 'r' : case 'R' :
                        retval = Statstr.read += ammount;
                        break;
                case 'w' : case 'W' :
                        retval = Statstr.write += ammount;
                        break;
                case 'd' : case 'D' :
                        retval = Statstr.dl += ammount;
                        break;
                case 'u' : case 'U' :
                        retval = Statstr.ul += ammount;
                        break;
                default:
                        retval = -1;
        }
        sprintf(retstr,"%d",retval);
        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(retstr,strlen(retstr))))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
        mess->rm_Result1=0;
}
Example #7
0
int fidoparsenamn(char *skri,struct System *Servermem) {
	int going=TRUE,going2=TRUE,found=-1,x;
	char *faci,*skri2;
	struct ShortUser *letpek;
	for(x=0;x<20;x++) {
		if(sprattmatchar(skri,Servermem->fidodata.fa[x].namn)) return(Servermem->fidodata.fa[x].nummer);
	}
	if(sprattmatchar(skri,"sysop")) return(0);
	letpek=(struct ShortUser *)Servermem->user_list.mlh_Head;
	while(letpek->user_node.mln_Succ && going) {
		faci=letpek->namn;
		skri2=skri;
		going2=TRUE;
		if(sprattmatchar(skri2,faci)) {
			while(going2) {
				skri2=hittaefter(skri2);
				faci=hittaefter(faci);
				if(skri2[0]==0) {
					found=letpek->nummer;
					going2=going=FALSE;
				}
				else if(faci[0]==0) going2=FALSE;
				else if(!sprattmatchar(skri2,faci)) {
					faci=hittaefter(faci);
					if(faci[0]==0 || !sprattmatchar(skri2,faci)) going2=FALSE;
				}
			}
		}
		letpek=(struct ShortUser *)letpek->user_node.mln_Succ;
	}
	return(found);
}
Example #8
0
void niknrcommand(struct RexxMsg *mess) {
  int nr;
  char *commandstr = hittaefter(mess->rm_Args[0]);
  nr = atoi(commandstr);
  argument=hittaefter(commandstr);
  if((sendrexxrc = dokmd(nr, 0)) == -8) {
    SetRexxErrorResult(mess, 100);
  } else {
    SetRexxErrorResult(mess, 0);
  }
}
Example #9
0
void rexxvisabrev(struct RexxMsg *mess) {
        char *pek1,*pek2;
        pek1=hittaefter(mess->rm_Args[0]);
        pek2=hittaefter(pek1);
        if(!pek1[0] || !pek2[0]) {
                mess->rm_Result1=10;
                mess->rm_Result2=NULL;
        }
        visabrev(atoi(pek2),atoi(pek1));
        mess->rm_Result1=0;
        mess->rm_Result2=NULL;
}
Example #10
0
void rexxgetstring(struct RexxMsg *tempmess) {
        char *rexxargs1,*rexxargs2;
        char defaultstring[257];
        int ra1=0,ra2=0;

        defaultstring[0] = NULL;
        rexxargs1=hittaefter(tempmess->rm_Args[0]);
        if(rexxargs1[0])
        {
			ra2=EKO;
			if(!(ra1=atoi(rexxargs1))) ra1=50;
			rexxargs2=hittaefter(rexxargs1);
			if(rexxargs2[0] && !strncmp(rexxargs2,"NOECHO",6)) ra2=EJEKO;
			else
			{
				if(rexxargs2[0])
				{
					if(!strncmp(rexxargs2,"STARECHO",8))
						ra2 = STAREKO;
					else
						strcpy(defaultstring,rexxargs2);
				}
			}
        }
        else
        {
                ra1=50;
                ra2=EKO;
        }
        if(defaultstring[0] != NULL)
        {
                if(getstring(ra2,ra1,defaultstring))
                {
                        tempmess->rm_Result1=100;
                        tempmess->rm_Result2=NULL;
                        return;
                }
        }
        else
        {
                if(getstring(ra2,ra1,NULL)) {
                        tempmess->rm_Result1=100;
                        tempmess->rm_Result2=NULL;
                        return;
                }
        }
        tempmess->rm_Result1=0;
        if(tempmess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(tempmess->rm_Result2=(long)CreateArgstring(inmat,strlen(inmat))))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #11
0
void niknrcommand(struct RexxMsg *tempmess) {
        int nr;
        char *kom=hittaefter(tempmess->rm_Args[0]);
        nr=atoi(kom);
        argument=hittaefter(kom);
        if((sendrexxrc=dokmd(nr,0))==-8) {
                tempmess->rm_Result1=100;
                tempmess->rm_Result2=NULL;
        } else {
                tempmess->rm_Result1=0;
                tempmess->rm_Result2=NULL;
        }
}
Example #12
0
void savefidocopy(struct FidoText *ft,int anv) {
        struct FidoLine *fl;
        BPTR fh;
        int nummer;
        char *foo,buffer[100];
        nummer=updatenextletter(anv);
        if(nummer==-1) {
                return;
        }
        sprintf(buffer,"NiKom:Users/%d/%d/%d.letter",anv/100,anv,nummer);
        if(!(fh=Open(buffer,MODE_NEWFILE))) {
                return;
        }
        FPuts(fh,"System-ID: Fido\n");
        sprintf(buffer,"From: %s (%d:%d/%d.%d)\n",ft->fromuser,ft->fromzone,ft->fromnet,ft->fromnode,ft->frompoint);
        FPuts(fh,buffer);
        sprintf(buffer,"To: %s (%d:%d/%d.%d)\n",ft->touser,ft->tozone,ft->tonet,ft->tonode,ft->topoint);
        FPuts(fh,buffer);
        sprintf(buffer,"Date: %s\n",ft->date);
        FPuts(fh,buffer);
        foo = hittaefter(ft->subject);
        if(ft->subject[0] == 0 || (ft->subject[0] == ' ' && foo[0] == 0)) strcpy(buffer,"Subject: -\n");
        else sprintf(buffer,"Subject: %s\n",ft->subject);
        FPuts(fh,buffer);
        for(fl=(struct FidoLine *)ft->text.mlh_Head;fl->line_node.mln_Succ;fl=(struct FidoLine *)fl->line_node.mln_Succ) {
                FPuts(fh,fl->text);
                FPutC(fh,'\n');
        }
        Close(fh);
        sprintf(outbuffer,"\n\n\rBrevet fick nummer %d i din brevlåda\r\n\n",nummer);
        puttekn(outbuffer,-1);
}
Example #13
0
void rexxrecbinfile(struct RexxMsg *mess) {
        char buf[1024];
        struct TransferFiles *tf;

        Servermem->action[nodnr] = UPLOAD;
        Servermem->varmote[nodnr] = 0;
        Servermem->vilkastr[nodnr] = NULL;

        if(recbinfile(hittaefter(mess->rm_Args[0]))) strcpy(buf,"0");
        else
        {
                buf[0] = NULL;
                for(tf=(struct TransferFiles *)tf_list.mlh_Head;tf->node.mln_Succ;tf=(struct TransferFiles *)tf->node.mln_Succ)
                {
                        strcat(buf,FilePart(tf->Filnamn));
                        strcat(buf,(char *)" ");
                }
                buf[strlen(buf)-1] = NULL;
        }

        while(tf=(struct TransferFiles *)RemHead((struct List *)&tf_list))
                FreeMem(tf,sizeof(struct TransferFiles));

        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(buf,strlen(buf))))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #14
0
void kommando(struct RexxMsg *mess) {
  int parseret;
  char *nikcmd;

  nikcmd = hittaefter(mess->rm_Args[0]);
  if((parseret = parse(nikcmd)) == -1) {
    LogEvent(SYSTEM_LOG, WARN,
             "Invalid NiKom command in ARexx 'NikCommand': '%s'", nikcmd);
    SetRexxResultString(mess, "1");
  } else if(parseret == -3) {
    LogEvent(SYSTEM_LOG, WARN, "Empty command sent to ARexx 'NikCommand'");   
    SetRexxResultString(mess, "2");
  } else if(parseret == -4) {
    LogEvent(SYSTEM_LOG, WARN,
             "User %d has no permission executing NiKom command in ARexx 'NikCommand': '%s'",
             inloggad, nikcmd);   
    SetRexxResultString(mess, "3");
  } else {
    if((sendrexxrc = dokmd(parseret,0)) == -8) {
      SetRexxErrorResult(mess, 100);
    } else {
      SetRexxResultString(mess, "0");
    }
  }
}
Example #15
0
void listasenaste(void) {
	int x,nummer,alla=TRUE,cnt=0,antal=MAXSENASTE;
	struct tm *ts;
	if(argument[0]=='-') {
		antal=atoi(&argument[1]);
		argument=hittaefter(argument);
	}
	if((nummer=parsenamn(argument))==-1) {
		puttekn("\r\n\nFinns ingen som heter så eller har det numret!\r\n",-1);
		return;
	} else if(nummer==-3) alla=TRUE;
	else alla=FALSE;
	puttekn("\r\n\n     Namn                            Utloggad     Tid   Läst Skr  Ul  Dl\r\n\n",-1);
	for(x=0;x<MAXSENASTE;x++) {
		if(!Servermem->senaste[x].utloggtid || (!alla && nummer!=Servermem->senaste[x].anv)) continue;
		if(!userexists(Servermem->senaste[x].anv)) continue;
		cnt++;
		ts=localtime(&Servermem->senaste[x].utloggtid);
		sprintf(outbuffer,"%-35s %02d/%02d %02d:%02d %3dmin  %4d %3d  %2d  %2d\r\n",
			getusername(Servermem->senaste[x].anv),ts->tm_mday,ts->tm_mon+1,ts->tm_hour,ts->tm_min,
			Servermem->senaste[x].tid_inloggad,Servermem->senaste[x].read,
			Servermem->senaste[x].write,Servermem->senaste[x].ul,
			Servermem->senaste[x].dl);
		if(puttekn(outbuffer,-1)) return;
		if(cnt>=antal) return;
	}
}
Example #16
0
int recisthere(char *str,int rec) {
        char *pek=str;
        while(pek[0]) {
                if(rec==atoi(pek)) return(1);
                pek=hittaefter(pek);
        }
        return(0);
}
Example #17
0
void rxgetnumber(struct RexxMsg *mess)
{
	int minvarde, maxvarde, defaultvarde, returvarde;
	char retstr[15];
	char *pek1 = NULL, *pek2 = NULL, *pek3 = NULL;

	pek1=hittaefter(mess->rm_Args[0]);
	if(pek1)
		pek2=hittaefter(pek1);
	if(pek2)
		pek3=hittaefter(pek2);

	if(pek1[0] && !pek2[0])
	{
		defaultvarde = atoi(pek1);
		returvarde = getnumber(0, 0, &defaultvarde);
	}
	else if(pek1[0] && pek2[0])
	{
		minvarde = atoi(pek1);
		maxvarde = atoi(pek2);
		if(pek3[0])
		{
			defaultvarde = atoi(pek3);
			returvarde = getnumber(&minvarde, &maxvarde, &defaultvarde);
		}
		else
		{
			returvarde = getnumber(&minvarde, &maxvarde, 0);
		}

	}
	else
	{
		returvarde = getnumber(0, 0, 0);
	}

	sprintf(retstr,"%d",returvarde);
	if(mess->rm_Action & 1L<<RXFB_RESULT)
	{
		if(!(mess->rm_Result2=(long)CreateArgstring(retstr,strlen(retstr))))
			puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
	}
	mess->rm_Result1=0;

}
Example #18
0
void rxsetnodeaction(struct RexxMsg *mess) {
        strncpy(vilkabuf,hittaefter(mess->rm_Args[0]),49);
        vilkabuf[49]=0;
        Servermem->action[nodnr] = GORNGTANNAT;
        Servermem->vilkastr[nodnr] = vilkabuf;
        mess->rm_Result1=0;
        mess->rm_Result2=NULL;
}
Example #19
0
void rexxsendtextfile(struct RexxMsg *mess) {
  char *filename;

  filename = hittaefter(mess->rm_Args[0]);
  if(filename[0] == '\0') {
    SetRexxErrorResult(mess, 10);
    return;
  }
  sendfile(filename);
  SetRexxErrorResult(mess, carrierdropped() ? 100 : 0);
}
Example #20
0
void rexxsendstring(struct RexxMsg *mess) {
  char *str;
  int res;

  str = hittaefter(mess->rm_Args[0]);
  res = puttekn(str, -1);
  if(carrierdropped()) {
    SetRexxErrorResult(mess, 100);
  } else {    
    SetRexxResultString(mess, res ? "1" : "0");
  }
}
Example #21
0
void rxentermeet(struct RexxMsg *mess) {
        int motnr;
        motnr=atoi(hittaefter(mess->rm_Args[0]));
        if(!getmotpek(motnr)) {
                mess->rm_Result1=10;
                mess->rm_Result2=NULL;
                return;
        }
        sendrexxrc=motnr;
        mess->rm_Result1=0;
        mess->rm_Result2=NULL;
}
Example #22
0
void rxedit(struct RexxMsg *mess) {
        int editret,cnt,len;
        char *filnamn,retstr[2];
        BPTR fh;
        struct EditLine *el;
        nu_skrivs=ANNAT;
        filnamn=hittaefter(mess->rm_Args[0]);
        if(!filnamn[0]) {
                mess->rm_Result1=5;
                mess->rm_Result2=NULL;
                return;
        }
/*      puttekn("\r\n\n",-1); Detta måste nu fixas i ARexx-programmet
		istället */

        if((editret=edittext(filnamn))==1) {
                mess->rm_Result1=100;
                mess->rm_Result2=NULL;
                return;
        } else if(editret==0) {
                if(!(fh=Open(filnamn,MODE_NEWFILE))) {
                        sprintf(outbuffer,"\r\n\nKunde inte öppna %s för skrivning!\r\n");
                        puttekn(outbuffer,-1);
                        mess->rm_Result1=5;
                        mess->rm_Result2=NULL;
                        return;
                }
                cnt=0;
                for(el=(struct EditLine *)edit_list.mlh_Head;el->line_node.mln_Succ;el=(struct EditLine *)el->line_node.mln_Succ) {
                        len=strlen(el->text);
                        el->text[len]='\n';
                        if(Write(fh,el->text,len+1)==-1) {
                                sprintf(outbuffer,"\r\n\nFel vid skrivandet av %s!\r\n",filnamn);
                                puttekn(outbuffer,-1);
                                Close(fh);
                                mess->rm_Result1=5;
                                mess->rm_Result2=NULL;
                                return;
                        }
                        cnt++;
                }
                Close(fh);
                freeeditlist();
        }
        mess->rm_Result1=0;
        retstr[0]= editret ? '0' : '1';
        retstr[1]=0;
        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(retstr,1)))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #23
0
void rxsendserchar(struct RexxMsg *mess) {
        char *arg;
        arg=hittaefter(mess->rm_Args[0]);
        if(arg[0]!='/' || arg[1]==0) {
                mess->rm_Result1=10;
                mess->rm_Result2=NULL;
                return;
        }
        sereka(arg[1]);
        if(carrierdropped()) mess->rm_Result1=100;
        else mess->rm_Result1=0;
        mess->rm_Result2=NULL;
}
Example #24
0
void rexxsendstring(struct RexxMsg *mess) {
        char *str,ret,retstr[2];
        str=hittaefter(mess->rm_Args[0]);
        ret=puttekn(str,-1);
        if(ret) retstr[0]='1';
        else retstr[0]='0';
        retstr[1]=0;
        mess->rm_Result1=0;
        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(retstr,1)))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #25
0
void rxextratime(struct RexxMsg *mess) {
        char buf[10],*arg=hittaefter(mess->rm_Args[0]);
        if(!strcmp(arg,"GET")) {
                sprintf(buf,"%d",extratime);
                if(mess->rm_Action & 1L<<RXFB_RESULT) {
                        if(!(mess->rm_Result2=(long)CreateArgstring(buf,strlen(buf))))
                                puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
                }
        } else {
                extratime=atoi(arg);
                mess->rm_Result2=NULL;
        }
        mess->rm_Result1=0;
}
Example #26
0
void rexxsendserstring(struct RexxMsg *mess) {
  char *str, res;
  str = hittaefter(mess->rm_Args[0]);
  if(Servermem->nodtyp[nodnr] != NODCON) {
    res = serputtekn(str, -1);
  } else {
    res = conputtekn(str, -1);
  }
  if(carrierdropped()) {
    SetRexxErrorResult(mess, 100);
  } else {    
    SetRexxResultString(mess, res ? "1" : "0");
  }
}
Example #27
0
int brev_kommentera(void) {
        BPTR fh;
        int nummer,editret,anv;
        char *brevpers,filnamn[50];
        if(argument[0]) {
                nummer=atoi(argument);
                brevpers=hittaefter(argument);
                if(!brevpers[0]) anv=inloggad;
                else {
                        anv=parsenamn(brevpers);
                        if(anv==-1) {
                                puttekn("\n\n\rAnvändaren finns inte!\n\r",-1);
                                return(0);
                        }
                }
                sprintf(filnamn,"NiKom:Users/%d/%d/%d.letter",anv/100,anv,nummer);
                if(!(fh=Open(filnamn,MODE_OLDFILE))) {
                        puttekn("\r\n\nBrevet finns inte!\r\n\n",-1);
                        return(0);
                }
                readletterheader(fh,&brevread);
                Close(fh);
                if(!strncmp(brevread.systemid,"Fido",4)) {
                        if(anv!=inloggad) {
                                puttekn("\n\n\rDu har inte rätt att kommentera det brevet\n\r",-1);
                                return(0);
                        }
                } else {
                        if(anv!=inloggad && inloggad!=atoi(brevread.from) && Servermem->inne[nodnr].status<Servermem->cfg.st.brev) {
                                puttekn("\r\n\nDu har inte skrivit det brevet!\r\n\n",-1);
                                return(0);
                        }
                }
                senast_text_typ=BREV;
                senast_brev_nr=nummer;
                senast_brev_anv=anv;
        }
        if(!strncmp(brevread.systemid,"Fido",4)) {
                nu_skrivs=BREV_FIDO;
                return(fido_brev(NULL,NULL,NULL));
        } else {
                nu_skrivs=BREV;
                editret=initbrevheader(BREVKOM);
        }
        if(editret==1) return(1);
        if(editret==2) return(0);
        if((editret=edittext(NULL))==1) return(1);
        else if(!editret)       sparabrev();
        return(0);
}
Example #28
0
int endast(void) {
	int antal,foo=TRUE;
	int motnr, nyttmote = 1;
	struct Mote *motpek = NULL;
	if(!isdigit(argument[0])) {
		puttekn("\r\n\nSkriv: Endast <antal texter> [mötesnamn]\r\n",-1);
		return(-5);
	}
	antal=atoi(argument);
	argument=hittaefter(argument);
	if(argument[0])
	{
		if(matchar(argument,Servermem->cfg.brevnamn))
			motnr = -1;
		else
		{
			motnr=parsemot(argument);
			if(motnr==-3)
			{
				puttekn("\r\n\nSkriv: Endast <antal texter> [mötesnamn]\r\n\n",-1);
				return(-5);
			}
			if(motnr==-1)
			{
				puttekn("\r\n\nFinns inget sådant möte!\r\n\n", -1);
				return(-5);
			}
		}
		nyttmote = 0;
	}
	else
		motnr = mote2;

	if(motnr==-1) {
		Servermem->inne[nodnr].brevpek=getnextletter(inloggad)-antal;
		foo=getfirstletter(inloggad);
		if(foo>Servermem->inne[nodnr].brevpek) Servermem->inne[nodnr].brevpek=foo;
	} else {
		motpek = getmotpek(motnr);
		if(motpek->type==MOTE_ORGINAL) org_endast(motnr,antal);
		else if(motpek->type==MOTE_FIDO) fido_endast(motpek,antal);
	}
	if(nyttmote)
		return(-11);
	else
		return(-5);
}
Example #29
0
void rexxsendbinfile(struct RexxMsg *mess) {
        char buf[257],*pek,filtemp[257],tmp[3];
        int i,quote;
        struct TransferFiles *tf;

        mess->rm_Result1=0;
        pek=hittaefter(mess->rm_Args[0]);
        NewList((struct List *)&tf_list);
        while(pek[0]!=NULL && mess->rm_Result1!=20) {
		filtemp[0]=NULL;
		i=0; quote=0;
		while(pek[0]==' ' && pek[0]!=NULL) pek++;
		if(pek[0]=='"') { quote=1; pek++; }
		if(!pek[0]) break;
		while(((pek[0]!='"' && quote) || (pek[0]!=' ' && !quote)) && pek[0]!=NULL) {
			filtemp[i++]=pek[0];
			pek++;
		}
		if(pek[0]=='"') pek++;
		filtemp[i]=NULL;
                if(!(tf=(struct TransferFiles *)AllocMem(sizeof(struct TransferFiles),MEMF_CLEAR))) {
                        mess->rm_Result1=20;
                        mess->rm_Result2=NULL;
		} else {
			strcpy(tf->path,filtemp);
			tf->filpek=NULL;
			AddTail((struct List *)&tf_list,(struct Node *)tf);
		}
	}
        sendbinfile();
        buf[0] = NULL;
        for(tf=(struct TransferFiles *)tf_list.mlh_Head;tf->node.mln_Succ;tf=(struct TransferFiles *)tf->node.mln_Succ)
        {
                sprintf(tmp,"%d ",tf->sucess);
                strcat(buf,tmp);
        }
        buf[strlen(buf)-1] = NULL;

        while(tf=(struct TransferFiles *)RemHead((struct List *)&tf_list))
                FreeMem(tf,sizeof(struct TransferFiles));

        if(mess->rm_Action & 1L<<RXFB_RESULT) {
                if(!(mess->rm_Result2=(long)CreateArgstring(buf,strlen(buf))))
                        puttekn("\r\n\nKunde inte allokera en Argstring!\r\n\n",-1);
        }
}
Example #30
0
void brev_lasa(int tnr) {
        int brevanv;
        char *arg2;
        arg2=hittaefter(argument);
        if(arg2[0]) {
                brevanv=parsenamn(arg2);
                if(brevanv==-1) {
                        puttekn("\n\n\rFinns ingen sådan användare!\n\r",-1);
                        return;
                }
        } else brevanv=inloggad;
        if(tnr<getfirstletter(brevanv) || tnr>=getnextletter(brevanv)) {
                puttekn("\r\n\nBrevet finns inte!\r\n",-1);
                return;
        }
        visabrev(tnr,brevanv);
}