示例#1
0
文件: Ser.c 项目: jayminer81/NiKom
void main(int argc,char *argv[]) {
    int going=TRUE,forsok=2,car=1,x,connectbps, i, tmp;
    struct NodeType *nt;
    char *tmppscreen,commandstring[100], configname[50] = "NiKom:DatoCfg/SerNode.cfg";
    FILE *fil;
    if(argc>1) for(x=1; x<argc; x++) {
            if(argv[x][0]=='-') {
                if(argv[x][1]=='G') getty=TRUE;
                else if(argv[x][1]=='B') gettybps=atoi(&argv[x][2]);
                else if(argv[x][1]=='C') connectbps = atoi(&argv[x][2]);
            } else strcpy(configname,argv[x]);
        }
    if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
        cleanup(ERROR,"Kunde inte öppna intuition.library\n");
    if(!(UtilityBase=OpenLibrary("utility.library",37L)))
        cleanup(ERROR,"Kunde inte öppna utility.library\n");
    if(!(NiKomBase=OpenLibrary("nikom.library",0L)))
        cleanup(ERROR,"Kunde inte öppna nikom.library\n");
    if(!initnode(NODSER)) cleanup(ERROR,"Kunde inte registrera noden i Servern\n");
    if(!(nikomnodeport = CreateMsgPort()))
        cleanup(ERROR,"Kunde inte skapa NiKomNode-porten");
    sprintf(nikomnodeportnamn,"NiKomNode%d",nodnr);
    nikomnodeport->mp_Node.ln_Name = nikomnodeportnamn;
    nikomnodeport->mp_Node.ln_Pri = 1;
    AddPort(nikomnodeport);
    sprintf(rexxportnamn,"NiKomPreRexx%d",nodnr);
    if(!(rexxport=(struct MsgPort *)CreateMsgPort()))
        cleanup(ERROR,"Kunde inte öppna RexxPort\n");
    rexxport->mp_Node.ln_Name=rexxportnamn;
    rexxport->mp_Node.ln_Pri=50;
    AddPort(rexxport);
    if(!(RexxSysBase=(struct RsxLib *)OpenLibrary("rexxsyslib.library",0L)))
        cleanup(ERROR,"Kunde inte öppna rexxsyslib.library\n");
    getnodeconfig(configname);
    if(pubscreen[0]=='-') tmppscreen=NULL;
    else tmppscreen=pubscreen;
    if(!(NiKwind=openmywindow(tmppscreen)))
        cleanup(ERROR,"Kunde inte öppna fönstret\n");
    if(getty) dtespeed = gettybps;
    else dtespeed = highbaud;
    if(!OpenIO(NiKwind)) cleanup(ERROR,"Couldn't setup IO");
    strcpy(Servermem->nodid[nodnr],nodid);
    conreqtkn();
    serreqtkn();
    Delay(50);
    for(;;) {
        inloggad=-1;
        Servermem->idletime[nodnr] = time(NULL);
        Servermem->inloggad[nodnr]=-1;
        if(getty) Servermem->connectbps[nodnr] = connectbps;
        else waitconnect();
        Servermem->idletime[nodnr] = time(NULL);
        Servermem->inloggad[nodnr]=-2; /* Sätt till <Uppringd> för att även hantera -getty-fallet */
reloginspec:
        updateinactive();
        Servermem->inne[nodnr].flaggor = Servermem->cfg.defaultflags;
        if(!getty) Delay(100);
        Servermem->inne[nodnr].rader=0;
        Servermem->inne[nodnr].chrset = CHRS_LATIN1;
        sendfile("NiKom:Texter/Inlogg.txt");
        if(Servermem->cfg.ar.preinlogg) sendrexx(Servermem->cfg.ar.preinlogg);
        car=TRUE;
        Servermem->inne[nodnr].chrset = 0;
        memset(commandhistory,0,1000);
        going=1;
        while(going && going<=Servermem->cfg.logintries) {
            putstring("\r\nNamn: ",-1,0);
            if(getstring(EKO,40,NULL)) {
                car=FALSE;
                break;
            }
            if(!stricmp(inmat,Servermem->cfg.ny)
                    && !(Servermem->cfg.cfgflags & NICFG_CLOSEDBBS)) {
                tmp = RegisterNewUser();
                if(tmp == 2) {
                    goto panik;
                }
                car = tmp ? 0 : 1;
                going=FALSE;
            } else if((inloggad=parsenamn(inmat))>=0) {
                if(readuser(inloggad,&Servermem->inne[nodnr])) {
                    puttekn("Error reading user data.\r\n", -1);
                    goto panik;
                }
                // TODO: Extract password loop. Should be identical to in NiKomCon.c
                forsok=2;
                while(forsok) {
                    puttekn("\r\nLösen: ",-1);
                    if(Servermem->inne[nodnr].flaggor & STAREKOFLAG)
                    {
                        if(getstring(STAREKO,15,NULL)) {
                            car=FALSE;
                            break;
                        }
                    }
                    else
                    {
                        if(getstring(EJEKO,15,NULL)) {
                            car=FALSE;
                            break;
                        }
                    }
                    if(CheckPassword(inmat, Servermem->inne[nodnr].losen))
                    {
                        forsok=FALSE;
                        going=FALSE;
                    } else forsok--;
                }
                if(going && (Servermem->cfg.logmask & LOG_FAILINLOGG)) {
                    LogEvent(USAGE_LOG, WARN, "Nod %d, %s angivet som namn, fel lösen.",
                             nodnr, getusername(inloggad));
                }
                if(going) going++;
            } else if(inloggad==-1) puttekn("\r\nHittar ej namnet\r\n",-1);
        }
        if(!car) {
            if(getty) cleanup(OK,"");
            disconnect();
            continue;
        }
        if(going) {
            putstring("\n\n\rTyvärr. Du har försökt maximalt antal gånger att logga in. Kopplar ned.\n\r",-1,0);
            goto panik;      /* Urrk vad fult. :-) */
        }
        Servermem->inloggad[nodnr]=inloggad;
        Servermem->idletime[nodnr] = time(NULL);
        if((nt = selectNodeType()) == NULL) {
            goto panik;
        }
        abortinactive();
        abortserial();

        sprintf(commandstring,"%s -N%d -B%d %s",nt->path,nodnr,dtespeed,configname);
        CloseConsole();
        CloseWindow(NiKwind);
        NiKwind = NULL;
        RemPort(nikomnodeport);

        i = 0;
        if(Servermem->connectbps[nodnr] > 0)
        {
            while(Servermem->info.bps[i] != Servermem->connectbps[nodnr] && Servermem->info.bps[i] > 0 && i<49)
                i++;

            if(i<49)
            {
                if(Servermem->info.bps[i] == Servermem->connectbps[nodnr])
                    Servermem->info.antbps[i]++;
                else
                {
                    Servermem->info.bps[i] = Servermem->connectbps[nodnr];
                    Servermem->info.antbps[i]++;
                }
            }

            if(!(fil = fopen("NiKom:datocfg/sysinfo.dat","w")))
            {
                /* putstring("Kunde inte spara nya sysinfo.dat..\n",-1,0); */
            }

            if(fwrite((void *)&Servermem->info,sizeof(Servermem->info),1,fil) != 1)
            {
                /* putstring("Kunde inte skriva till nya sysinfo.dat....\n",-1,0); */
            }
            fclose(fil);
        }

        nodestate = SystemTags(commandstring, SYS_UserShell, TRUE, TAG_DONE);
        AddPort(nikomnodeport);
        if(!getty || (nodestate & NIKSTATE_RELOGIN)) {
            if(!(NiKwind = openmywindow(tmppscreen))) cleanup(ERROR,"Kunde inte öppna fönstret\n");
            OpenConsole(NiKwind);
        }
        serreqtkn();
        if(nodestate & NIKSTATE_RELOGIN) goto reloginspec;
panik:
        Delay(hangupdelay);
        if(getty) cleanup(OK,"");
        disconnect();
    }
}
示例#2
0
void main(int argc, char **argv) {
  int going = TRUE, forsok = 2,car = 1, tmp, ch;
  long tid;
  char tellstr[100],*tmppscreen, titel[80];

  NewList((struct List *)&aliaslist);
  NewList((struct List *)&edit_list);
  if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
    cleanup(EXIT_ERROR,"Kunde inte öppna intuition.library\n");
  if(!(UtilityBase=OpenLibrary("utility.library",37L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna utility.library\n");
  if(!(LocaleBase=OpenLibrary("locale.library",38L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna locale.library\n");
  if(!(NiKomBase=OpenLibrary("nikom.library",0L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna nikom.linbrary");
  getnodeconfig("NiKom:Datocfg/ConNode.cfg");
  if(!(initnode(NODCON))) cleanup(EXIT_ERROR,"Kunde inte registrera noden i Servern\n");
  if(!(nikomnodeport = CreateMsgPort()))
    cleanup(EXIT_ERROR,"Kunde inte skapa NiKomNode-porten");
  sprintf(nikomnodeportnamn,"NiKomNode%d",nodnr);
  nikomnodeport->mp_Node.ln_Name = nikomnodeportnamn;
  nikomnodeport->mp_Node.ln_Pri = 1;
  AddPort(nikomnodeport);
  sprintf(rexxportnamn,"NiKomRexx%d",nodnr);
  if(!(rexxport=(struct MsgPort *)CreateMsgPort()))
    cleanup(EXIT_ERROR,"Kunde inte öppna RexxPort\n");
  rexxport->mp_Node.ln_Name=rexxportnamn;
  rexxport->mp_Node.ln_Pri=50;
  AddPort(rexxport);
  if(!(RexxSysBase=(struct RsxLib *)OpenLibrary("rexxsyslib.library",0L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna rexxsyslib.library\n");
  if(pubscreen[0]=='-') tmppscreen=NULL;
  else tmppscreen=pubscreen;
  if(!(NiKwind=(struct Window *)OpenWindowTags(NULL,WA_Left,xpos,
                                               WA_Top,ypos,
                                               WA_Width,xsize,
                                               WA_Height,ysize,
                                               WA_IDCMP,IDCMP_CLOSEWINDOW,
                                               WA_MinWidth,50,
                                               WA_MinHeight,10,
                                               WA_MaxWidth,~0,
                                               WA_MaxHeight,~0,
                                               WA_SizeGadget,TRUE,
                                               WA_SizeBBottom, TRUE,
                                               WA_DragBar,TRUE,
                                               WA_DepthGadget,TRUE,
                                               WA_CloseGadget,TRUE,
                                               WA_SimpleRefresh,TRUE,
                                               WA_ScreenTitle,"NiKomCon",
                                               WA_AutoAdjust,TRUE,
                                               WA_PubScreenName,tmppscreen,
                                               TAG_DONE)))
    cleanup(EXIT_ERROR,"Kunde inte öppna fönstret\n");
  if(!OpenIO(NiKwind)) cleanup(EXIT_ERROR,"Kunde inte öppna IO\n");
  strcpy(Servermem->nodid[nodnr],nodid);
  sprintf(titel,"Nod #%d CON: <Ingen inloggad>",nodnr);
  SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
  Servermem->connectbps[nodnr] = -1;
  conreqtkn();
  do {
    Servermem->idletime[nodnr] = time(NULL);
    memset(commandhistory,0,1024);
    Servermem->inne[nodnr].rader=0;
    sendfile("NiKom:Texter/Inlogg.txt");
    if(Servermem->cfg.ar.preinlogg) sendautorexx(Servermem->cfg.ar.preinlogg);
    going=TRUE;
    while(going) {
      Servermem->idletime[nodnr] = time(NULL);
      puttekn("\r\nNamn: ",-1);
      getstring(EKO,40,NULL);
      if(!stricmp(inmat,Servermem->cfg.ny)) {
        tmp = RegisterNewUser();
        if(tmp == 2) {
          goto panik;
        }
        car = tmp ? 0 : 1;
        going=FALSE;
      }
      else if((inloggad=parsenamn(inmat))>=0) {
        if(readuser(inloggad,&Servermem->inne[nodnr])) {
          puttekn("Error reading user data.\r\n", -1);
          goto panik;
        }
        // TODO: Extract password loop. Should be identical to in PreNode/Ser.c
        forsok=2;
        while(forsok) {
          puttekn("\r\nLösen: ",-1);
          if(Servermem->inne[nodnr].flaggor & STAREKOFLAG)
            getstring(STAREKO,15,NULL);
          else
            getstring(EJEKO,15,NULL);
          if(CheckPassword(inmat, Servermem->inne[nodnr].losen)) {
            forsok=FALSE;
            going=FALSE;
          } else {
            forsok--;
          }
        }
      } else if(inloggad==-1) puttekn("\r\nHittar ej namnet\r\n",-1);
    }
    sprintf(titel,"Nod #%d CON: %s #%d",nodnr,Servermem->inne[nodnr].namn,inloggad);
    SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
    if(!ReadUnreadTexts(&Servermem->unreadTexts[nodnr], inloggad)) {
      puttekn("Error reading unread text info.\r\n", -1);
      LogEvent(SYSTEM_LOG, ERROR,
               "Can't read unread text info for user %d", inloggad);
      goto panik;
    }
    Servermem->inloggad[nodnr]=inloggad;
    Servermem->idletime[nodnr] = time(NULL);
    if(getft("NiKom:Texter/Bulletin.txt")>Servermem->inne[nodnr].senast_in) sendfile("NiKom:Texter/Bulletin.txt");

    connection();

    if(Servermem->cfg.logmask & LOG_UTLOGG) {
      LogEvent(USAGE_LOG, INFO, "%s loggar ut från nod %d",
               getusername(inloggad), nodnr);
    }
    if(Servermem->say[nodnr]) displaysay();
    if(Servermem->cfg.ar.utlogg) sendautorexx(Servermem->cfg.ar.utlogg);
    sendfile("NiKom:Texter/Utlogg.txt");
    sprintf(titel,"Nod #%d CON: <Ingen inloggad>",nodnr);
    SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
    Servermem->inloggad[nodnr]=-1;
    
    Servermem->action[nodnr]=0;
    time(&tid);
    Servermem->inne[nodnr].senast_in=tid;
    Servermem->inne[nodnr].tot_tid+=(tid-logintime);
    Servermem->inne[nodnr].loggin++;
    Servermem->info.inloggningar++;
    Servermem->inne[nodnr].defarea=area2;
    writeuser(inloggad,&Servermem->inne[nodnr]);
    WriteUnreadTexts(&Servermem->unreadTexts[nodnr], inloggad);
    writesenaste();
    freealiasmem();
    sprintf(tellstr,"loggade just ut från nod %d",nodnr);
    tellallnodes(tellstr);
  panik:
    nodestate = 0;
    puttekn("\r\n\nEn inloggning till? (J/n)",-1);
  } while((ch = GetChar()) != 'n' && ch != 'N');
  cleanup(EXIT_OK,"");
}
示例#3
0
void main(int argc,char *argv[]) {
  int x;
  long tid;
  char tellstr[100],*tmppscreen, titel[80], configname[50] = "NiKom:DatoCfg/SerNode.cfg";
  if(argc>1) for(x=1;x<argc;x++) {
      if(argv[x][0]=='-') {
        if(argv[x][1]=='B') dtespeed=atoi(&argv[x][2]);
        else if(argv[x][1]=='N') nodnr = atoi(&argv[x][2]);
      } else strcpy(configname,argv[x]);
    }
  if(nodnr==-1) {
    printf("NiKomSer måste startas från prenoden.\n");
    exit(10);
  }
  NewList((struct List *)&aliaslist);
  NewList((struct List *)&edit_list);
  if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
    cleanup(EXIT_ERROR,"Kunde inte öppna intuition.library\n");
  if(!(UtilityBase=OpenLibrary("utility.library",37L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna utility.library\n");
  if(!(LocaleBase=OpenLibrary("locale.library",38L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna locale.library\n");
  if(!(NiKomBase=OpenLibrary("nikom.library",0L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna nikom.library\n");

  initnode(NODSPAWNED);
  if(!(nikomnodeport = CreateMsgPort()))
    cleanup(EXIT_ERROR,"Kunde inte skapa NiKomNode-porten");
  sprintf(nikomnodeportnamn,"NiKomNode%d",nodnr);
  nikomnodeport->mp_Node.ln_Name = nikomnodeportnamn;
  nikomnodeport->mp_Node.ln_Pri = 1;
  AddPort(nikomnodeport);
  sprintf(rexxportnamn,"NiKomRexx%d",nodnr);
  if(!(rexxport=(struct MsgPort *)CreateMsgPort()))
    cleanup(EXIT_ERROR,"Kunde inte öppna RexxPort\n");
  rexxport->mp_Node.ln_Name=rexxportnamn;
  rexxport->mp_Node.ln_Pri = 50;
  AddPort(rexxport);
  if(!(RexxSysBase=(struct RsxLib *)OpenLibrary("rexxsyslib.library",0L)))
    cleanup(EXIT_ERROR,"Kunde inte öppna rexxsyslib.library\n");
  getnodeconfig(configname);
  if(pubscreen[0]=='-') tmppscreen=NULL;
  else tmppscreen=pubscreen;
  if(!(NiKwind=(struct Window *)OpenWindowTags(NULL,WA_Left,xpos,
                                               WA_Top,ypos,
                                               WA_Width,xsize,
                                               WA_Height,ysize,
                                               WA_IDCMP,IDCMP_CLOSEWINDOW,
                                               WA_MinWidth,50,
                                               WA_MinHeight,10,
                                               WA_MaxWidth,~0,
                                               WA_MaxHeight,~0,
                                               WA_SizeGadget,TRUE,
                                               WA_SizeBBottom, TRUE,
                                               WA_DragBar,TRUE,
                                               WA_DepthGadget,TRUE,
                                               WA_CloseGadget,TRUE,
                                               WA_SimpleRefresh,TRUE,
                                               WA_ScreenTitle,"NiKomSer",
                                               WA_AutoAdjust,TRUE,
                                               WA_PubScreenName,tmppscreen,
                                               TAG_DONE)))
    cleanup(EXIT_ERROR,"Kunde inte öppna fönstret\n");
  if(!OpenIO(NiKwind)) cleanup(EXIT_ERROR,"Kunde inte öppna IO\n");
  inloggad=Servermem->inloggad[nodnr];
  conreqtkn();
  serreqtkn();
  UpdateInactive();
  sprintf(titel,"Nod #%d SER: %s #%d",nodnr,Servermem->inne[nodnr].namn,inloggad);
  SetWindowTitles(NiKwind,titel,(char *)-1L);
  if(!ReadUnreadTexts(&Servermem->unreadTexts[nodnr], inloggad)) {
    puttekn("Error reading unread text info.\r\n", -1);
    LogEvent(SYSTEM_LOG, ERROR,
             "Can't read unread text info for user %d", inloggad);
    cleanup(EXIT_ERROR, "Error reading unread text info.\n");
  }
  if(getft("NiKom:Texter/Bulletin.txt")>Servermem->inne[nodnr].senast_in) {
    sendfile("NiKom:Texter/Bulletin.txt");
  }

  connection();

  if(nodestate & NIKSTATE_NOCARRIER) {
    conputtekn("\nCarrier dropped\n",-1);
    if(Servermem->cfg.logmask & LOG_CARDROPPED) {
      LogEvent(USAGE_LOG, WARN, "%s släpper carriern (nod %d)",
               getusername(inloggad), nodnr);
    }
    if(Servermem->cfg.ar.cardropped) sendautorexx(Servermem->cfg.ar.cardropped);
  } else {
    if(nodestate & NIKSTATE_AUTOLOGOUT) {
      puttekn("\n\n\r*** Automagisk utloggning ***\n\n\r",-1);
    } else if(nodestate & NIKSTATE_INACTIVITY) {
      puttekn("\n\n\r*** Utloggning p.g.a inaktivitet ***\n\n\r",-1);
    }
    radcnt=-174711;
    if(Servermem->say[nodnr]) displaysay();
    if(Servermem->cfg.ar.utlogg) sendautorexx(Servermem->cfg.ar.utlogg);
    sendfile("NiKom:Texter/Utlogg.txt");
  }
  Servermem->inloggad[nodnr]=-1;
  if(Servermem->cfg.logmask & LOG_UTLOGG) {
    LogEvent(USAGE_LOG, INFO, "%s loggar ut från nod %d",
             getusername(inloggad), nodnr);
  }
  Servermem->action[nodnr]=0;
  time(&tid);
  Servermem->inne[nodnr].senast_in=tid;
  Servermem->inne[nodnr].tot_tid+=(tid-logintime);
  Servermem->inne[nodnr].loggin++;
  Servermem->info.inloggningar++;
  Servermem->inne[nodnr].defarea=area2;
  writeuser(inloggad,&Servermem->inne[nodnr]);
  WriteUnreadTexts(&Servermem->unreadTexts[nodnr], inloggad);
  writesenaste();
  AbortInactive();
  freealiasmem();
  sprintf(tellstr,"loggade just ut från nod %d",nodnr);
  tellallnodes(tellstr);

  if(nodestate & NIKSTATE_NOCARRIER) {
    nodestate &= ~NIKSTATE_RELOGIN;
  }
  nodestate &= (NIKSTATE_RELOGIN | NIKSTATE_CLOSESER | NIKSTATE_NOANSWER);
  cleanup(nodestate,"");
}
示例#4
0
void main(int argc, char **argv) {
	int going=TRUE,forsok=2,car=1;
	long tid;
	char tellstr[100],*tmppscreen, titel[80];
	UBYTE tillftkn;
	NewList((struct List *)&aliaslist);
	NewList((struct List *)&edit_list);
	if(!(IntuitionBase=(struct IntuitionBase *)OpenLibrary("intuition.library",0)))
		cleanup(ERROR,"Kunde inte öppna intuition.library\n");
	if(!(UtilityBase=OpenLibrary("utility.library",37L)))
		cleanup(ERROR,"Kunde inte öppna utility.library\n");
	if(!(NiKomBase=OpenLibrary("nikom.library",0L)))
		cleanup(ERROR,"Kunde inte öppna nikom.linbrary");
	getnodeconfig("NiKom:Datocfg/ConNode.cfg");
	if(!(initnode(NODCON))) cleanup(ERROR,"Kunde inte registrera noden i Servern\n");
	if(!(nikomnodeport = CreateMsgPort()))
		cleanup(ERROR,"Kunde inte skapa NiKomNode-porten");
	sprintf(nikomnodeportnamn,"NiKomNode%d",nodnr);
	nikomnodeport->mp_Node.ln_Name = nikomnodeportnamn;
	nikomnodeport->mp_Node.ln_Pri = 1;
	AddPort(nikomnodeport);
	sprintf(rexxportnamn,"NiKomRexx%d",nodnr);
	if(!(rexxport=(struct MsgPort *)CreateMsgPort()))
		cleanup(ERROR,"Kunde inte öppna RexxPort\n");
	rexxport->mp_Node.ln_Name=rexxportnamn;
	rexxport->mp_Node.ln_Pri=50;
	AddPort(rexxport);
	if(!(RexxSysBase=(struct RsxLib *)OpenLibrary("rexxsyslib.library",0L)))
		cleanup(ERROR,"Kunde inte öppna rexxsyslib.library\n");
	if(pubscreen[0]=='-') tmppscreen=NULL;
	else tmppscreen=pubscreen;
	if(!(NiKwind=(struct Window *)OpenWindowTags(NULL,WA_Left,xpos,
																	  WA_Top,ypos,
																	  WA_Width,xsize,
																	  WA_Height,ysize,
																	  WA_IDCMP,IDCMP_CLOSEWINDOW,
																	  WA_MinWidth,50,
																	  WA_MinHeight,10,
																	  WA_MaxWidth,~0,
																	  WA_MaxHeight,~0,
																	  WA_SizeGadget,TRUE,
																	  WA_SizeBBottom, TRUE,
																	  WA_DragBar,TRUE,
																	  WA_DepthGadget,TRUE,
																	  WA_CloseGadget,TRUE,
																	  WA_SimpleRefresh,TRUE,
																	  WA_ScreenTitle,"NiKom © Tomas Kärki 1996-1998",
																	  WA_AutoAdjust,TRUE,
																	  WA_PubScreenName,tmppscreen,
																	  TAG_DONE)))
		cleanup(ERROR,"Kunde inte öppna fönstret\n");
	if(!OpenIO(NiKwind)) cleanup(ERROR,"Kunde inte öppna IO\n");
	if(!getkeyfile())
		cleanup(ERROR,"Korrupt nyckelfil\n");
	strcpy(Servermem->nodid[nodnr],nodid);
	sprintf(titel,"Nod #%d CON: <Ingen inloggad>",nodnr);
	SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
	Servermem->connectbps[nodnr] = -1;
	conreqtkn();
do
{
	memset(commandhistory,0,1024);
	Servermem->inne[nodnr].rader=0;
	sendfile("NiKom:Texter/Inlogg.txt");
	if(Servermem->cfg.ar.preinlogg) sendrexx(Servermem->cfg.ar.preinlogg);
	going=TRUE;
	while(going) {
		puttekn("\r\nNamn: ",-1);
		getstring(EKO,40,NULL);
		if(!stricmp(inmat,Servermem->cfg.ny))
		{
/*			if(!reggadnamn[0] && ((struct ShortUser *)Servermem->user_list.mlh_TailPred)->nummer >= 4)
				puttekn("\n\n\rDenna demoversion av NiKom kan hantera maximalt 5 användare.\n\r",-1);
			else { Versionen är nu obegränsad 970930! */
				if((car=nyanv())==2) goto panik;
				going=FALSE;
/*			} */
		}
		else if((inloggad=parsenamn(inmat))>=0) {
			readuser(inloggad,&Servermem->inne[nodnr]);
			forsok=2;
			while(forsok) {
				puttekn("\r\nLösen: ",-1);
				if(Servermem->inne[nodnr].flaggor & STAREKOFLAG)
					getstring(STAREKO,15,NULL);
				else
					getstring(EJEKO,15,NULL);
				if(CheckPassword(inloggad, inmat))
				{
					forsok=FALSE;
					going=FALSE;
				} else forsok--;
			}
		} else if(inloggad==-1) puttekn("\r\nHittar ej namnet\r\n",-1);
	}
	sprintf(titel,"Nod #%d CON: %s #%d",nodnr,Servermem->inne[nodnr].namn,inloggad);
	SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
	readuserbitmap(inloggad,Servermem->bitmaps[nodnr],0,temppek);
	Servermem->inloggad[nodnr]=inloggad;
	Servermem->idletime[nodnr] = time(NULL);
	if(getft("NiKom:Texter/Bulletin.txt")>Servermem->inne[nodnr].senast_in) sendfile("NiKom:Texter/Bulletin.txt");
	connection();
	if(Servermem->cfg.logmask & LOG_UTLOGG) {
		sprintf(outbuffer,"%s loggar ut från nod %d",getusername(inloggad),nodnr);
		logevent(outbuffer);
	}
	if(Servermem->say[nodnr]) displaysay();
	if(Servermem->cfg.ar.utlogg) sendrexx(Servermem->cfg.ar.utlogg);
	sendfile("NiKom:Texter/Utlogg.txt");
	sprintf(titel,"Nod #%d CON: <Ingen inloggad>",nodnr);
	SetWindowTitles(NiKwind,titel,(UBYTE *)-1L);
	SaveProgramCategory(inloggad);
	Servermem->inloggad[nodnr]=-1;

	Servermem->action[nodnr]=0;
	Servermem->inne[nodnr].textpek=textpek;
	time(&tid);
	Servermem->inne[nodnr].senast_in=tid;
	Servermem->inne[nodnr].tot_tid+=(tid-logintime);
	Servermem->inne[nodnr].loggin++;
	Servermem->info.inloggningar++;
	Servermem->inne[nodnr].defarea=area2;
	writeuser(inloggad,&Servermem->inne[nodnr]);
	writeuserbitmap(inloggad,Servermem->bitmaps[nodnr],0,temppek);
	writesenaste();
	freealiasmem();
	sprintf(tellstr,"loggade just ut från nod %d",nodnr);
	tellallnodes(tellstr);
panik:
	puttekn("\r\n\nEn inloggning till? (J/n)",-1);
	} while((tillftkn=gettekn())!='n' && tillftkn!='N');
	cleanup(OK,"");
}