adding stdin support to nullclient / a simple libpurple app

David Byron dbyron at dbyron.com
Tue May 29 14:59:12 EDT 2007


Sorry for the newbie questions...I'm trying to add sending support to
nullclient as a small beginning to a proper IM client.  I saw the thread
here:

http://pidgin.im/pipermail/devel/2007-May/000761.html

about doing some basic things but it seems to have ended after dealing with
build issues and not moved on to actual libpurple operations.

I've dug around and found the input_add field in PurpleEventLoopUiOps which
is populated in nullclient but I'm not sure when it gets called.  Can I just
call purple_input_add(STDIN_FILENO,PURPLE_INPUT_READ,<my function to
actually read data and send it to another IM account>,NULL)?

I should probably just go off and try it, but finch seems to do something
different which I'd like to know more about.  finch doesn't call
purple_input_add, but does provide gnt_input_add in case someone else does.
gnt_input_add calls g_io_channel_unix_new and g_io_add_watch_full.

finch does call g_io_channel_unix_new(STDIN_FILENO) and g_io_add_watch_full
in setup_io in gntmain.c.  setup_io gets called via the ui_init function
passed to purple_core_set_ui_ops.

So, some questions:

1. setup_io seems similar to gnt_input_add.  Can someone please explain the
difference?

2. Which method should I use for adding support for sending messages via
stdin?  Is there some other way that's recommended?

3. Any pointers on how to write the "my function to actually read data and
send it to another IM account"?  I bet libpurple has what I want here.  I
see PurpleConversationUiOps.write_conv and finch_write_conv but I have a
feeling this is in the other direction (receiving a message from another IM
account).  I could certainly be wrong.

Thanks much for your help.  Sorry for filling up the mailing list with all
my questions these days.

-DB





More information about the Devel mailing list