Metropoli BBS
VIEWER: swho.pps MODE: TEXT (ASCII)
; S!SWHO Beta 2
;
; Author    : Andreas Skau aka Buzh
; Copyright : Snusk!Soft 1996
; Notice    : This source code is copyrighted, so don't go ripping it.
;             You may take ideas from it, but don't cut and paste,
;             and if you do, please include a greeting to me :)
;             BTW : I have superhuman powers, and I make Batman look
;             like a boyscout, so don't mess with me.. 
;             Besides, this is a beta, and probably filled with bugs.
;             Read the doc's for more info..

;internal variables
string name_t, snode_t, name, city, opstat, nodestat, version

int xpos, ypos
int existnode
int node, node_t
int h, i, j
int x_node
int conf
int secu
int lypos_b
int sel
int timeon(200)
int msgwritten(200)

double recnum(200)
double speed(200)
double axs(200)

;user defined variables
string defcol
string key
string l_char ;charachter for lightbar
int y_add, x_add, yx_add
int maxnode   ;maximum number of nodes
int x_name    ;x pos of name
int x_city    ;         city
int x_axs     ;         access
int x_speed   ;         speed
int x_ns      ;         node status
int y_prompt  ;prompt y coord when exit         
int lx_pos    ;xpos of lightbar

; ##### Extended Info Variables #####

int xtname    ;ypos of name
int xtstat    ;ypos of nodestat
int xtopstat  ;ypos of opstat

;initializations
node     = 1
yx_add   = y_add
version  = "Internal Beta 2"

;redim secu,maxnode
;redim conf,maxnode

;            ############## declarations #################
declare procedure getinfo       (int node)
declare procedure disp_name     (int node, int xpos, int ypos)
declare procedure disp_city     (int node)
declare procedure disp_opstat   (int sel)
declare procedure disp_node     (int node)
declare procedure readcfg       ()
declare procedure erasercurs    ()
declare procedure readinfo      (int node)
declare procedure disp_axs      (int node, int axs(node))
declare procedure disp_conf     (int node)
declare procedure disp_speed    (int node,double speed)
declare procedure barcheck      ()
declare procedure dispsel       (int sel)
declare procedure erasesel      (int sel)
declare procedure dispextnfo    (int sel)
declare procedure disp_nodestat (int sel)
declare procedure dispnornfo    (int node)
declare procedure writenode     ()

;          #############---- main loop ----###############

:mainloop
begin
cls
readcfg()
sel = 1
writenode()
dispfile ppepath() + "swho.pcb", graph

:point1
 key = inkey()
 if (key = chr(027)) goto exitloop
  barcheck()
  dispsel(sel)
  readinfo(node)
  dispnornfo(node)
  node = node +1

 if (node > maxnode) node = 1
 goto point1


:exitloop
ansipos 1 , y_prompt
end


;           ############### procedures ################

procedure disp_opstat(int sel)
  ansipos x_add, yx_add + xtopstat
  ;if (opstat = "") print "                   "
  print "                   "
  ansipos x_add, yx_add + xtopstat
  print opstat 
endproc

procedure writenode()
  wrunet pcbnode(), UN_Stat(), UN_Name(), UN_City(), "In Snusk!Soft Who " + version, ""
endproc

procedure dispextnfo(int node)
 cls
 dispfile ppepath() + "extnfo.pcb",Graph
  while (key <> chr(27)) then
   key = inkey()
   getinfo(node)
   disp_name(node, x_add , xtname)
   disp_nodestat(sel)
   disp_opstat  (sel)
   sel = 1
  endwhile
 cls
 dispfile ppepath() + "swho.pcb", graph
endproc


procedure dispnornfo(int node)
  disp_node  (node)
  disp_name  (node,x_name, node + y_add)
  disp_city  (node)
  disp_axs   (node,axs(node))
  disp_speed (node,speed(node))
endproc

procedure dispsel(int sel)
  erasesel(lypos_b)
  AnsiPos lx_pos,y_add + sel
  lypos_b = y_add+sel
  print defcol + l_char
 erasercurs()
Endproc

procedure erasesel(int sel)
 ansipos lx_pos,lypos_b
 print " "
 erasercurs()
endproc

