aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.txt33
-rw-r--r--src/main.c137
-rw-r--r--src/numerics.h130
3 files changed, 163 insertions, 137 deletions
diff --git a/README.txt b/README.txt
new file mode 100644
index 0000000..3e27daf
--- /dev/null
+++ b/README.txt
@@ -0,0 +1,33 @@
+FujiNetChat - an IRC client for the Atari 8-bit with FujiNET.
+
+For now, this is very rudimentary. It can currently:
+
+- connect to an IRC server
+- complete the user/nick registrations process [*]
+- respond to server PINGs
+- join a channel (but only one!)
+- send/receive channel messages
+- receive private messages
+- if you use raw IRC protocol, you can send private messages:
+ /PRIVMSG <nick> :this is the message text.
+
+[*] almost: it doesn't recover gracefully from "nick already in use"
+ or "invalid nick", and if the server truncates the nick, it doesn't
+ notice.
+
+I have great plans for the future:
+
+- custom display. it will support multiple screens (like linux virtual
+ consoles), one per channel or query (PM conversation). of course due
+ to limited RAM, there won't be many windows supported. On a 48K
+ machine, probably 8 windows, each with a screens' worth of scrollback,
+ which means 16K of video memory...
+
+- an 'input box' at the bottom of the screen, so we don't have to keep
+ redrawing the user's input as data comes in. this will require a
+ custom display list.
+
+- a status bar that appears in place of the input box, until the user
+ starts typing (and reappears when he hits Return). it will show the
+ current window's channel or nick, and activity status for the other
+ windows.
diff --git a/src/main.c b/src/main.c
index 81f598e..6de8697 100644
--- a/src/main.c
+++ b/src/main.c
@@ -172,140 +172,3 @@ int main(void) {
OS.soundr = 3; // Restore SIO beeping sound
return 0;
}
-
-/* cruft from netcat: */
-/**
- * Main entrypoint
- */
-#if 0
-int main(int argc, char* argv[])
-{
- OS.soundr=0; // Turn off SIO beeping sound
- cursor(1); // Keep cursor on
-
- while (running==true)
- {
- if (get_url(argc, argv))
- nc();
- else
- running=false;
- }
-
- OS.soundr=3; // Restore SIO beeping sound
- return 0;
-}
-#endif
-
-#if 0
-/**
- * NetCat
- */
-void nc()
-{
- OS.lmargn=0; // Set left margin to 0
- OS.shflok=0; // turn off shift-lock.
-
- // Attempt open.
- print("\x9bOpening:\x9b");
- print(url);
- print("\x9b");
-
- err=nopen(url,trans);
-
- if (err != SUCCESS)
- {
- print("OPEN ERROR: ");
- print_error(err);
- return;
- }
-
- // Open successful, set up interrupt
- old_vprced = OS.vprced; // save the old interrupt vector
- old_enabled = PIA.pactl & 1; // keep track of old interrupt state
- PIA.pactl &= (~1); // Turn off interrupts before changing vector
- OS.vprced = ih; // Set PROCEED interrupt vector to our interrupt handler.
- PIA.pactl |= 1; // Indicate to PIA we are ready for PROCEED interrupt.
-
- // MAIN LOOP ///////////////////////////////////////////////////////////
-
- while (running==true)
- {
- // If key pressed, send it.
- while (kbhit())
- {
- tx_buf[txbuflen++]=cgetc();
- }
-
- if (txbuflen>0)
- {
- if (echo==true)
- for (i=0;i<txbuflen;i++)
- printc(&tx_buf[i]);
-
- err=nwrite(url,tx_buf,txbuflen); // Send character.
-
- if (err!=1)
- {
- print("WRITE ERROR: ");
- print_error(err);
- running=false;
- continue;
- }
- txbuflen=0;
- }
-
- if (trip==0) // is nothing waiting for us?
- continue;
-
- // Something waiting for us, get status and bytes waiting.
- err=nstatus(url);
-
- if (err==136)
- {
- print("DISCONNECTED.\x9b");
- running=false;
- continue;
- }
- else if (err!=1)
- {
- print("STATUS ERROR: ");
- print_error(err);
- running=false;
- continue;
- }
-
- // Get # of bytes waiting, no more than size of rx_buf
- bw=OS.dvstat[1]*256+OS.dvstat[0];
-
- if (bw>sizeof(rx_buf))
- bw=sizeof(rx_buf);
-
- if (bw>0)
- {
- err=nread(url,rx_buf,bw);
-
- if (err!=1)
- {
- print("READ ERROR: ");
- print_error(err);
- running=false;
- continue;
- }
-
- // Print the buffer to screen.
- printl(rx_buf,bw);
-
- trip=0;
- PIA.pactl |= 1; // Flag interrupt as serviced, ready for next one.
- } // if bw > 0
- } // while running
-
- // END MAIN LOOP ///////////////////////////////////////////////////////
-
- // Restore old PROCEED interrupt.
- PIA.pactl &= ~1; // disable interrupts
- OS.vprced=old_vprced;
- PIA.pactl |= old_enabled;
-
-}
-#endif
diff --git a/src/numerics.h b/src/numerics.h
new file mode 100644
index 0000000..65b6412
--- /dev/null
+++ b/src/numerics.h
@@ -0,0 +1,130 @@
+#define RPL_WELCOME 001
+#define RPL_YOURHOST 002
+#define RPL_CREATED 003
+#define RPL_MYINFO 004
+#define RPL_ISUPPORT 005
+#define RPL_BOUNCE 010
+#define RPL_STATSCOMMANDS 212
+#define RPL_ENDOFSTATS 219
+#define RPL_UMODEIS 221
+#define RPL_STATSUPTIME 242
+#define RPL_LUSERCLIENT 251
+#define RPL_LUSEROP 252
+#define RPL_LUSERUNKNOWN 253
+#define RPL_LUSERCHANNELS 254
+#define RPL_LUSERME 255
+#define RPL_ADMINME 256
+#define RPL_ADMINLOC1 257
+#define RPL_ADMINLOC2 258
+#define RPL_ADMINEMAIL 259
+#define RPL_TRYAGAIN 263
+#define RPL_LOCALUSERS 265
+#define RPL_GLOBALUSERS 266
+#define RPL_WHOISCERTFP 276
+#define RPL_NONE 300
+#define RPL_AWAY 301
+#define RPL_USERHOST 302
+#define RPL_UNAWAY 305
+#define RPL_NOWAWAY 306
+#define RPL_WHOISREGNICK 307
+#define RPL_WHOISUSER 311
+#define RPL_WHOISSERVER 312
+#define RPL_WHOISOPERATOR 313
+#define RPL_WHOWASUSER 314
+#define RPL_ENDOFWHO 315
+#define RPL_WHOISIDLE 317
+#define RPL_ENDOFWHOIS 318
+#define RPL_WHOISCHANNELS 319
+#define RPL_WHOISSPECIAL 320
+#define RPL_LISTSTART 321
+#define RPL_LIST 322
+#define RPL_LISTEND 323
+#define RPL_CHANNELMODEIS 324
+#define RPL_CREATIONTIME 329
+#define RPL_WHOISACCOUNT 330
+#define RPL_NOTOPIC 331
+#define RPL_TOPIC 332
+#define RPL_TOPICWHOTIME 333
+#define RPL_INVITELIST 336
+#define RPL_ENDOFINVITELIST 337
+#define RPL_WHOISACTUALLY 338
+#define RPL_INVITING 341
+#define RPL_INVEXLIST 346
+#define RPL_ENDOFINVEXLIST 347
+#define RPL_EXCEPTLIST 348
+#define RPL_ENDOFEXCEPTLIST 349
+#define RPL_VERSION 351
+#define RPL_WHOREPLY 352
+#define RPL_NAMREPLY 353
+#define RPL_LINKS 364
+#define RPL_ENDOFLINKS 365
+#define RPL_ENDOFNAMES 366
+#define RPL_BANLIST 367
+#define RPL_ENDOFBANLIST 368
+#define RPL_ENDOFWHOWAS 369
+#define RPL_INFO 371
+#define RPL_MOTD 372
+#define RPL_ENDOFINFO 374
+#define RPL_MOTDSTART 375
+#define RPL_ENDOFMOTD 376
+#define RPL_WHOISHOST 378
+#define RPL_WHOISMODES 379
+#define RPL_YOUREOPER 381
+#define RPL_REHASHING 382
+#define RPL_TIME 391
+#define ERR_UNKNOWNERROR 400
+#define ERR_NOSUCHNICK 401
+#define ERR_NOSUCHSERVER 402
+#define ERR_NOSUCHCHANNEL 403
+#define ERR_CANNOTSENDTOCHAN 404
+#define ERR_TOOMANYCHANNELS 405
+#define ERR_WASNOSUCHNICK 406
+#define ERR_NOORIGIN 409
+#define ERR_NORECIPIENT 411
+#define ERR_NOTEXTTOSEND 412
+#define ERR_INPUTTOOLONG 417
+#define ERR_UNKNOWNCOMMAND 421
+#define ERR_NOMOTD 422
+#define ERR_NONICKNAMEGIVEN 431
+#define ERR_ERRONEUSNICKNAME 432
+#define ERR_NICKNAMEINUSE 433
+#define ERR_NICKCOLLISION 436
+#define ERR_USERNOTINCHANNEL 441
+#define ERR_NOTONCHANNEL 442
+#define ERR_USERONCHANNEL 443
+#define ERR_NOTREGISTERED 451
+#define ERR_NEEDMOREPARAMS 461
+#define ERR_ALREADYREGISTERED 462
+#define ERR_PASSWDMISMATCH 464
+#define ERR_YOUREBANNEDCREEP 465
+#define ERR_CHANNELISFULL 471
+#define ERR_UNKNOWNMODE 472
+#define ERR_INVITEONLYCHAN 473
+#define ERR_BANNEDFROMCHAN 474
+#define ERR_BADCHANNELKEY 475
+#define ERR_BADCHANMASK 476
+#define ERR_NOPRIVILEGES 481
+#define ERR_CHANOPRIVSNEEDED 482
+#define ERR_CANTKILLSERVER 483
+#define ERR_NOOPERHOST 491
+#define ERR_UMODEUNKNOWNFLAG 501
+#define ERR_USERSDONTMATCH 502
+#define ERR_HELPNOTFOUND 524
+#define ERR_INVALIDKEY 525
+#define RPL_STARTTLS 670
+#define RPL_WHOISSECURE 671
+#define ERR_STARTTLS 691
+#define ERR_INVALIDMODEPARAM 696
+#define RPL_HELPSTART 704
+#define RPL_HELPTXT 705
+#define RPL_ENDOFHELP 706
+#define ERR_NOPRIVS 723
+#define RPL_LOGGEDIN 900
+#define RPL_LOGGEDOUT 901
+#define ERR_NICKLOCKED 902
+#define RPL_SASLSUCCESS 903
+#define ERR_SASLFAIL 904
+#define ERR_SASLTOOLONG 905
+#define ERR_SASLABORTED 906
+#define ERR_SASLALREADY 907
+#define RPL_SASLMECHS 908