Programs - LanChat


Download - dls/vb40032.zip (Win support)Download - dls/lanchat.vb4.zip (Win)Download - dls/chat.zip (DOS)Table of Contents

Overview

Design & Programming

Programming languages

Shared file access

Three and more users

Managing three sections of the screen

Old things are clumsy things

A more common layout

Mouse interaction

Username detection

DOS

Windows™

Log-file

Easy .ini file access

Individual rights assigned per user

Supervisor Access

Windows™ Rights Editor

Settings stored in individual files

Setup

Setup made more user friendly

Channels

Topic

Protection

Help

Enhanced commands

Who-Is?

Ping, /ping

Kick

Withhold

Bots

/me

/msg, /notice

Literal characters

External Programs

Send

Mail

DOS Shell

Conclusion

Project Presentation

References

Acknowledgements


Overview

The aim of the project was to supply a program so that two or more persons could write to each other instantaneously, therefore reducing the overhead and clutter of e-mail.

A user-friendly interface had to be present so that the even the newest user could use it.

This was a sort of filler project. In the beginning it was written to fill in for IRC (Internet Relay Chat), but it has progressed far from there... The next step is to integrate so that it works with the internet servers. Then you could talk to anyone in the whole world !!!

Design & Programming

Programming languages

The most important thing necessary to develop a program is the language that it is written in. Often the more powerful languages are harder to program in and require more syntax (they need to be told exactly what to do). The easier languages are less powerful and require less syntax, i.e. they are easier to program in.

Two major languages are available for both DOS and Windows™. They are Borland Pascal (real mode and protected mode - DOS and Windows™) and Microsoft Basic (Quick Basic - DOS and Visual Basic - Windows™). I regard Pascal as the more powerful and complex and Basic as the easier.

Since I had already been programming in Pascal for two years (I had been programming in Quick Basic for a few years prior to that), needed yet to write a major program in it and it was freely available at school, I decided that LanChat should be written in it.

The Windows™ version of LanChat was written in Visual Basic (VB). Just to create a single window in the Windows™ version of Pascal takes several lines and at least half an hour. To do the exact same thing in VB takes me a maximum of one minute! VB also includes custom controls, which makes listing of channels, selection of colours and use of help much easier.

In the end Pascal in DOS is more powerful than Quick Basic, and Visual Basic is much easier to use than Pascal in Windows™.

Shared file access

Several methods of communication between two computers were possible. The network has built-in message sending but with no way to tap into this service another method had to be found. The answer came in the form of a very simple network game. It used two files to communicate between the different computers to keep track of the game. This meant that the file would be accessed by more than one computer at a time, i.e. sharing.

After doing a bit of research into DOS’s file management, it was found that it was extremely easy for more than one computer to access the same file at the same time. Also that once shared it could be written to.

At first, when the computer received a message it would print it on the screen, erase it and go back to the beginning of the file, but problems were found with this method: It was too slow and it destroyed any new messages sent. During the time it took to erase and reset the file, the computer could have received new messages and it would never know about it!!!

It was decided that after reading a message the program would just wait after it. This would work fine because any new messages received would be processed correctly. To send a message the program just had to write to the end of the other computer’s file.

Three and more users

Next step was to allow more than two people to interact at one time. A directory was sent aside exclusively for LanChat. Each computer would have to create and manage it own file. At the beginning of each person’s file the program would store information about who they were and what their nickname was.

Every now-and-then the other computers would check all the files for the names and display them on the screen. If the user wanted to send something to another user, they would just select that name and type in the message. It would then be added to that computers file, which when checked, the message would appear on the other computer’s screen.

The very first name on the list, always ‘Everybody’, would be a special one. It is used to send to everyone and any action directed towards it actually goes to the current computer and therefore the user’s own name is not listed in the list.

Managing three sections of the screen

