Extended notification

You might want to have some more possibilities to get informed about incoming messages or anything else, at least I wanted to have them ;)

Some ideas could be:

  • different notification depending on
    • user
    • daytime
    • x-activity
    • message content
    • whatever...
  • sound
  • osd (using libxosd or knotify)
  • SMS
  • ...nearly anything you could imagine :)

As an example, I have my LICQ calling me on the phone and reading the message to me if someone sends me a message starting with a special keyword (no, I won't tell you :p). If you have real friends ;), they'll be using it only for important messages and this feature will prove really usefull (but of course there can also be a blacklist so not anybody will be able to annoy you).

Notification depending on Message Content

I modified the licq-source to add the first prerequisite, which means you can now pass the messagetext to your notification-command. Get the licq-source from LicqDownload (I tested it on version 1.3.2). Then copy/paste the following patch into your favorite editor and save it:

--- src/user.cpp.old	2006-01-03 15:28:33.981053816 +0100
+++ src/user.cpp	2005-12-06 08:38:59.000000000 +0100
@@ -2995,6 +2995,9 @@
           sprintf(szTemp, "%d", NewMessages());
           sz = szTemp;
           break;
+        case 'M':
+          sz = EventPeekLast()->Text();
+          break;
         case '%':
           strcpy(szTemp, "\%");
           sz = szTemp;

It can also be downloaded directly: attachment:notification-message-text.patch

extract the licq-source and go to the created licq-[version] directory and execute the following command to apply the patch:

patch -p0 < /path/to/the/saved/patchfile

now, you should be able to compile and install licq as described in the INSTALL file.

If you played around a bit with the OnEvent options, you know already that you can define a command which is executed with different arguments depending on what kind of event has happened. You can also define the arguments, using different variables which are replaced by licq. Possible variables are (from UTILITIES.HOWTO):

  • %e email
  • %i ip
  • %p port
  • %n full name
  • %f first name
  • %l last name
  • %a alias
  • %u uin
  • %w webpage
  • %h phone number
  • %c cellular phone
  • %s full status string
  • %S short status string with no spaces
  • %o last seen online
  • %O online since
  • %% a percent symbol

The patch you applied on the source added a new variable %M which is replaced by the last message received from the user. Apparently there are no problems with the patch, I tried it with messages containing newlines and german "umlaute". Probably there would be a problem if you used %M in a Utility and used this utility on a buddy who never sent you a message, but using the messagetext in a Utility wouldn't make too much sense in my opinion.

Anyway, if a new Message event is raised there must ALWAYS be a messagetext, so using %M here should always be OK ;)

OK, now if your patched licq is running (with the qt/kde-gui I assume), you can start writing a (really) simple notification script (example for KDE):

#!/bin/bash
dcop knotify Notify notify event "New Message from $1" "$2" "" "" 16 0

save it, make it executable, and enter it as your OnEvent?-command in licq. The parameters in the "Message:" line would be "%a %M" (without the quotes).

Now you can read your new messages in a KNotify-Popup! (and no, I don't know how to make it look nicer ;) )

OK this was a really simple example, but I hope you got the idea... I use only the Messages and Online Events, and put msg/online as the first argument, so my script can decide which kind of event was received and take different actions.

Of course, you can use any (scripting/programming) language you like for your notification-command, you just need to put conditions on arguments!

To realize some of the ideas mentioned above, just start with a good bash scripting tutorial (easy or more advanced) or anything alike. Just try it, it's not difficult!!


Some day, I'll be explainig this telephone thing more closely, but for now, I'm done ;) Have fun, keep trying, and add your ideas here!

Attachments