gatlin/pii

libpurple-based chat client in the style of ii

1

stars

11

commits

C

primary language

Aug 25, 2026

updated

README

pii

© 2023- Gatlin Johnson gatlin@niltag.net

ThIs is INCOMPLETE SOFTWARE. I have used it as a Bonjour chat client as a proof of concept; I will humbly and gratefully accept any merge requests.

Immediate deficiencies:

  • Make sure this works with protocols besides bonjour
  • More specifically, create a convenient way to simply refer to existing purple accounts (probably easy, one thing at a time you know?)
  • track down cause of occasional hanging file descriptor glib somehow loses track of. Turned out to be the CPU-pegging bug below, not a separate issue.

Recently fixed:

  • A FIFO reports end-of-file once its last writer closes it (e.g. a plain echo foo >in), and that condition never goes away on its own. The old in-watching code didn't handle this, so glib kept polling the same dead condition forever — 100% CPU, permanently, from the very first message anyone ever sent. in is now reopened whenever this happens, so the client keeps listening instead of spinning.

Multi-protocol messenger which exposes conversations as files: an input pipe in and an output log out. Interactions with the client itself are also exposed in this manner; commands are documented below.

This client is inspired by ii. Protocol support is provided by libpurple.

synopsis

Review the config file.

$ cat pii.conf
[pii]
workspace=/home/username/pii
libpurpledata=/home/username/.local/etc/piiaccount
bonjour=true

Start pii with the explicit config file.

$ ls /home/username | grep pii
$ pii -c pii.conf &
$ ls -la /home/username | grep pii
drwx------   3 username username    4096 Jan  2 18:02 pii
$ ls -la /home/username/pii/
total 32
drwx------   3 username username    4096 Jan  2 18:02 .
drwx------ 111 username username   20480 Jan  2 18:09 ..
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username     502 Jan  2 18:04 out

Ask the server for a list of buddies.

$ echo "ls" >/home/username/pii/in
$ cat /home/username/pii/out
1672704720 Begin buddies
1672704720 other@remote
1672704720 End buddies

Start a conversation with a buddy, creating a new directory for it.

$ echo "msg other@remote" >/home/username/pii/in
$ ls -la /home/username/pii/
total 36
drwx------   3 username username    4096 Jan  2 18:02 .
drwx------ 111 username username   20480 Jan  2 18:09 ..
drwx------   2 username username    4096 Jan  2 18:13 other@remote
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username     649 Jan  2 18:04 out
$ ls -la /home/username/pii/other@remote
total 12
drwx------   3 username username    4096 Jan  2 18:13 .
drwx------ 111 username username    4096 Jan  2 18:13 ..
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username      13 Jan  2 18:04 out

Send a message to other@remote.

$ echo "hey" >/home/username/pii/other@remote/in

Log the ongoing conversation with other@remote.

$ tail -f /home/username/pii/other@remote/out
1672708134 pii hey
1672708139 Other Person suh

commands

The client itself operates as a very simple chat bot which accepts a narrow set of commands.

This list is the bare minimum to be interesting and more will be supported with any luck.

ls

Lists all buddies associated with the account.

add <buddy-name>

Add a buddy to the main buddy list.

rm <buddy-name>

Removes the named buddy from the buddy list.

msg <buddy-name>

Start a conversation with the named buddy.

build and install

This has a dependency on libpurple and glib2.0. On Debian-based platforms this simply means installing the following packages:

  • libpurple-dev
  • libglib2.0-dev

If this does not work for you or if you have advice for other systems please do share.

See also

lchat, a basic console client for this type of chat client.

xii, a basic X11-based client for this type of chat client.

jj, an XMPP client which works similar to ii and pii.

Contributors

gatlin

11 commits

gatlin/pii

libpurple-based chat client in the style of ii

1

stars

11

commits

C

primary language

Aug 25, 2026

updated

README

pii

© 2023- Gatlin Johnson gatlin@niltag.net

ThIs is INCOMPLETE SOFTWARE. I have used it as a Bonjour chat client as a proof of concept; I will humbly and gratefully accept any merge requests.

Immediate deficiencies:

  • Make sure this works with protocols besides bonjour
  • More specifically, create a convenient way to simply refer to existing purple accounts (probably easy, one thing at a time you know?)
  • track down cause of occasional hanging file descriptor glib somehow loses track of. Turned out to be the CPU-pegging bug below, not a separate issue.

Recently fixed:

  • A FIFO reports end-of-file once its last writer closes it (e.g. a plain echo foo >in), and that condition never goes away on its own. The old in-watching code didn't handle this, so glib kept polling the same dead condition forever — 100% CPU, permanently, from the very first message anyone ever sent. in is now reopened whenever this happens, so the client keeps listening instead of spinning.

Multi-protocol messenger which exposes conversations as files: an input pipe in and an output log out. Interactions with the client itself are also exposed in this manner; commands are documented below.

This client is inspired by ii. Protocol support is provided by libpurple.

synopsis

Review the config file.

$ cat pii.conf
[pii]
workspace=/home/username/pii
libpurpledata=/home/username/.local/etc/piiaccount
bonjour=true

Start pii with the explicit config file.

$ ls /home/username | grep pii
$ pii -c pii.conf &
$ ls -la /home/username | grep pii
drwx------   3 username username    4096 Jan  2 18:02 pii
$ ls -la /home/username/pii/
total 32
drwx------   3 username username    4096 Jan  2 18:02 .
drwx------ 111 username username   20480 Jan  2 18:09 ..
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username     502 Jan  2 18:04 out

Ask the server for a list of buddies.

$ echo "ls" >/home/username/pii/in
$ cat /home/username/pii/out
1672704720 Begin buddies
1672704720 other@remote
1672704720 End buddies

Start a conversation with a buddy, creating a new directory for it.

$ echo "msg other@remote" >/home/username/pii/in
$ ls -la /home/username/pii/
total 36
drwx------   3 username username    4096 Jan  2 18:02 .
drwx------ 111 username username   20480 Jan  2 18:09 ..
drwx------   2 username username    4096 Jan  2 18:13 other@remote
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username     649 Jan  2 18:04 out
$ ls -la /home/username/pii/other@remote
total 12
drwx------   3 username username    4096 Jan  2 18:13 .
drwx------ 111 username username    4096 Jan  2 18:13 ..
prwx------   1 username username       0 Jan  2 18:04 in
-rw-rw-r--   1 username username      13 Jan  2 18:04 out

Send a message to other@remote.

$ echo "hey" >/home/username/pii/other@remote/in

Log the ongoing conversation with other@remote.

$ tail -f /home/username/pii/other@remote/out
1672708134 pii hey
1672708139 Other Person suh

commands

The client itself operates as a very simple chat bot which accepts a narrow set of commands.

This list is the bare minimum to be interesting and more will be supported with any luck.

ls

Lists all buddies associated with the account.

add <buddy-name>

Add a buddy to the main buddy list.

rm <buddy-name>

Removes the named buddy from the buddy list.

msg <buddy-name>

Start a conversation with the named buddy.

build and install

This has a dependency on libpurple and glib2.0. On Debian-based platforms this simply means installing the following packages:

  • libpurple-dev
  • libglib2.0-dev

If this does not work for you or if you have advice for other systems please do share.

See also

lchat, a basic console client for this type of chat client.

xii, a basic X11-based client for this type of chat client.

jj, an XMPP client which works similar to ii and pii.

Contributors

gatlin

11 commits

Languages

C

93.0%

Makefile

7.0%