From: Manish M. <mm...@bb...> - 2004-12-30 01:58:29
|
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, Note: This query pertains to recent code changes (which I spotted in ayttm-commits archives). | Update of /cvsroot/ayttm/ayttm/modules/irc | Modified Files: | irc.c | - g_snprintf(buff, BUF_LEN, "PRIVMSG %s :%s\n", room->room_name, message); | + if(strncmp(message, "/me ", 4) == 0 && strlen(message) > 4) | + g_snprintf(buff, BUF_LEN, "PRIVMSG %s :\1ACTION %s\1\n", room->room_name, message+4); | + else | + g_snprintf(buff, BUF_LEN, "PRIVMSG %s :%s\n", room->room_name, message); A couple of questions regarding the "/me" change above: 1. It compares the lowercase "/me", which hints that it won't capture "/ME WAVES TO THE CHANNEL". Would it suit to incorporate g_ascii_strncasecmp() instead? 2. Would the above if-else strategy scale cleanly to map many more user commands in future? (For example, "/topic", "/kick", and many others common commands that IRC clients translate on-the-fly to PRIVMSG. For example: "/kick testuser Test Kick" would be something that most IRC Clients translate to "KICK #currentchannel testuser :Test Kick" (inserting #currentchannel based upon the window user typed it in). Thanks, Manish -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org iD8DBQFB02CD9364pdQFFqARAs2tAJ9U0+ikV7U17rGq6tEA42bkw6ubXACgyQKE XD6pGs1MmBKjVJzBCmf09Ko= =VtuC -----END PGP SIGNATURE----- |