The screen would have to display three sets of data at one time: the names of all the people using LanChat at the moment, the most recent messages that you have received and somewhere to type in messages to send to other people.
To stop the cursor flashing around the screen when it drew all of this data I designed a crtmem unit. This unit is identical to the old CRT unit except that it doesn’t support input and therefore never uses a cursor. It uses the screen memory directly for its i/o.

Old things are clumsy things

It so happened that when I wrote LanChat, I put the names in the top-left corner of the screen, messages received in the bottom half, and a space to type new messages occupied the top-right.

The currently selected person was indicated by a arrow, ‘® ’, just before the person’s name. If the list of names grew greater than that was available, the names would scroll as the user navigated past the end of the visible list.

Both the message typing and display area would be scrolled normally when the bottom was reached to make more space available.

A more common layout

With messages that the user sent being visible in the message received window anyway, and the layout being very proprietary, it was decided that LanChat should get a face-lift. Its new look was based on the much more sensible layout that many IRC programs use.

The messages received now occupied about 70% of the screen, the names used a strip of the right hand side of the screen extending all the way, the message typing area was below the messages received and was only a few lines high and the interface was more familiar to those people who had had any previous experience with IRC.

This also allowed for more names to be displayed and one time, something that was beginning to become a problem with more and more people using LanChat. All original scrolling features were kept so that usability was kept at a maximum.

Mouse interaction

With the mouse being an essential accessory with any modern computer and a common programming interface for easy use, support for it was supplied. It could be used to select options on the button bars at the top and bottom of the screen or select names for faster communication, when many people were available to talk to. Again a separate mouse unit was programmed for ease-of-use.

Username detection

Along with a person’s nickname, LanChat also needed to find out what a person’s log-in name was. This was so that the LanChat supervisor could identify people’s real names if needed.

DOS

Unfortunately only one method of finding out the user’s name was possible in DOS: The program would have to use the NetWare program ‘whoami’. This program displays information about the currently logged-in user onto the screen which would have to be read off by LanChat.

This procedure would also have to be secure, because of all the cheats that would want to use another name. The program had to run a small DOS program that made sure that it ran the NetWare ‘whoami’ and not any substitute that might have been substituted for it.

Extensive effort was made to make sure that none could breach the security, of course when more features were added later on this security was weakened.

Windows™

Windows™ was another kettle of fish altogether. LanChat was only running on one type of DOS and therefore there was only one method of getting the user name. However when LanChat for Windows™ runs it can be running under: Windows 3.1™, Windows 3.11 for Workgroups™, or Windows 95™!

To add to that, under Windows 95™ two versions of LanChat can be run, a16-bit and 32-bit, and the program could also be run on a Novell or Microsoft network. That’s up to eight different environments!

When running under Windows 3.1™, LanChat tries to determine which network it is running on and addresses its log-in name request towards it.

Windows 3.11 for Workgroups™ has a global call to get the log-in name but has a multi-network driver, i.e. it can run Microsoft and NetWare at the same time. This means that until you select which network you want the log-in name for, it returns a blank. LanChat just tries to get the first valid log-in name and uses that.

Windows 95™ also has the global call and it works all the time. The 16-bit version uses the global call and a suitable log-in name is returned, even though it is not the log-in name that is validated with the server. (This makes it easy to ‘fake’ your log-in-name)

The 32-bit version was easy: there was only one way of doing it, although there was one parameter that was supposed to identify the server for which the log-in name should be returned, but no effect could be found in changing it so it was ignored. (Hopefully it gets the correct name)

Log-file

To find out when LanChat’s ‘rush hour’ was and also to see who used LanChat the most a log-file was set up. Every time LanChat successfully logged on a user the time, date, person’s log-in name, nickname and whether they were running DOS or Windows™ would be added to the file. The same would be added when they quit LanChat.

This enabled the administrator to see who used what names, at what time and which of the Windows™ versions of LanChat were being used.

Easy .ini file access

Windows™ already has functions for accessing .ini files, and all that was required was a nice interface to simplify the use of the built-in functions. DOS doesn’t have these functions and an .ini unit had to be made to make it easier to read from and write to .ini files. Unfortunately to write a setting to an .ini file the whole file had to be re-written, but that was solved and a back-up was even made when the file was altered.

