home *** CD-ROM | disk | FTP | other *** search
/ Beijing Paradise BBS Backup / PARADISE.ISO / software / BBSDOORW / PBBS401B.ZIP / DISK2.PWR / POWROBJ2.PAS < prev    next >
Encoding:
Pascal/Delphi Source File  |  1995-02-19  |  36.7 KB  |  1,034 lines

  1. {$M 20000, 20000}
  2. library PowrObj2;
  3. {$R Test.Res}
  4. { PowerBBS Development Add-On DLL }
  5. { (c) 1994 by Russell E. Frey     }
  6.  
  7. { This source code may be freely distributed. }
  8. { You may create a 3rd party DLL add-on to PowerBBS, and
  9.   distribute it ROYALTY FREE. }
  10.  
  11. { You may even modify this code and distribute it, so long as you
  12.   note the modifications at the top of the code and keep ALL the
  13.   comments here at the top.}
  14.  
  15. { Be sure to announce your product on our BBS: 516-822-7396 and/or
  16.   distribute shareware versions of your DLL on our BBS.  We will do
  17.   our best to help you distribute your product! }
  18.  
  19. { If you translate this code to a different language, please consider
  20.   making your translation FREEWARE and upload it to the BBS.  Be sure
  21.   to thoroughly debug your translation (you do not want to mess up
  22.   the users record or they will not be happy!) }
  23.  
  24. { Sample code in Borland Pascal 7.0 on writing an add-on DLL for PowerBBS }
  25.  
  26. { This code can easily be translated to ANY language capable of writing a DLL }
  27. { To run this DLL, in PowerBBS MENU SETUP at the CGM option place a D [For
  28.   DLL!].  Then in the description of command put the NAME of the actual
  29.   DLL created.  For example this file: POWRDLL.DLL would be placed in
  30.   the description.
  31.  
  32.   When a user now selects the command PowerBBS will dynamically load
  33.   POWRDLL.DLL.  It will execute VERY FAST.  This is an easy way to create
  34.   a 3rd party add-on as if it was written inside of PowerBBS!  The user
  35.   will notice NO SLOWDOWN! }
  36.  
  37. { PowerLang's RUN_DLL command may also be used to execute the DLL }
  38.  
  39. { We welcome ALL your comments on the Power of PowerBBS's DLL }
  40. { We also welcome any questions you might have, but due to time }
  41. { constraints may not be able to help you in some cases (including
  42.   debugging your code, etc). }
  43.  
  44. { Be aware that this product is provided AS IS.  We are not
  45.   liable for ANY problems this DLL may cause. }
  46.  
  47. uses
  48.   WinDos,
  49.   Strings,
  50.   WinProcs,
  51.   WinTypes;
  52.  
  53. { Need Colors?  Use the following in your Print_Modem calls:
  54.  
  55.   AFTER calling the CONVERT_MACROS procedure!
  56.  
  57.   @1@ Blue
  58.   @2@ Green
  59.   @3@ Cyan
  60.   @4@ Red
  61.   @5@ Magenta
  62.   @6@ Gray
  63.   @7@ Yellow
  64.   @8@ Brown
  65.   @9@ White
  66.   @10@ Light Blue
  67.   @11@ Light Green
  68.   @12@ Light Cyan
  69.   @13@ Light Red
  70.   @14@ Light Magenta
  71.   @15@ Light Gray
  72.   @16@ Default Color
  73.  
  74.   Colors will ONLY be used if the caller has ANSI capabilities.
  75. }
  76.  
  77.  
  78. {-----------------------------------------------------------------------------}
  79. { User types to directly manipulate user information.                         }
  80. { NEVER MANIPULATE any information unless you are SURE of what you are doing! }
  81. {-----------------------------------------------------------------------------}
  82. Type
  83.    packed_2_chars  = array[1..2] of char;
  84.    packed_3_chars  = array[1..3] of char;
  85.    packed_4_chars  = array[1..4] of char;
  86.    packed_5_chars  = array[1..5] of char;
  87.    packed_6_chars  = array[1..6] of char;
  88.    packed_7_chars  = array[1..7] of char;
  89.    packed_8_chars  = array[1..8] of char;
  90.    packed_9_chars  = array[1..9] of char;
  91.    packed_10_chars = array[1..10] of char;
  92.    packed_11_chars = array[1..11] of char;
  93.    packed_12_chars = array[1..12] of char;
  94.    packed_13_chars = array[1..13] of char;
  95.    packed_14_chars = array[1..14] of char;
  96.    packed_15_chars = array[1..15] of char;
  97.    packed_16_chars = array[1..16] of char;
  98.    packed_19_chars = array[1..19] of char;
  99.    packed_20_chars = array[1..20] of char;
  100.    packed_23_chars = array[1..23] of char;
  101.    packed_24_chars = array[1..24] of char;
  102.    packed_25_chars = array[1..25] of char;
  103.    packed_30_chars = array[1..30] of char;
  104.    packed_39_chars = array[1..39] of char;
  105.    packed_40_chars = array[1..40] of char;
  106.    packed_32_chars = array[1..32] of char;
  107.    packed_35_chars = array[1..35] of char;
  108.    packed_45_chars = array[1..45] of char;
  109.    packed_78_chars = array[1..78] of char;
  110.    packed_128_chars = array[1..128] of char;
  111.  
  112.   {Specification of the PowerUser_Rec. variable which stores the current
  113.    users information.}
  114.  pPowrUser_Record = ^PowrUser_Record;
  115.   PowrUser_Record = record
  116.          name:                packed_25_chars;    {Name}
  117.          Location:            packed_20_chars;    {City/Location}
  118.          Computer:            packed_15_chars;    {Computer Type}
  119.          Phone_Number:        packed_14_chars;    {Phone Number} {Home}
  120.          Password:            packed_10_chars;    {Password}
  121.          Birthday:            packed_8_chars;     {Date of birthday, DD/MM/YY}
  122.          First_Call:          packed_8_chars;     {Date of first call, DD/MM/YY}
  123.          Last_File_Scan:      packed_8_chars;     {Date of last file search, DD/MM/YY}
  124.          Expiration_Date:     packed_8_chars;     {Expiration Date}
  125.          Last_Call:           packed_8_chars;     {Date of last call, DD/MM/YY}
  126.          Last_Time:           packed_5_chars;     {Time of last call, HH:MM}
  127.          Calls:               integer;    {Total number of calls}
  128.          uploads:             integer;    {Total number of uploads}
  129.          downloads:           integer;    {Total number of downloads}
  130.          Time_On:             integer;    {Minutes used TODAY}
  131.          Today_Bytes:         double;     {Bytes downloaded TODAY}
  132.          Download_Bytes:      double;     {Total bytes downloaded}
  133.          Upload_Bytes:        double;     {Total bytes uploaded}
  134.          JUNK:                array[1..820] of byte;
  135.          Qwk_Init:            byte;
  136.          QWK_Flag1,
  137.          QWK_Flag2:           byte;
  138.          QWK_Flag3,
  139.          QWK_Flag4:           word;
  140.          internaluse:         byte;
  141.          waiting_messages:    word; { number of messages waiting }
  142.          reservedb:           byte;
  143.          reservedl:           longint;
  144.          handle_new:           byte;
  145.          info_in_new_numbs:    byte; {if<>200 then just junk in next fields:}
  146.          chat_use_handle:      boolean;
  147.          qwk_msg_use_handle:   boolean;
  148.          data_phone:           packed_14_chars;
  149.          business_number:      packed_14_chars;
  150.          fax_number:           packed_14_chars;
  151.  
  152.          bchat_exit:           Byte; {if=200 use string}
  153.          chat_exit:           String[60];
  154.          bchat_entry:          Byte; {if=200 use string}
  155.          chat_entry:          String[60];
  156.          Access:              Byte;       {Access Level}
  157.          Expiration_Access:   Byte;       {Expired Access Level}
  158.          Screen_Lines:        Byte;       {Length of a page}
  159.          Safe_Total:          Byte;       {Time in Bank}
  160.          Options:             byte;       {Option bits}
  161.           {bit value 1 = expert; 4 = dead; 8 = hasmail; 16=TRUE,64=TRUE then 32=TRUE[MALE];FALSE[FEMALE]}
  162.          Xproto:              Char;       {Protocol}
  163.          Monitor_Type:        Char;       {Monitor? (M)onocrome (C)olor (N)one}
  164.          Messages_Left:       word;       {total messages left by user}
  165.          downbytes_month:     double;           {total bytes downloaded/month}
  166.          downbytesmonth:      byte;
  167.          downbytes_month_max: word;             {max downbytes/month}
  168.          truebps2:            packed_5_chars;   {true baud rate}
  169.          lang_num:            byte;             {current language number}
  170.          is_focused:          boolean;              {used internally}
  171.          powercomm_connect:   boolean;              {true if PowerComm
  172.                                                      connect}
  173.          color_mode_connect:  boolean;              {true if PowerComm/
  174.                                                      color_mode connect}
  175.          last_forum_on2:      byte;                 {last forum joined}
  176.          credits:             longint;              {amount of credits left}
  177.          anony_name2:         string[15];           {JUNK}
  178.          script:              array[1..37] of char; {used for scripts}
  179.          auto_forum_join_set: char; { = 10 means use auto forum join! }
  180.          auto_forum_join:     integer;
  181.          set_up_int_msgs:     byte;   { = 10 if use next two options! }
  182.          max_internet_msgs_month: word;
  183.          current_internet_msgs_month: word;
  184.          the_internet_month: byte;
  185.  
  186.          allow_FTPmail:       byte;   {allow if = 10}
  187.          dollars:             word;
  188.          call_verified:       byte;
  189.          anonymous_name:      array[1..20] of char;
  190.          has_anonyname:       char; { if true, set to 10 }
  191.          has_address:         char; { if true, set to 10 }
  192.          last_menu_code:      byte;
  193.          QWK_Net_User:        byte; { if true, set to 10 }
  194.          area_backnum:        array[1..3] of char;
  195.          last_forum_on:       integer;
  196.          created_rec:         char; { if true, set to 10 }
  197.          PowerUser_Ext_Num:   word;
  198.  
  199.          address:             array[1..50] of char; {address} {location above}
  200.          state:               array[1..10] of char;  {state}
  201.          zip:                 array[1..10] of char; {zip}
  202.  
  203.          call_backnum:        array[1..7] of char;  {Called Number}
  204.        end;
  205.  
  206.   { The following record holds the forum information (all 1000 forums) }
  207. const
  208.   highest_ext_forum_number = 999; { was 1000 }
  209.  
  210. type
  211.    { data structure for PowerUser_Rec.Forum }
  212.    forum_data_options_record = record
  213.       Options:    byte;            {Options}
  214.         {bit value 1 = member
  215.                    2 = 2
  216.              16= join_it}
  217.       Message_Pointer: single;     {Pointer to message last read}
  218.    end;
  219.  
  220.   Array_Of_Forum_Ext = array[0..highest_ext_forum_number] of forum_data_options_record;
  221.  
  222.  pPowrUser_Record_Extension = ^PowrUser_Record_Extension;
  223.   PowrUser_Record_Extension = record
  224.     Delete_This:  boolean;
  225.     Forum_Data:   Array_Of_Forum_Ext;       {0..999}
  226.     user_name:    longint;    { 32 bit CRC of user name }
  227.     junk:         byte;
  228.   end;
  229.  
  230.   {Specification of the Power_CallInfo_Rec; holds the current caller's
  231.    information (The USERINFO.BBS File) }
  232.  pPower_CallInfo_Rec = ^Power_CallInfo_Rec;
  233.   Power_CallInfo_Rec = record
  234.     name:             packed_25_chars;         {User Name}
  235.     User_Pointer:     integer;        {User Record # starting at 1}
  236.     BaudRate:         packed_5_chars;          {Baud Rate to Send at}
  237.     Com_Number:       char;           {Com Number to Send at}
  238.     What_Menu:        byte;           {Current Menu}
  239.     color_mode:         char;           {Gcolor_modeType:
  240.                                         'C' => Color
  241.                                         'M' => Monochrome
  242.                                         'N' => None}
  243.     Access:           byte;           {User Access Level}
  244.     ForumNum2:         byte;          {Current Forum Number}
  245.     Logon_Time:       packed_5_chars;          {hh:mm Time of Logon}
  246.     Logon_Mins:       integer;        {Time the user logged on in mins}
  247.     Used_Today:       integer;        {Time the user used in
  248.                                         previous calls so far today}
  249.     time_limit:       integer;        {Maximum mins permitted on BBS}
  250.     KDownload_Maximum:integer;        {Maximum download bytes in K}
  251.     Upload_Credit:    integer;        {Minutes given for Uploading}
  252.     Minutes_Useable:  integer;        {Maximum time left for Caller}
  253.     Node_Num:         byte;           {Node number of this CallInfo File}
  254.     Path_Data:        String[28];     {Path to PowrBBS.DAT}
  255.     Forum_Num:        integer;
  256.     Whatsdoing2:      char;           {'P' - Live Program
  257.                                        'G' - Goodbye after transfer
  258.                                        'T' - Transfer}
  259.     Trans_Type:       char;           {set to U for upload or D for download}
  260.     Protocol:         byte;           {protocol # for transfers}
  261.     Started:          longint;        {transfer, 'P' - Live Program}
  262.   end;
  263.  
  264.    { structure of the forum setup }
  265.   pPowerBBS_Forum_Structure = ^PowerBBS_Forum_Structure;
  266.    PowerBBS_Forum_Structure = record
  267.       forum_name:              string[20];          {name of forum}
  268.       forum_subsysop:          packed_23_chars;     {sub-sysop if any}
  269.       is_anonymous:            boolean;             {true if anonymous
  270.                                                      messages may be entered}
  271.       all_messages_public:     boolean;             {true if no private mail}
  272.       forum_public:            boolean;             {true if open to all users}
  273.       forum_min_access_level:  integer;             {min access needed for
  274.                                                      forum no matter what}
  275.       forum_messagebase_path:  string[31];          {path/filename of message
  276.                                                      base file}
  277.       forum_newsfile:          string[31];          {path/filename to news}
  278.       forum_filelisting:       string[31];          {path/filename to listing
  279.                                                      of file areas available}
  280.       forum_filelisting_data:  string[31];          {path/filename to data
  281.                                                      file containing
  282.                                                      information as to where
  283.                                                      file lists are}
  284.       forum_download_dirs:     string[31];          {list of download
  285.                                                      directories, that one
  286.                                                      may access to download
  287.                                                      files from}
  288.       forum_upload_directory:  string[31];          {upload directory}
  289.       forum_upload_listing:    string[31];          {listing of uploaded
  290.                                                      files}
  291.    end;
  292.  
  293.  { MOST of the information located in the PowrBBS.Dat file }
  294.  { Note that MANY variables contained in this record may contain JUNK
  295.    or is part of something else used in PowerBBS.Dat.  Be careful
  296.    with what you use! }
  297. string30 = string[30];
  298. string55 = string[55];
  299. string90 = string[90];
  300. string100 = string[100];
  301. filename_type = string[50];
  302. pbbs_record = ^bbs_record;
  303.  bbs_record = record
  304.    BBS_Name:                        String30;
  305.    Sysop_FirstName:                 String[50];
  306.    Sysop_Last_Name:                 String[15];
  307.    end_default:                     string[4];
  308.    MAX_Obey_Ratio:                  Integer;
  309.    Min_Msgs_Ratio:                  Integer;
  310.    Min_Downfile_Ratio:              Integer;
  311.    Min_Downbyte_Ratio:              Integer;
  312.    Min_Msgs_Ratio2:                 Integer;
  313.    Min_Downfile_Ratio2:             Integer;
  314.    Min_Downbyte_Ratio2:             Integer;
  315.    New_User_Level:                  Integer;
  316.    Access_Level_Info:               String30;
  317.    Download_Restrict_File:          String30;
  318.    Upload_Access_File:              String30;
  319.    Users_Path:                      String30;
  320.    Users_Path2:                     String30;
  321.    Forum_Data_File:                 String30;
  322.    Protocolinfo_file:               String30;
  323.    Transfer_FileList_File:          String30;
  324.    Security_File:                   String30;
  325.    Transfer_Directory:              filename_type;
  326.    Activity_Log:                    String30;
  327.    Tranlog_Path:                    String30;
  328.    Opening:                         String30;
  329.    Hello:                           String30;
  330.    Birthday_File:                   String30;
  331.    Expired_File:                    String30;
  332.    Sysop_File:                      String30;
  333.    Forum_Menu:                      String30;
  334.    NewUser_Text:                    String30;
  335.    No_Sysop_Chat:                   String30;
  336.    enter_chat_file:                 String30;
  337.    exit_chat_File:                  String30;
  338.    Script_Text,QScript_File :        String30;
  339.    BadUsers_Names:                  String30;
  340.    Read_Help_File:                  String30;
  341.    Mail_Prefix:                     String[8];
  342.    Most_Msgs_Downloadable:          Integer;
  343.    OS_Shell_File:                   String30;
  344.    Begin_Download_File:             String30;
  345.    Begin_Upload_File:               String30;
  346.    Freefile_List:                   String30;
  347.    Start_Batch:                     String30;
  348.    Init_Modem_Command1,
  349.    Init_Modem_Command2:             String55;
  350.    Nodes_Users_Info:                String30;
  351.    chatstatfile:                    string30;
  352.    chattalkfile:                    string30;
  353.    onetoonefile:                    string30;
  354.    roominfofile:                    string30;
  355.    run_xmodem1k:                    string;
  356.    script_for_newusers:             string30;
  357.    answer_to_script:                string30;
  358.    credit_system:                   boolean;
  359.    more_credits:                    string30;
  360.    anony_info:                      string30;
  361.    runanonybbs:                     boolean;
  362.    lowbaudinfoscreen:               string30;
  363.    minimum_sec_to_abort_intro:      integer;
  364.    screen_enter_script_mode:        string30;
  365.    screen_end_script_mode:          string30;
  366.    Live_Programs_Menu:              string30;
  367.    Live_Programs_DataFile:          string30;
  368.    Chat_Help_File:                  string30;
  369.    Most_Lines_Msg:                  integer;
  370.    minimum_baud:                    longint;
  371.    Modem_Offhook:                   string30;
  372.    Read_Mail_Menu:                  string30;
  373.    aux_addr1:                       word;
  374.    cardtype:                        word;
  375.    cardseg:                         word;
  376. (* --------------------Event Information------------------------------*)
  377.    old_active_event:                Boolean;
  378.    old_time_of_event:               String[5];
  379.    old_Wait_For_Event:              Boolean;
  380. (* --------------------- Test Files ----------------------------------*)
  381.    TestFiles:                       Boolean;
  382.    TestBatch:                       String30;
  383.    TestFile1:                       String30;
  384.    TestFile2:                       String30;
  385. (*--------------------------------------------------------------------*)
  386.    Private_Uploads_Only:            Boolean;
  387.    Private_Upload_Directory:        String30;
  388.    Private_Upload_List:             String30;
  389.    Bulletins_Menu:                  String30;
  390.    Bulletins_Data:                  String30;
  391.    Baud_Rate_Open_At:               packed_5_chars;
  392.    LockBaud:                        boolean;
  393.    ClosedBBS:                       Boolean;
  394.    Port_Number,Port_Number2:        String[6];
  395.    Port_Number3:                    array[0..6] of char;
  396.    RingAnswer:                      boolean;
  397.    Max_Pause_Time:                  Integer;
  398.    UseRealName:                     Boolean;
  399.    AllowBadChars:                   Boolean;
  400.    Permit_Ansi_Messages:            Boolean;
  401.    News_New:                        Boolean;
  402.    Turn_Off_FreeCheck:              Boolean;
  403.    Minimum_Space_Uploads:           Integer;
  404.    Default_AnsiColor:               String[4];
  405.    Default_AnsiIntensity:           String[4];
  406.    Transfer_Figure_Time:            Real;
  407.    Pack_QWK_Files:                  String30;
  408.    View_ZIP_File:                   filename_type;
  409.    Test_ZIP_File:                   filename_type;
  410.    Bad_archive:                     filename_type;
  411.    IndexPath:                       string30;
  412.    IndexRamdiskPath:                string30;
  413.    StatsScreen:                     string30;
  414.    PowerInfoPath:                   string30;
  415.    SerialNumber:                    string;
  416.    AskBirthdate:                    boolean;
  417.    NonEchoChar:                     char;
  418.    DeleteDropUploads:               boolean;
  419.    FilesRatiosScreen:               string30;
  420.    LogFileName:                     String30;
  421.    TranString:                      String30;
  422.    NSPath:                          string30;
  423.    Monitor_File:                    string30;
  424.    PermitHandles:                   boolean;
  425.    FrontDoorBatch:                  string30;
  426.    QuitBatchFile:                   string30;
  427.    TheListPath:                     string30;
  428.    UpdateScreen:                    string30;
  429.    ClockScreen:                     string30;
  430.    QuestionClosed,AnswerClosed:     string30;
  431.    LangInfoFile:                    string30;
  432.    BadRatioFile:                    string30;
  433.    Source_MNU_POW_Dir:              string30;
  434.    irq_modem:                       string30;
  435.    modem_base1:                     word;
  436.    modem_base2:                     string30;
  437.    MultiLanguage:                   boolean;
  438.    UseDtr:                          boolean;
  439.    UsePowerMail:                    boolean;
  440.    UseFrontDoor:                    boolean;
  441.    Expiration_Warning:              string30;
  442.    PNET_Tagline:                    string[60];
  443.    MODEM_ATHO:                      string30;
  444.    date_format:                     byte;   { 0 = US MM-DD-YY; 1 = DD-MM-YY }
  445.    event_data_file:                 string30;
  446.    minimum_sec_new_files:           integer;
  447.    use_fax:                         boolean;
  448.    show_whose_online:               boolean;
  449.    show_dialog_on_startup:          boolean;
  450.    doorsys_path:                    string30;
  451.    track_gender:                    boolean;
  452.    Start_Up_Minimized:              boolean;
  453.    Internet_Connection:             boolean;
  454.    PowerBase_Code:                  string30;
  455.    SysopPage_DataFile:              string30;
  456.    TheWav:                          string100;
  457.    Bytes_upload_Credit:             Word;
  458.    Bytes_Dn_Up_Credit:              Word;
  459.    Credits_To_Uploader:             Word;
  460.    Caller_ID:                       Boolean;
  461.    Show_Stats:                      Boolean;
  462.    Minimum_Access_For_Internet:     Integer;
  463.    forum_network_file:              string30;
  464.    cbv_onoff,
  465.    blts_onoff:                      boolean;
  466.  
  467.    Caller_ID_Name:                  string100;
  468.    Caller_ID_Phone:                 string100;
  469.  
  470.    areacodefile: string100; {CALL1}
  471.    callbackfile: string100; {CALL2}
  472.    begincallback:string100; {CALL3}
  473.    badnumbers:   string100; {CALL4}
  474.    security_change: string100; {CALL5}
  475.    tempo: string;
  476.    Start_PowerBBS_Directory: string100;
  477.    lastdirl: string90;
  478.  
  479.    QWK_Blts,
  480.    QWK_NewFiles,
  481.    QWK_UpNewFiles,
  482.    QWK_ALLNewFiles,
  483.    QWK_GOODBYE,
  484.    QWK_NEWS,
  485.    QWK_WELCOME,
  486.    QWK_FileEnclos,
  487.    QWK_ALLFileEnclos,
  488.    QWK_PromptFileEnclos,
  489.    QWK_Logoff:            boolean;
  490.    QWK_MaxConf,
  491.    QWK_Max_QWK:           word;
  492.  
  493.    marked_mail:           string;
  494.    credit_name:           string30;
  495.    credit_bytes:          string30;
  496.  
  497.    temps1, temps2, temps3, temps4: string;
  498.    temps5:                         string;
  499.   end;
  500.  
  501. {-----------------------------------------------------------------------------}
  502. { Just conversions.  itoa and atoi in C.                                      }
  503. {-----------------------------------------------------------------------------}
  504. function int_to_asc (int: integer): string;
  505. { Converts an integer to string }
  506. var
  507.    tstr: string;
  508. begin
  509.    str(int, tstr);
  510.    int_to_asc := tstr;
  511. end;
  512.  
  513. function asc_to_int (InString:  String): integer;
  514. var
  515.    i:             integer;
  516.    value:         integer;
  517.    num:           String;
  518.  
  519. begin
  520.    num := '';
  521.    for i := 1 to length(InString) do
  522.       if (InString[i] >= '0') and (InString[i] <= '9') then
  523.          num := num + InString[i];
  524.  
  525.    if length(num) = 0 then
  526.       value := 0
  527.    else
  528.       val(num, value, i);
  529.  
  530.    asc_to_int := value;
  531. end;
  532.  
  533. function long_to_asc (int: longint): string;
  534. var
  535.    tstr: string;
  536. begin
  537.    str(int, tstr);
  538.    long_to_asc := tstr;
  539. end;
  540.  
  541.  
  542. {-----------------------------------------------------------------------------}
  543. procedure Send_Modem_Command(PBBSWIN: HWND;
  544.                              commands:string);
  545. { Sends commands to the modem and does NOT print commands on the local
  546.   screen. }
  547. var
  548.   PIn: array[0..254] of char;
  549.  
  550.  
  551. begin
  552.   StrPcopy(PIn, commands);
  553.   SendMessage(PBBSWIN, WM_COMMAND, 10012, longint(@PIn));
  554. end;
  555.  
  556.  
  557. {-----------------------------------------------------------------------------}
  558. function No_User_Online(PBBSWIN: HWND): boolean;
  559. {        **************
  560.   This is an IMPORTANT function.  If this boolean is ever TRUE it should
  561.   be the end of your DLL!  So this NEEDS to be included in all loops,
  562.   repeats, etc.  If TRUE, then exit the loop, etc..  Example:
  563.     Repeat
  564.     Until (..) or (No_User_Online);
  565. }
  566. var
  567.   pIn: Array[0..5] of char;
  568.  
  569. begin
  570.   SendMessage(PBBSWIN, WM_COMMAND, 10013, longint(@pIn));
  571.   No_User_Online := (pIn[0] = 'Y');
  572. end;
  573.  
  574. {-----------------------------------------------------------------------------}
  575. procedure Execute_Prog(PBBSWIN: HWND;
  576.                        commands:string);
  577. {
  578.   Closes the com port.  Executes commands, re-opens, and returns.
  579. }
  580.  
  581. var
  582.   PIn: array[0..254] of char;
  583.  
  584.  
  585. begin
  586.   StrPcopy(PIn, commands);
  587.   SendMessage(PBBSWIN, WM_COMMAND, 10014, longint(@PIn));
  588. end;
  589.  
  590. {-----------------------------------------------------------------------------}
  591. function Time_Left(PBBSWIN: HWND): integer;
  592. { Returns the time that the user has left }
  593. var
  594.   pIn: Array[0..254] of char;
  595.  
  596. begin
  597.   SendMessage(PBBSWIN, WM_COMMAND, 10016, longint(@pIn));
  598.   Time_Left := asc_to_int(StrPas(pIn));
  599. end;
  600.  
  601. {-----------------------------------------------------------------------------}
  602. Procedure Write_ActLog(PBBSWIN: HWND;
  603.                        ToWrite: String);
  604. { Writes TOWRITE to the activity Log }
  605. var
  606.   pIn: Array[0..254] of char;
  607.  
  608. begin
  609.   StrPcopy(pIn, ToWrite);
  610.   SendMessage(PBBSWIN, WM_COMMAND, 10019, longint(@pIn));
  611. end;
  612.  
  613. {-----------------------------------------------------------------------------}
  614. Procedure Convert_MACROS(PBBSWIN: HWND;
  615.                          Var ToConv:  String);
  616. { Converts all |MACROS| }
  617. var
  618.   pIn: Array[0..254] of char;
  619.  
  620. begin
  621.   StrPcopy(pIn, ToConv);
  622.   SendMessage(PBBSWIN, WM_COMMAND, 10020, longint(@pIn));
  623.   ToConv := StrPas(pIn);
  624. end;
  625.  
  626.  
  627. {-----------------------------------------------------------------------------}
  628. Procedure Change_Forum(PBBSWIN: HWND;
  629.                        InI:     Integer);
  630. { Change to Forum InI }
  631. var
  632.   pIn: Array[0..254] of char;
  633.  
  634. begin
  635.   StrPcopy(pIn, int_to_asc(InI));
  636.   SendMessage(PBBSWIN, WM_COMMAND, 10021, longint(@pIn));
  637. end;
  638.  
  639. {-----------------------------------------------------------------------------}
  640. Procedure Get_UserRec(PBBSWIN:  HWND;
  641.                       var user: pPowrUser_Record);
  642. {
  643.   Gives you the pointer to the actual location of the user record in memory.
  644.   By changing the actual information in this record you are able to change
  645.   the current user information!  (BE CAREFUL ON WHAT YOU DO!)
  646. }
  647. var
  648.   pIn: array[0..254] of char;
  649.    pc: pchar;
  650.    pl: array[0..3] of byte absolute pc;
  651.  
  652. begin
  653.   SendMessage(PBBSWIN, WM_COMMAND, 10030, longint(@pIn));
  654.   pl[0] := byte(pIn[0]);
  655.   pl[1] := byte(pIn[1]);
  656.   pl[2] := byte(pIn[2]);
  657.   pl[3] := byte(pIn[3]);
  658.   user := pPowrUser_Record(pc);
  659. end;
  660.  
  661. {-----------------------------------------------------------------------------}
  662. Procedure Get_ForumUserRec(PBBSWIN:  HWND;
  663.                            var fuser:pPowrUser_Record_Extension);
  664. {
  665.   Gives you the pointer to the actual location of the user forum record in
  666.   memory.  This record contains the user's last read pointers along with
  667.   the information containing which forums the user has access to.
  668. }
  669. var
  670.   pIn: array[0..254] of char;
  671.    pc: pchar;
  672.    pl: array[0..3] of byte absolute pc;
  673.  
  674. begin
  675.   SendMessage(PBBSWIN, WM_COMMAND, 10031, longint(@pIn));
  676.   pl[0] := byte(pIn[0]);
  677.   pl[1] := byte(pIn[1]);
  678.   pl[2] := byte(pIn[2]);
  679.   pl[3] := byte(pIn[3]);
  680.   fuser := pPowrUser_Record_Extension(pc);
  681. end;
  682.  
  683. {-----------------------------------------------------------------------------}
  684. Procedure Get_CallInfo(PBBSWIN:  HWND;
  685.                        var cuser:pPower_CallInfo_Rec);
  686. var
  687.   pIn: array[0..254] of char;
  688.    pc: pchar;
  689.    pl: array[0..3] of byte absolute pc;
  690.  
  691. begin
  692.   SendMessage(PBBSWIN, WM_COMMAND, 10032, longint(@pIn));
  693.   pl[0] := byte(pIn[0]);
  694.   pl[1] := byte(pIn[1]);
  695.   pl[2] := byte(pIn[2]);
  696.   pl[3] := byte(pIn[3]);
  697.   cuser := pPower_CallInfo_Rec(pc);
  698. end;
  699.  
  700.  
  701. {-----------------------------------------------------------------------------}
  702. Procedure Get_Current_ForumInfo(PBBSWIN:  HWND;
  703.                                 var forum:pPowerBBS_Forum_Structure);
  704. var
  705.   pIn: array[0..254] of char;
  706.    pc: pchar;
  707.    pl: array[0..3] of byte absolute pc;
  708.  
  709. begin
  710.   SendMessage(PBBSWIN, WM_COMMAND, 10033, longint(@pIn));
  711.   pl[0] := byte(pIn[0]);
  712.   pl[1] := byte(pIn[1]);
  713.   pl[2] := byte(pIn[2]);
  714.   pl[3] := byte(pIn[3]);
  715.   forum := pPowerBBS_Forum_Structure(pc);
  716. end;
  717.  
  718. {-----------------------------------------------------------------------------}
  719. Procedure Get_BBS_Record(PBBSWIN:  HWND;
  720.                         var bbs:   pBBS_Record);
  721. var
  722.   pIn: array[0..254] of char;
  723.    pc: pchar;
  724.    pl: array[0..3] of byte absolute pc;
  725.  
  726. begin
  727.   SendMessage(PBBSWIN, WM_COMMAND, 10034, longint(@pIn));
  728.   pl[0] := byte(pIn[0]);
  729.   pl[1] := byte(pIn[1]);
  730.   pl[2] := byte(pIn[2]);
  731.   pl[3] := byte(pIn[3]);
  732.   bbs := pBBS_Record(pc);
  733. end;
  734.  
  735. {-----------------------------------------------------------------------------}
  736. Function Search_UserName(PBBSWIN: HWND;
  737.                          TheName: String): Integer;
  738.  
  739. { Searches the UserDatabase for TheName.  If not found, returns 0.
  740.   If found, returns the record number that TheName is contained within. }
  741.  
  742. var
  743.   PIn: array[0..254] of char;
  744.  
  745. begin
  746.   strPcopy(PIn, TheName);
  747.   SendMessage(PBBSWIN, WM_COMMAND, 10040, longint(@pIn));
  748.   Search_UserName := asc_to_int(StrPas(pIn));
  749. end;
  750.  
  751. {-----------------------------------------------------------------------------}
  752. Procedure Load_UserRec(PBBSWIN:  HWND;
  753.                        var user: pPowrUser_Record;
  754.                        usernum:  integer);
  755. {
  756.   You must allocate memory for user before calling this routine!
  757.   UserNum signifies the actual user record number (ask returned
  758.   by Search_UserName)
  759. }
  760. var
  761.   pIn: array[0..254] of char;
  762.  
  763. begin
  764.   strPcopy(pIn, int_to_asc(usernum));
  765.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  766.   SendMessage(PBBSWIN, WM_COMMAND, 10042, longint(@(user^)));
  767. end;
  768.  
  769.  
  770. {-----------------------------------------------------------------------------}
  771. Procedure Save_UserRec(PBBSWIN:  HWND;
  772.                        var user: pPowrUser_Record;
  773.                        usernum:  integer);
  774. {
  775.   You must allocate memory for user before calling this routine!
  776.   UserNum signifies the actual user record number (ask returned
  777.   by Search_UserName)
  778. }
  779. var
  780.   pIn: array[0..254] of char;
  781.  
  782. begin
  783.   strPcopy(pIn, int_to_asc(usernum));
  784.   SendMessage(PBBSWIN, WM_COMMAND, 10041, longint(@pIn));
  785.   SendMessage(PBBSWIN, WM_COMMAND, 10043, longint(@(user^)));
  786. end;
  787.  
  788. {-----------------------------------------------------------------------------}
  789. Procedure Close_ComPort(PBBSWIN: HWND);
  790. { Closes the com port. }
  791.  
  792. begin
  793.   SendMessage(PBBSWIN, WM_COMMAND, 10044, 0);
  794. end;
  795.  
  796. {-----------------------------------------------------------------------------}
  797. Procedure Open_ComPort(PBBSWIN: HWND);
  798. { Opens up the Com Port. }
  799.  
  800. begin
  801.   SendMessage(PBBSWIN, WM_COMMAND, 10045, 0);
  802. end;
  803.  
  804. {-----------------------------------------------------------------------------}
  805. Procedure HangUp_Caller(PBBSWIN: HWND);
  806. { Attempts to hangup the caller.
  807.   (Note that after 4 tries it gives up, if the caller is still on-line) }
  808.  
  809. begin
  810.   SendMessage(PBBSWIN, WM_COMMAND, 10046, 0);
  811. end;
  812.  
  813. {-----------------------------------------------------------------------------}
  814. Function Number_Users_Online(PBBSWIN: HWND): integer;
  815. { Returns the number of users currently on-line. }
  816. { Only returns NON-ZERO nodes (So if a sysop has a BBS with a node 0 that
  817.   node is not counted. }
  818. var
  819.   PIn: array[0..30] of char;
  820.  
  821. begin
  822.   SendMessage(PBBSWIN, WM_COMMAND, 10047, longint(@PIn));
  823.   Number_Users_Online := asc_to_int(StrPas(PIn));
  824. end;
  825.  
  826. {-----------------------------------------------------------------------------}
  827. {
  828.   In order to send a message first call Init_Message with the header.
  829.   Then call Message_Line TOTAL_LINES Number of times.  Each with the
  830.   actual line of text for the message.
  831.   Then call Save_Message.
  832. }
  833. Procedure Init_Message(PBBSWIN:     HWND;
  834.                        From:        String90;  { Person Sending Message  }
  835.                        Tou:         String90;  { Message destination     }
  836.                        Topic:       String90;  { Subject of message      }
  837.                        Total_Lines: Integer;   { Total lines in message  }
  838.                        Forum_Num:   Integer;   { Forum number to save in }
  839.                        Private:     Boolean);  { TRUE = Private message  }
  840. var
  841.   Pin: array[0..254] of char;
  842.  
  843. begin
  844.   strPcopy(PIn, From+'~'+Tou+'~'+Topic+'~'+int_to_asc(Total_Lines)+'~'+
  845.            int_to_asc(forum_num));
  846.   if Private then
  847.     strcat(PIn, '~Y')
  848.   else
  849.     strcat(PIn, '~N');
  850.  
  851.   SendMessage(PBBSWIN, WM_COMMAND, 10050, longint(@PIn));
  852. end;
  853.  
  854. Procedure Message_Line(PBBSWIN:   HWND;
  855.                        TheLine:   String);
  856. var
  857.   PIn: array[0..254] of char;
  858.  
  859. begin
  860.   strPcopy(PIn, TheLine);
  861.   SendMessage(PBBSWIN, WM_COMMAND, 10051, longint(@PIn));
  862. end;
  863.  
  864. Procedure Save_Message(PBBSWIN: HWND);
  865.  
  866. begin
  867.   SendMessage(PBBSWIN, WM_COMMAND, 10052, 0);
  868. end;
  869.  
  870. {-----------------------------------------------------------------------------}
  871. Procedure Set_Node_Description(PBBSWIN: HWND;
  872.                                Doing:   String);
  873. { Sets the WHO IS ONLINE RECORD to what the user is doing.
  874.   Ex: Set_Node_Description(PBBSWIN, 'Using 3rd party door.'); }
  875. var
  876.   PIn: array[0..254] of char;
  877.  
  878. begin
  879.   StrPcopy(PIn, Doing);
  880.   SendMessage(PBBSWIN, WM_COMMAND, 10053, longint(@PIn));
  881. end;
  882.  
  883. function is_user_online(PBBSWIN:  HWND;
  884.                         thename:  string): boolean;
  885. { Checks if THENAME is currently on-line as a user.  If THENAME is on-line
  886.   returns TRUE }
  887. var
  888.   pIn: Array[0..254] of char;
  889.  
  890. begin
  891.   strPcopy(pIn, thename);
  892.   SendMessage(PBBSWIN, WM_COMMAND, 10054, longint(@PIn));
  893.   Is_User_Online := (pIn[0] = 'Y');
  894. end;
  895.  
  896. function TestD (hdlg: hwnd;
  897.                 message,wparam:word;
  898.                 lparam: longint):bool; export; forward;
  899.  
  900.  
  901.  
  902. (************** NEW GUI PROCEDURES FOLLOW *************************)
  903. (** For PowerAccess DLL Side **************************************)
  904.  
  905. var
  906.   HWNDs: array[0..100] of HWND;
  907.   PWin:  array[0..100] of HWND;
  908.  
  909. Procedure Get_ReceiveDir(PBBSWIN:    HWND;
  910.                          Var InputS: String);
  911. var
  912.   pIn: Array[0..254] of char;
  913.  
  914. begin
  915.   SendMessage(PBBSWIN, WM_COMMAND, 10083, longint(@pIn));
  916.   InputS := StrPas(pIn);
  917.   MessageBox(PBBSWIN, pIn, 'Receive Directory', mb_ok);
  918. end;
  919.  
  920.  
  921. procedure Send_Frame(PBBSWIN: HWND;
  922.                      command: longint;
  923.                      data:    string);
  924. var
  925.   ToSend: array[0..255] of Char;
  926.  
  927. begin
  928.   strPcopy(ToSend, long_to_asc(command)+';'+data);
  929.   SendMessage(PBBSWIN, wm_command, 10080, longint(@ToSend));
  930. end;
  931.  
  932. procedure PowerBBS_DLLGUI(PBBSWIN: hWnd;
  933.                           low_frame_number,
  934.                           high_frame_number:  plongint;
  935.                           DLL_Value:  integer);  Export;
  936. var
  937.   RecDir: String;
  938.  
  939. begin
  940.   low_frame_number^ := 500000;
  941.   high_frame_number^ := 500002;
  942.  
  943.   MessageBox(PBBSWIN,'Here in the PowrObject for PowerAccess!', 'PowerObject', mb_ok);
  944.  
  945.   PWin[DLL_Value] := PBBSWIN;
  946.   HWNDs[DLL_Value] := CreateDialog(hInstance, 'TEST', PBBSWin,
  947.                                    MakeProcInstance(@TestD, HInstance));
  948.  
  949.   Get_ReceiveDir(PBBSWIN, RecDir);
  950. end;
  951.  
  952. procedure PowerBBS_END(PbbsWin: HWND;
  953.                        DLL_Value: Integer); Export;
  954.  
  955. begin
  956.   DestroyWindow(HWNDs[DLL_Value]);
  957.   HWNDs[DLL_Value] := 0;
  958.   PWin[DLL_Value] := 0;
  959. end;
  960.  
  961. procedure PowerBBS_Frame(PBBSWIN: HWND;
  962.                          framenum: longint;
  963.                          framedata: pchar;
  964.                          DLL_Value: integer); Export;
  965.  
  966. begin
  967. end;
  968.  
  969. function TheWin(InWin: HWND): HWND;
  970. var
  971.   count: byte;
  972.  
  973. begin
  974.   TheWin := 0;
  975.   for count := 0 to 100 do
  976.     if HWNDs[count] = InWin then
  977.       TheWin := PWin[count];
  978. end;
  979.  
  980. function TestD (hdlg: hwnd;
  981.                 message,wparam:word;
  982.                 lparam: longint):bool;
  983.  
  984. begin
  985.  case message of
  986.   WM_INITDIALOG:
  987.    begin
  988.     showwindow(hdlg,sw_normal);
  989.     TestD := true;
  990.     exit;
  991.    end;
  992.   WM_COMMAND:
  993.    begin
  994.     if (wparam = 101) then
  995.     begin
  996.       Send_Frame(TheWin(hdlg), 500000, 'Button1');
  997.     end
  998.     else if (wparam = 102) then
  999.     begin
  1000.       Send_Frame(TheWin(hdlg), 500001, 'Button2');
  1001.     end
  1002.     else if (wparam = 103) then
  1003.     begin
  1004.       Send_Frame(TheWin(hdlg), 500002, 'Button3');
  1005.     end;
  1006.      TestD := true;
  1007.      exit;
  1008.    end;
  1009.  end;
  1010.  TestD := false;
  1011. end;
  1012.  
  1013. procedure PowerBBS_Info(version,
  1014.                         vendor:   pChar); Export;
  1015.  
  1016. begin
  1017.   StrPCopy(version, '1.00');
  1018.   StrPCopy(vendor, 'Test PowerObj Demo by PowerBBS');
  1019. end;
  1020.  
  1021.   exports
  1022.     PowerBBS_DLLGui index 10,
  1023.     PowerBBS_End    index 11,
  1024.     PowerBBS_Frame  index 12,
  1025.     PowerBBS_Info   index 13;
  1026.  
  1027. var
  1028.   junk: byte;
  1029.  
  1030. begin
  1031.   for junk := 0 to 100 do
  1032.     HWNDs[junk] := 0;
  1033. end.
  1034.