ZIRC-MYS Installation Guide
===========================
Version 0.21

QUICK START
-----------

1. Copy files to Mystic directory:
   cp zirc.mps /mystic/themes/default/scripts/
   cp zirc.ans /mystic/themes/default/text/
   cp zirc-picker.ans /mystic/themes/default/text/   (optional)
   cp zirc_client.py /mystic/
   cp zirc_config.py /mystic/

2. chmod +x zirc_client.py

3. Create data directory:
   mkdir -p /mystic/data/zirc

4. Edit configuration:
   nano /mystic/zirc_config.py
   (Change bbsname, irc_host, irc_port, irc_channel, log_to_disk as needed)

5. Compile MPL script:
   cd /mystic
   ./mplc -T

6. Start the Python daemon:
   cd /mystic
   ./zirc_client.py

7. Add to Mystic menu:
   - Edit your menu (e.g., main.mnu)
   - Add command: Type=MPL, Data=zirc

8. Test from BBS!


DETAILED STEPS
--------------

STEP 1: COPY FILES
------------------
All files should go to your Mystic root directory (e.g., /mystic or C:\MYSTIC)

Required files:
  zirc.mps         -> /mystic/themes/default/scripts/
  zirc_client.py   -> /mystic/
  zirc_config.py   -> /mystic/
  zirc.ans         -> /mystic/themes/default/text/

Optional files:
  zirc-picker.ans  -> /mystic/themes/default/text/
  (ANSI art for the channel picker screen - built-in text fallback used if absent)

STEP 2: CREATE DIRECTORIES
---------------------------
The daemon needs the data/zirc directory to exist:

  mkdir -p /mystic/data/zirc
  chmod 755 /mystic/data/zirc

Verify temp directories exist (should be there already):
  ls -la /mystic/temp/1/
  ls -la /mystic/temp/2/
  (etc for each node)

STEP 3: CONFIGURE
-----------------
Edit /mystic/zirc_config.py:

  bbsname     = "Your BBS Name Here"
  irc_host    = "ftn.vk3heg.net"   # Change to your IRC server
  irc_port    = 8888                # Change to your IRC port
  irc_channel = "#BBS"             # Set to "" to show channel picker on startup
  log_to_disk = False              # Set True to log sessions to disk

Note: setting irc_channel = "" enables the channel picker. Users will see a list
of available channels and select one each time they start ZIRC.

STEP 4: COMPILE MPL SCRIPT
---------------------------
Mystic's MPL compiler creates the .mpx file:

  cd /mystic
  ./mplc -T

You should see:
  "Compiling zirc.mps"
  "Success!"

Verify zirc.mpx was created:
  ls -la /mystic/themes/default/scripts/zirc.mpx

STEP 5: START THE DAEMON
-------------------------
The Python daemon MUST be running for IRC to work.

Manual start (for testing):
  cd /mystic
  ./zirc_client.py
  (Press Ctrl+C to stop)

Background start:
  cd /mystic
  ./zirc_client.py &

Check if running:
  ps aux | grep zirc_client

STEP 6: AUTO-START ON BOOT
---------------------------
Add to /etc/rc.local (or create systemd service):

  #!/bin/bash
  cd /mystic && ./zirc_client.py

Or create /etc/systemd/system/zirc.service:

  [Unit]
  Description=ZIRC IRC Daemon for Mystic BBS
  After=network.target

  [Service]
  Type=simple
  User=mystic
  WorkingDirectory=/mystic
  ExecStart=/usr/bin/python3 /mystic/zirc_client.py
  Restart=always

  [Install]
  WantedBy=multi-user.target

Then:
  systemctl daemon-reload
  systemctl enable zirc
  systemctl start zirc

STEP 7: ADD TO MENU
--------------------
Using Mystic Configuration:

1. Run: ./mystic -cfg
2. Select: Menu Editor
3. Choose your menu (e.g., MAIN)
4. Add new command or edit existing:
   - Hot Key: X (or whatever you want)
   - Command: GX
   - Data: zirc

5. Save and exit

STEP 8: TEST
------------
1. Connect to your BBS
2. Press the hotkey (e.g., X)
3. If irc_channel is set: ZIRC loads with ANSI screen and joins directly
   If irc_channel is empty: channel picker appears - press 1-4 to select
4. Type a message and press Enter
5. It should appear in IRC!

If it doesn't work, check:
  - Is daemon running? (ps aux | grep zirc_client)
  - Does /mystic/data/zirc exist?
  - Can daemon write to temp directories?
  - Check daemon output for errors


TROUBLESHOOTING
---------------

Problem: "File not found" when running zirc
Solution: Make sure zirc.mpx exists (run mplc -T again)

Problem: Messages don't appear
Solution:
  - Check daemon is running
  - Check /mystic/data/zirc exists and is writable
  - Check /mystic/temp/N/ directories exist

Problem: Can't send messages
Solution:
  - Daemon must be running
  - Check file permissions on /mystic/data/zirc

Problem: Daemon crashes
Solution:
  - Run manually to see error: python3 zirc_client.py ftn.vk3heg.net 8888 '#BBS'
  - Check zirc_config.py exists
  - Verify network connection to IRC server

Problem: Multiple instances
Solution:
  - Kill all: pkill -f zirc_client.py
  - Start only one instance

Problem: Channel picker not appearing
Solution:
  - Set irc_channel = "" in zirc_config.py
  - Restart the daemon after changing the config


VERIFICATION CHECKLIST
----------------------
[ ] Files copied to /mystic/
[ ] zirc.ans in /mystic/themes/default/text/
[ ] /mystic/data/zirc directory created
[ ] zirc_config.py edited with your settings
[ ] MPL compiled (zirc.mpx exists)
[ ] Daemon started and running
[ ] Menu updated with ZIRC command
[ ] Tested from BBS

For support: vk3heg@gmail.com
Dragon's Lair BBS, Telnet: dragon.vk3heg.net Port: 6800