Individual rights assigned per user

With the advent of the log-in name being detected and more advanced options being available, it would not be desirable for everyone to have access to them. Each user would start out with nothing extra and the supervisor would have to grant the user extra rights. These included: checking other people’s log-in names, kicking them off channels, withholding on a channel (also protection against these two), bypassing password protection, and seeing who is pinging you. It is also possible to ban a person from using LanChat, i.e. they couldn’t even get onto it!

These settings would be stored in an .ini file

Supervisor Access

LanChat supervisors were given supervisor access - this means that they can do anything and are protected against everything. A supervisor needed no other rights - they have all the other rights, and more. Supervisor rights also activates the rights editor in Windows™.

Windows™ Rights Editor

Due to the increasing number of features that had to be limited to certain people only, the .ini file was getting more cryptic by the minute and a ‘rights editor’ was designed, available only to people with supervisor access, it didn’t work unless the user could edit the .ini file (which is regulated by the system’s administrator), i.e. anyone able to right to the file might as well have full rights anyway.

It made the editing of rights a breeze and all options could be easily viewed and changed.

Settings stored in individual files

The default colours of LanChat were very neutral (well I though so), but other people wanted different colours. It was made that each person could have their own settings (Windows 95™ handles this very well). When they logged onto LanChat their own .ini file was accessed and their settings loaded from it. The whole setup module is contained in its own unit.

Setup

Setup allowed the individual user to edit their settings. It was very bland and it didn’t really make it totally useable. A cryptic table gave the colours that were available to the user and even then results were interesting. If the user entered a blank for a colour it would use the old setting, talk about confusing!

Setup made more user friendly

With the help of Gary van der Merwe, a new improved setup was implemented. It had buttons and fully used the mouse. The colour selection was greatly improved with an easy to select bar with examples. A small window showed the preview of all the different types of windows and controls. It also displayed an option to change your nickname without quitting and restarting LanChat. A user interface unit was written for easy usage of dialog boxes and their components.

Channels

To make it even more flexible, channels were created. They are groups of people that are talking about a common topic, e.g. two groups of people, one talking about fishing and the other about rugby can chat separately from one another. This is similar to rooms in a house, the conversation can’t be heard in other rooms, but everyone in that room can hear it. An extra screen had to be added to the program and luckily the procedures to list the names on channels could be modified for the list of channels. Again the first item in the list was different, this time if it was selected it would ask the user to type in the name of the channel that they would like to join. By using this new channels could also be created.

Topic

To indicate to the people joining LanChat what each channel was about, a channel needed a topic. This is shown beside the channel name on the channel list, and at the top once the user enters a channel. It can only be changed once the user is on the channel. It should reflect the general atmosphere in the channel.

Protection

If a group of people wanted to talk privately it was virtually impossible. So protection was added. This allowed people on the channel to set a password so that if people wanted to join the channel they had to know what it was. These options are separate, there can be a password, but the channel doesn’t necessarily have to be protected. And neither the protection state or the password can be changed without the old password.

Help

On-line help was added. The DOS version read its help from a plain text file and when invoked displayed it on the screen. It could be scrolled using the cursor keys, or the mouse. It only had one screen, i.e. there were no links. The Windows™ version of help however was created using ‘HelpMake’. This allowed LanChat to use the built-in Windows™ functions to display help, and the help file was in a widely accepted format.

Enhanced commands

Who-Is?

This is a restricted command that allowed system administrators to find out what the person’s detected log-in name is.

Ping, /ping

This command sends a message to the other computer, which on receiving it immediately sends a reply back to you. This can be used to ‘see’ whether the other computer is awake. The /ping version is typed into the message sending box, this is like IRC.

Kick

If a person really gets on your nerves, you can kick him/her. This normally throws the person off the channel. Although in LanChat five different extremes are available:

  • a warning,
  • kick them off the channel,
  • kick them off LanChat,
  • kick them off LanChat and log them off,
  • kick them off LanChat and reboot their computer.

