"/me" and other (possible) commands in ayttm/modules/irc/irc.c

Manish Malik <[email protected]>
Newsgroups gmane.network.instant-messaging.ayttm.user
Message-ID <[email protected]>
-----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-----


-------------------------------------------------------
The SF.Net email is sponsored by: Beat the post-holiday blues
Get a FREE limited edition SourceForge.net t-shirt from ThinkGeek.
It's fun and FREE -- well, almost....http://www.thinkgeek.com/sfshirt
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.