# IRC like interface

**URL:** <https://www.ruby-forum.com/t/irc-like-interface/56155>\
**Category:** Ruby\
**Created:** [January 4, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/irc-like-interface/56155 "2006-01-04T17:44:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![juergen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@juergen](https://www.ruby-forum.com/u/juergen)\
**Post date:** [January 4, 2006, 5:44pm UTC](https://www.ruby-forum.com/t/irc-like-interface/56155/1 "2006-01-04T17:44:10Z")

</div>

Hi,

I would like to try to write a text based Jabber client in Ruby, but  
being that I am rather new to it, I am running into problems already:  
I would like a text based user interface that looks somewhat like the  
classic IRC clients: An input line at the bottom of the screen with the  
rest of the screen being available for asyncronous output.  
If at all possible, I would also like to support the readline library  
for text input.  
I figured I would use curses to keep input and output separated,  
maintaining a separate cursor position for text that is typed in and for  
text that comes in over a socket, for example. I have no idea, though,  
how to get readline into the equation - and even without that, I am not  
sure whether my approach would be really ideal.  
Is there any easy to understand example code out there that would  
illustrate how to program a simple chat client with a text based user  
interface?

Any input would be much appreciated.  
Thanks,  
-juergen

---

<div class="post-metadata">

**Author:** ![juergen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@juergen](https://www.ruby-forum.com/u/juergen)\
**Post date:** [January 4, 2006, 10:25pm UTC](https://www.ruby-forum.com/t/irc-like-interface/56155/2 "2006-01-04T22:25:10Z")

</div>

On Thu, Jan 05, 2006 at 01:44:24AM +0900, Juergen Fiedler wrote:

> I figured I would use curses to keep input and output separated,  
> maintaining a separate cursor position for text that is typed in and for  
> text that comes in over a socket, for example. I have no idea, though,  
> how to get readline into the equation - and even without that, I am not  
> sure whether my approach would be really ideal.  
> Is there any easy to understand example code out there that would  
> illustrate how to program a simple chat client with a text based user  
> interface?

I don’t know of Ruby projects of that sort, off the top of my head, but  
there’s an open source multiprotocol IM client called centericq that  
might at least give you some vague ideas. Without double-checking, I  
seem to recall that it was written in Perl, though for all I know right  
now it could be C. I know it uses ncurses, at least.

–  
Chad P. [CCD CopyWrite | [http://ccd.apotheon.org](http://ccd.apotheon.org) ]

“A script is what you give the actors. A program  
is what you give the audience.” - Larry Wall

---

<div class="post-metadata">

**Author:** ![juergen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@juergen](https://www.ruby-forum.com/u/juergen)\
**Post date:** [January 4, 2006, 10:38pm UTC](https://www.ruby-forum.com/t/irc-like-interface/56155/3 "2006-01-04T22:38:58Z")

</div>

Chad P. wrote:  
[…]

> I don’t know of Ruby projects of that sort, off the top of my head, but  
> there’s an open source multiprotocol IM client called centericq that  
> might at least give you some vague ideas. Without double-checking, I  
> seem to recall that it was written in Perl, though for all I know right  
> now it could be C. I know it uses ncurses, at least.

Centericq is what I use when I don’t play with new Jabber clients. It is  
in fact C these days and an ‘ldd /usr/bin/centericq’ gives me a very  
long list ending with

> libkitchensink.so.11 =\> /usr/lib/libkitchensink.so.11 (0xb782a000)

yet it does not appear to use libreadline.

One program that uses both is freetalk, a pure Jabber client - but I  
find the C source (which relies heavily on callbacks) rather hard to  
follow.

Thanks for the input,  
–j

---

<div class="post-metadata">

**Author:** ![juergen](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/65b543/32.png) [@juergen](https://www.ruby-forum.com/u/juergen)\
**Post date:** [January 5, 2006, 3:33am UTC](https://www.ruby-forum.com/t/irc-like-interface/56155/4 "2006-01-05T03:33:48Z")

</div>

On Thu, Jan 05, 2006 at 06:39:26AM +0900, Juergen Fiedler wrote:

> long list ending with  
> I get a list of 27 different dependencies, myself.

> > libkitchensink.so.11 =\> /usr/lib/libkitchensink.so.11 (0xb782a000)

I’d be highly amused if I saw something called “libkitchensink” in  
there, though I’d be far less surprised to see it for a KDE application.

> yet it does not appear to use libreadline.

Now that I’m actually looking at it, you’re right.

Sorry I wasn’t more helpful. That was the closest comparison that came  
to mind.

–  
Chad P. [CCD CopyWrite | [http://ccd.apotheon.org](http://ccd.apotheon.org) ]

“Real ugliness is not harsh-looking syntax, but having to  
build programs out of the wrong concepts.” - Paul Graham
