All pastes #763817 Raw Edit

Metal Code

public text v1 · immutable
·published 2007-11-06 19:34 UTC
rendered paste body
!------------------------------------------------------------------------
! GATE_LocateNewsfeed
!------------------------------------------------------------------------
! Entry Conditions
! ----------------
!  This routine needs a call to GATE_LoadFeedsList first
!  1. &1$ = NewsGroup Name
!
! Exit Conditions
! ---------------
!  1. &1 = Number of Local Sub Board
!  2. &2 = Number of Network Conference
!
! Error Codes
! -----------
! -1 = No feeds loaded
! -2 = No match found
!------------------------------------------------------------------------
GATE_LocateNewsFeed ! Match the newsfeed to the info in 2/use.feeds
]PullGroup
 if not feed &1=-1:goto ]Exit
 &2=instring(",",&1$):if not &2 goto ]KillSpace
 if &2 &1$=left$(&1$,&2-1)
 if debug gosub DisplayStatus("Newsgroup = "+&1$)
]KillSpace
 &3=instring(",",&1$):if not &3 goto ]Loop
 if &3 &1$=&1$[&3+1]
 if debug gosub DisplayStatus("Newsgroup = "+&1$)
]Loop
 for &1=1 to feed
 if debug gosub DisplayStatus("Conf #"+str$(feed(&1))+" = "+feed$(&1))
  if &1$=feed$(&1) pop for:&2=nconf(&1):&1=feed(&1):goto ]Exit ! Got it!
 next &1
 &1=-2 ! Signal an error / Unsupported feed
]Exit
 return(&1,&2)

!------------------------------------------------------------------------
! GATE_PostMessage - Post a message to Local and Network (if avail)
!------------------------------------------------------------------------
! Entry Conditions
! ----------------
! Must have MSG.BASE.SUBS included for MSG_ calls.
!  1. lcl = Local Sub-Board Number
!  2. net = Network Conference Number
!  3. &1$ = File to be posted
!
! Exit Conditions
! ---------------
!
! Error Codes - returned in &1
! -----------
!  0 = No Error
! -1 = No Local Sub Base (Must have one if we are the host)
! -2 = Local: Board filename does not exist
! -3 = Local: Board was full
! -4 = Network: No Destinations found
!------------------------------------------------------------------------
GATE_PostMessage ! &1=Board Number &1$=file to post
 if not lcl &1=-1:goto ]Exit ! No Local Sub Base
 if debug gosub DisplayStatus("Fname:"+&1$+" L:"+str$(lcl)+" N:"+str$(net))
 if debug get opt$
 pst$=&1$
 gosub GATE_PostLocal(lcl,pst$)(&1)
 if debug gosub DisplayStatus("Fname:"+&1$+" L:"+str$(lcl)+" N:"+str$(net))
 if debug get opt$
 gosub GATE_PostNetwork(net,pst$)(&1)
 lcl=0:net=0 ! Cleanup our var. Airtight now, I'll make it watertight later!
]Exit
 return(&1)

!------------------------------------------------------------------------
! GATE_PostLocal - Post a message to Local Sub Board
!------------------------------------------------------------------------
! Entry Conditions
! ----------------
!  1. &1  = Local Sub Board to post on
!  1. &1$ = File to be posted
!
! Exit Conditions
! ---------------
!
! Error Codes - returned in &1
! -----------
!  0 = No error
! -2 = Board filename does not exist
! -3 = Board was full
!------------------------------------------------------------------------
GATE_PostLocal
 &1$=pst$
 if debug gosub DisplayStatus("Posting "+&1$+" to "+str$(&1)):get opt$
 brdn=&1:gosub MSG_openbase ! Make the call and open the base
 if (brdn$="") and (&1) &1=-2:goto ]Exit ! Board filename does not exist
]CompactBase
 long if smf_info(msg,2)=smf_info(msg,1)
   if parm(1)=0 pop if:&1=-3:goto ]Exit
   bltn=parm(1):smf_delete(msg,bltn)
 end if
 bltn=smf_info(msg,2)+1
 gosub NET_UnbuildDate(datp$)(datp$)
 gosub MSG_CreateHeader
 open #1,edd$:append #1:fcopy &1$ to #1:? #1,null$:close #1
 f$=edd$
 open #1,f$:x=filesize(1):close #1
 smf_allocate(msg,bltn,x)
 smf_write(msg,bltn,f$):smf_user(msg,bltn)=parm(0)+1
 smf_flush(msg)
 parm(0)==+1:stat(10,0)==+1:stat(10,1)==+1
 stat(11,0)==+size:stat(11,1)==+size
 gosub MSG_UpdateBase
 gosub MSG_closebase
]Exit
 return(&1) ! Error code or status

!------------------------------------------------------------------------
! GATE_PostNetwork - Send the message out to hosted conf's subscribers
!------------------------------------------------------------------------
! Entry Conditions
! ----------------
! Must have NETWORK.MANAGER included for NET_ calls.
!  1. &1  = Conference Number
!  1. &1$ = File to be posted
!
! Exit Conditions
! ---------------
!
! Error Codes - returned in &1
! -----------
!  0 = No error
! -4 = No Destinations Found
!------------------------------------------------------------------------
GATE_PostNetwork
 &1$=pst$
 if debug gosub DisplayStatus("Posting Net "+&1$+" Conf#"+str$(&1)):get opt$
]FindDests
 open #1,"4/conf."+str$(&1)
 input #1,dest:if dest>0 input #1,dest(1) to dest(dest)
 if debug gosub DisplayStatus(str$(dest)+" Destinations")
 close #1
]Check
 if not dest &1=-4:goto ]Exit ! Conference has no subscribers
 x$="~Conferencing":gosub NET_Startup ! We are now "conferencing"
 long if debug
  ? "whom$="whom$" whom="whom" ds="ds
  ? "from$="from$" from="from" ss="ss
  ? "&1$="&1$" datp$="datp$" status="status
 end if
 gosub MSG_CreateHeader
 open #1,edd$:append #1:fcopy &1$ to #1:close #1
 chtyp=&1:src=ourid:ss=0:usr=0:ch=2:i=1
 gosub NET_WriteToChannel
]Exit
 dest=0 ! Cleanup our variables!
 return(&1) ! Error code or status