Obviously the more serious the offence the more serious the kick.

Withhold

This is a feature exclusive to LanChat, IRC just doesn’t have support for it. This stops a person from leaving the channel until they are un-held. Channel ‘hoppers’ can be slowed down by using this feature.

Bots

Bots, short for robot, are just extra nicknames that look like normal people. They accept any messages but because they don’t have any program behind them, they can’t respond. There real names are the log-in name of the person who created them prefixed by: ‘bot: ’, indicating that it is a robot.

/me

This is used to show an action. Any text typed after it will be sent to everybody, prefixed with your nickname, e.g. if your nick name is ‘Fred’ and you type ‘/me drinks his coffee’, gets sent to everyone as: ‘Fred drinks his coffee’.

/msg, /notice

These two commands are identical. They can be used instead of selecting the person’s name and then typing a message to them. The second word of the line is treated as the nick name of the person and everything after that is sent as the message.

Literal characters

Originally all the special command were toggled by the Alt key, e.g. Alt-P for ping. With the foresight of menus, the alt-keys couldn’t be used for this purpose anymore. The logical alternative was to use the Ctrl key, e.g. Ctrl-T for topic. The problem with this was people had been using ctrl to make symbols like: ¥ ¿ ± § ¨ © ª ¤ ¶, i.e. Ctrl-C makes a heart. Ctrl-\ was altered so that any key pressed after it would be inserted directly, without any action being taken on it and all the other keys could now respond to the correct actions.

External Programs

Send

Supplied with the network is a program that allows short messages to be sent to other people’s computers. When they get there they will interrupt any program, display the message at the top of the screen, and wait for the user to clear it. This doesn’t require the user to be in LanChat to receive messages, as is with normal LanChat messages.

Mail

One of the other well know programs available on the network is mail, this option allows the user to run mail without quitting and restarting LanChat, which could be an inconvenience. When running mail this way the user’s name still exists on the channel, messages will still be received and displayed to the user when they return.

DOS Shell

This option is very similar to mail, but instead runs a DOS prompt. This allows the user to do anything they want to but still receive messages on LanChat.

Conclusion

The results so far have been substantial. LanChat was widely accepted at Saints and people became addicted to it. I discovered many new programming methods and was extemely happy that people were acctually using my program.

LanChat is not a project that has finished, yet. It is constantly being modified and updated to be more user friendly. Phase 2 would allow connections to external internet servers. When that comes, LanChat will really be well used.

Project Presentation

The main method of publishing this project is the Internet. Along with the write-up I have included some screen shots of parts of the program. This write-up is part of my web pages dedicated to some of the programs I have written. The pages are hosted by GeoCities, who also host my main home page as well. These pages are produced using MS FrontPage, a wonderfull WYSIWYG html editing package.

References

Both the Pascal and the Visual Basic help files were used extensively for the command syntaxes. Past computer science papers helped with shortcuts and using dynamic variables (known as linked lists). Norton Guides, Assembler (an on-line help system written by Peter Norton Computing) helped with multi-user file access. Windows™ SDK (a software development kit) helped with the more advanced Windows™ API function syntax.

Acknowledgements

Thanks to ‘Borland International, Inc.’ for writing ‘Borland Pascal’, it has just the right balance of power and ease-of-use. Thanks to ‘Microsoft Corporation’ for writing ‘Visual Basic’, with which I wrote LanChat for Windows™, and ‘Microsoft Word’, with which I started to write this and for ‘FrontPage’ so that I could produce my web. Thanks to ‘Peter Norton Computing, Inc.’ - now ‘Symantec Corporation’ - for writing ‘The Assembly Language database’ for use with ‘The Norton Guides’, so that I could understand assembler and DOS functions so much better. Thanks to Gary van der Merwe for the help with the user interface, my sister for her creative ideas and to everyone else that deserves it! - which includes everyone at Saints.