procedure BarCheck()
 select case key
  case "UP"
   sel = sel - 1
   if (sel = 0) sel = maxnode
  case "DOWN"
   sel = sel + 1 
   if (sel = maxnode + 1) sel = 1
  case chr(27)
   end 
  case chr(73)
   ansipos 1,1
   cls
   println "PPE Name : Snusk!Soft Who " + version
   println "Authour  : Buzh"
   more
  case chr(13)
   dispextnfo(sel)
  end select
endproc

procedure disp_conf(int node)
 if (existnode) then
  ansipos x_axs, node + y_add
  print defcol, conf
 endif
endproc

procedure disp_speed(int node, double speed)
 if (existnode) then
  ansipos x_speed, node + y_add
  print defcol, speed(node)
 endif
endproc

procedure erasercurs()
color 0
ansipos 1,y_prompt
print " "
backup 1
endproc

procedure disp_node(int node)
  ansipos x_node, node + y_add
  print defcol, node
  erasercurs()
endproc

procedure disp_city(int node)
  rdunet node
  city = UN_City()  
  ansipos x_city, node + y_add
  print defcol , city
  erasercurs()
endproc


procedure disp_name(int node, int xpos, int ypos)
  rdunet node
  name = UN_Name()
 if (name = "") then 
     name = "No caller online" 
 else
     print  "                "
 endif
 
  ansipos xpos, ypos
  print defcol , name
  erasercurs()
endproc

procedure getinfo(int node)
  rdunet node
  Name           = UN_NAME()
  City           = UN_City()
  opstat         = UN_oper()
  nodestat       = UN_stat()
endproc

procedure disp_axs(int node, double axs)
  ansipos x_axs, node + y_add
  print defcol , axs(node)
  erasercurs()
endproc
 
procedure readinfo(int node)
 string temp
 temp     = string(node)
 name_T   = "node" + temp
 
  if (exist(ppepath() + name_t)) then
     existnode = TRUE   
     fopen 1, ppepath() + name_t, O_RD, S_DN
     fget 1, axs(node)
     fget 1, conf(node)
     fget 1, speed(node)
     fget 1, timeon(node)
     fget 1, msgwritten(node)
     fget 1, recnum(node)
    fclose 1
  endif
endproc

procedure readcfg()
  fopen 1, ppepath() + "swho.cfg", O_RD, S_DN
   fget 1, y_add
   fget 1, x_node
   fget 1, x_name
   fget 1, x_city
   fget 1, x_speed
   fget 1, x_axs
   fget 1, maxnode
   fget 1, y_prompt
   fget 1, defcol
   fget 1, l_char
   fget 1, x_add
   fget 1, xtname
   fget 1, xtstat
   fget 1, xtopstat
  fclose 1
endproc  


procedure disp_nodestat(int sel)
  string nstat
  
  rdunet node
  nstat = un_stat()
  
  ansipos x_add, yx_add + xtstat

  if (nodestat = "A") nstat = "Avaliable for chat   "
  if (nodestat = "B") nstat = "Out to DOS           "
  if (nodestat = "C") nstat = "Chatting with SysOp  "
  if (nodestat = "D") nstat = "Inside a Door        "
  if (nodestat = "E") nstat = "Entering a message   "
  if (nodestat = "F") nstat = "Viewing a file       "
  if (nodestat = "G") nstat = "Chatting woth group  "
  if (nodestat = "H") nstat = "Handling Mail        "
  if (nodestat = "L") nstat = "Auto-Logoff Pending  "
  if (nodestat = "M") nstat = "Message              "
  if (nodestat = "N") nstat = "Running Event        "
  if (nodestat = "O") nstat = "Logging Onto System  "
  if (nodestat = "P") nstat = "Paging the SysOp     "
  if (nodestat = "R") nstat = "DOS recycle pending  "
  if (nodestat = "S") nstat = "Answering Script     "
  if (nodestat = "T") nstat = "Transferring a file  "
  if (nodestat = "U") nstat = "Unavailiable for chat"
  if (nodestat = "V") nstat = "No caller online     "
  if (nodestat = "W") nstat = "Waiting for Node     "
  if (nodestat = "X") nstat = "Drop to DOS pending  "
  if (nodestat = "Y") nstat = "No caller this node  "

  print defcol , nstat
endproc
[ RETURN TO DIRECTORY ]