The M-chat project is an Open Source client-server application for chatting in a Linux system that i started as a personal goal but now on 23-Apr-2007 i make it a public development project,under GPL.My intentions when starting this project were to create a simple to use,fiable,somewhat secure,non external dependant,powerfull talking point.The first goal is to achieve all that in an internal manner,meaning that only people with access to the box(user:passwd) will be able to connect to the server,because the main communication stream is achieved through IPC techniques.In a near feature if the project goes well it will be extended with support for sockets so that remote ip communication will be possible.For now when i think of M-chat i imagine this: All people part of a community and having access to the same box can communicate and share ideeas fast and easy through this application.For example many of the Computer Science Colleges share a linux server for their students,providing them with an account on that box for various reasons.So one could start the M-chat server,then all the users wanting to connect all they have to do is get the client and start talking,in this way all those students can have a common place for exchanging ideas,asking for help and much more.And all that of course without the Waiting e-mails,Time Consuming forums or Long messenger id's list.And ofcourse if you think of messengers which are the most common talking point in our days,its almost impossible to have all the mates in school in your list,or to create a common access point through messenger.And also it can be viewed in many other ways like admins,managing a server,they can meet in the same place they're working all day and talk with ease.Another advantage that i think of is that all the data is passed internal so that no external source can somehow get their hands on their commnication.If you connect remote to your account on that box(through ssh for ex) that data passes through networks and this rule doesn't apply but still if you use ssh you're somewhat secure.
The solution consists of two parts: a concurent server and a client.The ideea is simple:the server is a background process that listens for client requests.The main communication is achieved through an external pipe(FIFO) created by the server whose name is known by the client before sending any request and it's file permissions are set so that all possible clients intended have write access to it.Before trying to connect the client opens it'self a FIFO through which he will recieve data and responses from the server.Ofcourse the client FIFO must have file permissions such as the server process can write to it.A FIFO is a file in the root directory through which processes that aren't related to each other(fork) can communicate because it has a name.But in reality no data is passed through that file,all transactions are done in main memory(RAM) by the kernel.Now after achieving initial steps like checking main FIFO existence(server up/down),creating it's own FIFO,and other stuff like GUI init it sends a request register package.The server has been there in the background waiting for data on it's pipe(FIFO).When he receives the package makes preliminary tests(like another user with the same nick,wrong version) and records the user in his data structure(id,nick,usrname,FIFO) and sends the response to the client.If succeeded the client can now send data to the server(like messages),and the server will send them if needed to the other clients registered.All the packages sent and recieved in both ways have predefined formats,starting with an id,a action code(like send message,request login,send disconnect notice,etc),and finally with the data needed for that action(like the message to send).This is somewhat the most basic explanation of how this sistem works.Ofcourse in reality things are more complicated because of client-server issues and a alot of other technical and implementation details.For more details,questions,code explainations and stuff like that feel free to e-mail me.
Deploying the server and the client
To deploy the solution all you have to do is download the archives.Compile the server and the client.Run the server.Give the client for public access(ofcourse for those intended).And then run a client or two your self to test it.Now let's take it step by step.Lets assume you have downloaded the archives and unziped them.Chdir to the unziped server directory and type "./configure".After it finishes type "make".And now you have the compiled server in the "src" directory.Chdir to src and run the "./mchat_server -i" to view info and usage.After you read that for a first step all you have to do is "./mchat_server > mchat.log &" and now you have a server running into to the background and printing all the logs into mchat.log.Ofcourse you didn't have to redirect it to that file but i recomend it so you can still work undisturbed with your shell.Ofcourse you could have leave it to print to the screen(stdout) but then you would need to start a new console session.Now chdir to the unziped client directory.Note that the client uses the Ncurses library for the interface so you need to have it.Make the same steps like you did for the server "./configure" and "make".And now you have the compiled client in the src directory.Also run the "./mchat_client -i" to print client's info and usage if you want and now all you need to do is run the client with "./mchat_client".This is the most basic deployment scheme.Now further you can read that info (-i) and try the options step by step so you get the hang of it.If you're having problems with something e-mail me and we will make it work.For the client-server communication to work they must have access to the directory you created the server fifo in.By default it's in the /tmp/ directory because on many Linux distro's everybody has access to it.Ofcourse if you want to change that you can do it with the -s switch in server and client,but you have to be carefull with file permissions.And also be sure to announce the intended clients where the main server channel is so they can specify it with the -s option too.Also with multiple M-chat servers up with different fifo locations(names) on the same linux system can achieve the multiple channels like irc structure.For example you can start a server with "./mchat_server -s /tmp/mchat.devel" and another with "./mchat_server -s /tmp/mchat.admins".Now who wishes to connect to the developers chat room can type "./mchat_client -s /tmp/mchat.devel" and who wishes to connect to the admins channel can do with "./mchat_client -s /tmp/mchat.admins".For info about how to do things or bugs or errors e-mail me.Note that the sources available for download will allways be updated with the most recent stable version and some of these features explained here or some of the communication schemes presented above might change during the development,or newer features might be available,and the website content might not be up to date.So for up-to-date info run the programs with the -i switch or read the README files in the archives.
For now i am the only one working at these project but if some of you feel interested in this solution and also have the basic knowledge required(Linux OS,C,Linux/Unix programming and IPC,client-server basics,Ncurses,sockets for future development)all you have to do is contact me and youre part of it.For some of you might seem a little thing but i am thinking big about this and i am willing to make it a very powerfull application which in the future Linux distro's might include it in they're packages or alot of people will use it.
[Thu May 3 00:10:37 EEST 2007] M-chat v0.3 beta is online.I can say i almost rewriten most of the code from v0.2(about 60-70%).Some of the things i've managed to acomplish are: faster,cleaner and optimized code;same goes for the data structures used;generalized comunication scheme for easier future development;client identification through random generated id's for security and some pipe cleaning;version checking;options in server and client for server location;timed logs;timed messages;client commands like list users,clear screen and print time;autoconf and makefiles for both server and client;... and much more.To find out what i really managed to in this version just take a look in the code :).Also from now on to print the program usage you must provide the program with the -i switch.Take a look in that too.Note that this version(0.3) is still in beta because i didn't managed already to implement all the stuff i wanted so i bringed this version online so you could check it out and stay close because v0.3 final is going to be out in about a week from today.
here.I recommend doing this before trying to connect or if you encounter problems while connecting because fenrir will allways run the latest version for testing and your client might not be up to date.