added cmd_peek and added example arguments for language strings with placeholders
authorpk910 <philipp@zoelle1.de>
Sun, 18 Sep 2011 19:47:57 +0000 (21:47 +0200)
committerpk910 <philipp@zoelle1.de>
Sun, 18 Sep 2011 19:47:57 +0000 (21:47 +0200)
bot_NeonServ.c
cmd_neonserv_peek.c [new file with mode: 0644]
modcmd.c
tools.c

index 6c2c71636ecd52f27224ae9efb13ea0c54b66dfe..c28198e3122ac4da284379a4b09b9e2fe672949c 100644 (file)
 #define BOTID 1
 
 static const struct default_language_entry msgtab[] = {
-    {"NS_USER_UNKNOWN", "User with nick \002%s\002 does not exist."},
-    {"NS_AUTH_UNKNOWN", "Account \002%s\002 has not been registered."},
-    {"NS_USER_NEED_AUTH", "%s must first authenticate with \002AuthServ\002."},
+    {"NS_USER_UNKNOWN", "User with nick \002%s\002 does not exist."}, /* {ARGS: "TestUser"} */
+    {"NS_AUTH_UNKNOWN", "Account \002%s\002 has not been registered."}, /* {ARGS: "TestAuth"} */
+    {"NS_USER_NEED_AUTH", "%s must first authenticate with \002AuthServ\002."}, /* {ARGS: "TestUser"} */
     {"NS_YOU_NEED_AUTH", "You must first authenticate with \002AuthServ\002."},
-    {"NS_INVALID_ACCESS", "\002%d\002 is an invalid access level."},
-    {"NS_ADDUSER_ALREADY_ADDED", "%s is already on the \002%s\002 user list (with access %d)."},
-    {"NS_ADDUSER_DONE", "Added %s to the %s user list with access %d."},
-    {"NS_NOT_ON_USERLIST", "%s lacks access to \002%s\002."},
-    {"NS_NOT_ON_USERLIST_YOU", "You lack access to \002%s\002."},
-    {"NS_NOT_ON_CHANNEL", "%s isn't currently in \002%s\002."},
-    {"NS_NOT_ON_CHANNEL_YOU", "You aren't currently in \002%s\002."},
-    {"NS_DELUSER_DONE", "Deleted %s (with access %d) from the %s user list."},
+    {"NS_INVALID_ACCESS", "\002%d\002 is an invalid access level."}, /* {ARGS: 1337} */
+    {"NS_ADDUSER_ALREADY_ADDED", "%s is already on the \002%s\002 user list (with access %d)."}, /* {ARGS: "TestUser", "#TestChan", 123} */
+    {"NS_ADDUSER_DONE", "Added %s to the %s user list with access %d."}, /* {ARGS: "TestUser", "#TestChan", 123} */
+    {"NS_NOT_ON_USERLIST", "%s lacks access to \002%s\002."}, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_NOT_ON_USERLIST_YOU", "You lack access to \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_NOT_ON_CHANNEL", "%s isn't currently in \002%s\002."}, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_NOT_ON_CHANNEL_YOU", "You aren't currently in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_DELUSER_DONE", "Deleted %s (with access %d) from the %s user list."}, /* {ARGS: "TestUser", 123, "#TestChan"} */
     {"NS_ACCESS_OUTRANKED", "You cannot give users access greater than or equal to your own."},
-    {"NS_USER_OUTRANKED", "\002%s\002 outranks you (command has no effect)."},
+    {"NS_USER_OUTRANKED", "\002%s\002 outranks you (command has no effect)."}, /* {ARGS: "TestUser"} */
     {"NS_ACCESS_DENIED", "Access denied."},
     {"NS_NO_ACCESS", "You lack sufficient access to use this command."},
-    {"NS_USER_PROTECTED", "Sorry, \002%s\002 is protected."},
-    {"NS_SERVICE_IMMUNE", "\002%s\002 may not be kicked, killed, banned, or deopped."},
+    {"NS_USER_PROTECTED", "Sorry, \002%s\002 is protected."}, /* {ARGS: "TestUser"} */
+    {"NS_SERVICE_IMMUNE", "\002%s\002 may not be kicked, killed, banned, or deopped."}, /* {ARGS: "TestUser"} */
     {"NS_TABLE_NONE", "   None"},
-    {"NS_TABLE_COUNT", "Found \002%d\002 matches."},
-    {"NS_BAN_ALREADY_ADDED", "\002%s\002 is already banned in %s."},
-    {"NS_INVALID_ACCESS_RANGE", "Invalid access range; minimum (%d) must be lower than maximum (%d)."},
-    {"NS_CLVL_DONE", "%s now has access \002%d\002 in %s."},
-    {"NS_A_LACKS_ACCESS_BUT_GOD_NICK", "%s lacks access to %s but has \002security override\002 enabled."},
-    {"NS_A_LACKS_ACCESS_BUT_GOD_AUTH", "%s (%s) lacks access to %s but has \002security override\002 enabled."},
-    {"NS_A_ACCESS_NICK", "%s has access \002%d\002 in %s."},
-    {"NS_A_ACCESS_AUTH", "%s (%s) has access \002%d\002 in %s."},
-    {"NS_A_ACCESS_NICK_GOD", "%s has access \002%d\002 in %s and has \002security override\002 enabled."},
-    {"NS_A_ACCESS_AUTH_GOD", "%s (%s) has access \002%d\002 in %s and has \002security override\002 enabled."},
-    {"NS_A_SUSPENDED", "\002%s\002's access to %s has been suspended."},
-    {"NS_A_IS_IRCOP", "%s is an \002IRC operator\002."},
-    {"NS_USERS_HEADER", "%s users from level %d to %d:"},
-    {"NS_USERS_HEADER_MATCH", "%s users from level %d to %d matching %s:"},
+    {"NS_TABLE_COUNT", "Found \002%d\002 matches."}, /* {ARGS: 5} */
+    {"NS_BAN_ALREADY_ADDED", "\002%s\002 is already banned in %s."}, /* {ARGS: "*!*@moeeep.*", "#TestChan"} */
+    {"NS_INVALID_ACCESS_RANGE", "Invalid access range; minimum (%d) must be lower than maximum (%d)."}, /* {ARGS: 450, 400} */
+    {"NS_CLVL_DONE", "%s now has access \002%d\002 in %s."}, /* {ARGS: "TestUser", 123, "#TestChan"} */
+    {"NS_A_LACKS_ACCESS_BUT_GOD_NICK", "%s lacks access to %s but has \002security override\002 enabled."}, /* {ARGS: "TestAuth", "#TestChan"} */
+    {"NS_A_LACKS_ACCESS_BUT_GOD_AUTH", "%s (%s) lacks access to %s but has \002security override\002 enabled."}, /* {ARGS: "TestAuth", "TestUser", "#TestChan"} */
+    {"NS_A_ACCESS_NICK", "%s has access \002%d\002 in %s."}, /* {ARGS: "TestAuth", 123, "#TestChan"} */
+    {"NS_A_ACCESS_AUTH", "%s (%s) has access \002%d\002 in %s."}, /* {ARGS: "TestAuth", "TestUser", 123, "#TestChan"} */
+    {"NS_A_ACCESS_NICK_GOD", "%s has access \002%d\002 in %s and has \002security override\002 enabled."}, /* {ARGS: "TestAuth", 123, "#TestChan"} */
+    {"NS_A_ACCESS_AUTH_GOD", "%s (%s) has access \002%d\002 in %s and has \002security override\002 enabled."}, /* {ARGS: "TestAuth", "TestUser", 123, "#TestChan"} */
+    {"NS_A_SUSPENDED", "\002%s\002's access to %s has been suspended."}, /* {ARGS: "TestAuth", "#TestChan"} */
+    {"NS_A_IS_IRCOP", "%s is an \002IRC operator\002."}, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_USERS_HEADER", "%s users from level %d to %d:"}, /* {ARGS: "#TestChan", 1, 500} */
+    {"NS_USERS_HEADER_MATCH", "%s users from level %d to %d matching %s:"}, /* {ARGS: "#TestChan", 1, 500, "Test*"} */
     {"NS_USERS_HEADER_ACCESS", "Access"},
     {"NS_USERS_HEADER_ACCOUNT", "Accout"},
     {"NS_USERS_HEADER_SEEN", "Last Seen"},
     {"NS_USERS_HEADER_STATE", "Status"},
-    {"NS_USERS_COUNT", "There are \002%d\002 users in %s."},
-    {"NS_USERS_COUNT_1", "There is \002%d\002 user in %s."},
-    {"NS_USERS_COUNT_MATCH", "There are \002%d\002 users in %s. (\002%d\002 matching your request)"},
-    {"NS_USERS_COUNT_MATCH_1", "There is \002%d\002 user in %s. (\002%d\002 matching your request)"},
+    {"NS_USERS_COUNT", "There are \002%d\002 users in %s."}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_USERS_COUNT_1", "There is \002%d\002 user in %s."}, /* {ARGS: 1, "#TestChan"} */
+    {"NS_USERS_COUNT_MATCH", "There are \002%d\002 users in %s. (\002%d\002 matching your request)"}, /* {ARGS: 20, "#TestChan", 5} */
+    {"NS_USERS_COUNT_MATCH_1", "There is \002%d\002 user in %s. (\002%d\002 matching your request)"}, /* {ARGS: 1, "#TestChan", 1} */
     {"NS_USERS_SEEN_HERE", "Here"},
     {"NS_USERS_SEEN_INVISIBLE", "Here (invisible)"},
     {"NS_USERS_SEEN_NEVER", "Never"},
     {"NS_USERS_STATE_SUSPENDED", "Suspended"},
     {"NS_USERS_STATE_NORMAL", "Normal"},
-    {"NS_SUSPEND_ALREADY", "\002%s\002 is already suspended." },
-    {"NS_SUSPEND_NOT", "\002%s\002 is not suspended." },
-    {"NS_SUSPEND_DONE", "\002%s\002's access to \002%s\002 has been suspended." },
-    {"NS_SUSPEND_RESTORED", "\002%s\002's access to \002%s\002 has been restored." },
-    {"NS_DELME_KEY", "To really remove yourself, you must use 'deleteme %s'."},
-    {"NS_DELME_DONE", "Your \002%d\002 access has been deleted from \002%s\002."},
-    {"NS_MYACCESS_HEADER", "Showing all channel entries for account \002%s\002:"},
-    {"NS_MYACCESS_HEADER_MATCH", "Showing all channel entries for account \002%s\002 matching %s:"},
+    {"NS_SUSPEND_ALREADY", "\002%s\002 is already suspended." }, /* {ARGS: "TestUser"} */
+    {"NS_SUSPEND_NOT", "\002%s\002 is not suspended." }, /* {ARGS: "TestUser"} */
+    {"NS_SUSPEND_DONE", "\002%s\002's access to \002%s\002 has been suspended." }, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_SUSPEND_RESTORED", "\002%s\002's access to \002%s\002 has been restored." }, /* {ARGS: "TestUser", "#TestChan"} */
+    {"NS_DELME_KEY", "To really remove yourself, you must use 'deleteme %s'."}, /* {ARGS: "abc123"} */
+    {"NS_DELME_DONE", "Your \002%d\002 access has been deleted from \002%s\002."}, /* {ARGS: 123, "#TestChan"} */
+    {"NS_MYACCESS_HEADER", "Showing all channel entries for account \002%s\002:"}, /* {ARGS: "TestAuth"} */
+    {"NS_MYACCESS_HEADER_MATCH", "Showing all channel entries for account \002%s\002 matching %s:"}, /* {ARGS: "TestAuth", "#Test*"} */
     {"NS_MYACCESS_HEADER_NAME", "Name"},
     {"NS_MYACCESS_HEADER_ACCESS", "Access"},
     {"NS_MYACCESS_HEADER_FLAGS", "Flags"},
     {"NS_MYACCESS_HEADER_INFO", "Info"},
-    {"NS_MYACCESS_COUNT", "%s has access in \002%d\002 channel(s) and is owner of \002%d\002 channel(s)."},
-    {"NS_MYACCESS_COUNT_MATCH", "%s has access in \002%d\002 channel(s) and is owner of \002%d\002 channel(s) (\002%d\002 channels matching your request)."},
-    {"NS_UP_ALREADY_OP", "You are already opped in \002%s\002."},
-    {"NS_UP_ALREADY_VOICE", "You are already voiced in \002%s\002."},
-    {"NS_DOWN_ALREADY", "You are not opped or voiced in \002%s\002."},
-    {"NS_MDELUSER_DONE", "Deleted \002%d\002 account(s) matching \002%s\002 with access from \002%d\002 to \002%d\002 from the %s user list."},
+    {"NS_MYACCESS_COUNT", "%s has access in \002%d\002 channel(s) and is owner of \002%d\002 channel(s)."}, /* {ARGS: "TestUser", 15, 5} */
+    {"NS_MYACCESS_COUNT_MATCH", "%s has access in \002%d\002 channel(s) and is owner of \002%d\002 channel(s) (\002%d\002 channels matching your request)."}, /* {ARGS: "TestUser", 15, 5, 7} */
+    {"NS_UP_ALREADY_OP", "You are already opped in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_UP_ALREADY_VOICE", "You are already voiced in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_DOWN_ALREADY", "You are not opped or voiced in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_MDELUSER_DONE", "Deleted \002%d\002 account(s) matching \002%s\002 with access from \002%d\002 to \002%d\002 from the %s user list."}, /* {ARGS: 10, "Test*", 1, 200, "#TestChan"} */
     {"NS_TRIM_DURATION_TOO_SHORT", "You must include a minimum inactivity duration of at least %d seconds to trim."},
-    {"NS_TRIM_DONE", "Trimmed \002%d users\002 with access from %d to %d from the %s user list who were inactive for at least %s."},
+    {"NS_TRIM_DONE", "Trimmed \002%d users\002 with access from %d to %d from the %s user list who were inactive for at least %s."}, /* {ARGS: 10, 1, 100, "#TestChan", "10 days"} */
     {"NS_GIVEOWNER_SELF", "You cannot give ownership to your own account."},
-    {"NS_GIVEOWNER_TIMEOUT", "You must wait %s before you can give ownership of \002%s\002 to someone else."},
-    {"NS_GIVEOWNER_CONFIRM", "To really give ownership to \002%1$s\002, you must use 'giveownership *%1$s %2$s'."},
-    {"NS_GIVEOWNER_DONE", "Ownership of \002%s\002 has been transferred to account \002%s\002."},
-    {"NS_OP_FAIL", "\002%s\002 could not op some of the nicks you provided."},
-    {"NS_OP_DONE", "Opped users in \002%s\002."},
-    {"NS_VOICE_FAIL", "\002%s\002 could not voice some of the nicks you provided."},
-    {"NS_VOICE_DONE", "Voiced users in \002%s\002."},
-    {"NS_DEOP_FAIL", "\002%s\002 could not deop some of the nicks you provided."},
-    {"NS_DEOP_DONE", "Deopped users in \002%s\002."},
-    {"NS_DEVOICE_FAIL", "\002%s\002 could not devoice some of the nicks you provided."},
-    {"NS_DEVOICE_DONE", "Devoiced users in \002%s\002."},
+    {"NS_GIVEOWNER_TIMEOUT", "You must wait %s before you can give ownership of \002%s\002 to someone else."}, /* {ARGS: "5 hours", "#TestChan"} */
+    {"NS_GIVEOWNER_CONFIRM", "To really give ownership to \002%1$s\002, you must use 'giveownership *%1$s %2$s'."}, /* {ARGS: "TestUser", "abc123"} */
+    {"NS_GIVEOWNER_DONE", "Ownership of \002%s\002 has been transferred to account \002%s\002."}, /* {ARGS: "#TestChan", "TestUser"} */
+    {"NS_OP_FAIL", "\002%s\002 could not op some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_OP_DONE", "Opped users in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_VOICE_FAIL", "\002%s\002 could not voice some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_VOICE_DONE", "Voiced users in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_DEOP_FAIL", "\002%s\002 could not deop some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_DEOP_DONE", "Deopped users in \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_DEVOICE_FAIL", "\002%s\002 could not devoice some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_DEVOICE_DONE", "Devoiced users in \002%s\002."}, /* {ARGS: "#TestChan"} */
     {"NS_OPALL_SECURITY", "\002WARNING\002: Opping all users on a channel is very insecure! If you still want do op all users on %s use: '\002opall FORCE\002 [nick mask]'"},
-    {"NS_OPALL_DONE", "Opped \002%d\002 users in %s."},
-    {"NS_VOICEALL_DONE", "Voiced \002%d\002 users in %s."},
-    {"NS_DEOPALL_DONE", "Deopped \002%d\002 users in %s."},
-    {"NS_DEVOICEALL_DONE", "Devoiced \002%d\002 users in %s."},
-    {"NS_KICK_DONE", "Kicked \002%d\002 users from %s"},
-    {"NS_KICK_FAIL", "\002%s\002 could not kick some of the nicks you provided."},
-    {"NS_KICKBAN_DONE", "KickBanned \002%d\002 users from %s"},
-    {"NS_KICKBAN_FAIL", "\002%s\002 could not kickban some of the nicks you provided."},
-    {"NS_BAN_DONE", "\002%d\002 masks added to the %s ban list. (matching %d users)"},
-    {"NS_BAN_FAIL", "\002%s\002 could not kickban some of the nicks you provided."},
-    {"NS_LAME_MASK", "\002%s\002 is a little too general. Try making it more specific."},
-    {"NS_SET_HEADER", "Channel Settings for %s:"},
+    {"NS_OPALL_DONE", "Opped \002%d\002 users in %s."}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_VOICEALL_DONE", "Voiced \002%d\002 users in %s."}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_DEOPALL_DONE", "Deopped \002%d\002 users in %s."}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_DEVOICEALL_DONE", "Devoiced \002%d\002 users in %s."}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_KICK_DONE", "Kicked \002%d\002 users from %s"}, /* {ARGS: 20, "#TestChan"} */
+    {"NS_KICK_FAIL", "\002%s\002 could not kick some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_KICKBAN_DONE", "KickBanned \002%d\002 users from %s"}, /* {ARGS: 10, "#TestChan"} */
+    {"NS_KICKBAN_FAIL", "\002%s\002 could not kickban some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_BAN_DONE", "\002%d\002 masks added to the %s ban list. (matching %d users)"}, /* {ARGS: 5, "#TestChan", 15} */
+    {"NS_BAN_FAIL", "\002%s\002 could not kickban some of the nicks you provided."}, /* {ARGS: "NeonServ"} */
+    {"NS_LAME_MASK", "\002%s\002 is a little too general. Try making it more specific."}, /* {ARGS: "*!*@*"} */
+    {"NS_SET_HEADER", "Channel Settings for %s:"}, /* {ARGS: "#TestChan"} */
     {"NS_SET_ON", "on"},
     {"NS_SET_OFF", "off"},
-    {"NS_SET_UNKNOWN_SETTING", "\002%s\002 is an unknown channel setting."},
+    {"NS_SET_UNKNOWN_SETTING", "\002%s\002 is an unknown channel setting."}, /* {ARGS: "TestSetting"} */
     {"NS_SET_CANNOT_SET", "That setting is above your current level, so you cannot change it."},
     {"NS_SET_BADLEVEL", "You cannot change any setting to above your level."},
-    {"NS_SET_INVALID_OPTION", "\002%s\002 is not a valid choice.  Choose one:"},
-    {"NS_SET_INVALID_BOOLEAN", "\002%s\002 is an invalid binary value."},
-    {"NS_SET_DEFAULTS_OWNER", "You must have access 500 in %s to reset it to the default options."},
-    {"NS_SET_DEFAULTS_CODE", "To reset %s's settings to the defaults, you must use 'set defaults %s'."},
-    {"NS_SET_DEFAULTS_DONE", "All settings for %s have been reset to default values."},
-    {"NS_SET_TRIGGER_OWNER", "You must have access 500 in %s to change the channel trigger."},
-    {"NS_WIPEINFO_DONE", "Removed \002%s\002's infoline in \002%s\002."},
+    {"NS_SET_INVALID_OPTION", "\002%s\002 is not a valid choice.  Choose one:"}, /* {ARGS: 5} */
+    {"NS_SET_INVALID_BOOLEAN", "\002%s\002 is an invalid binary value."}, /* {ARGS: 2} */
+    {"NS_SET_DEFAULTS_OWNER", "You must have access 500 in %s to reset it to the default options."}, /* {ARGS: "#TestChan"} */
+    {"NS_SET_DEFAULTS_CODE", "To reset %s's settings to the defaults, you must use 'set defaults %s'."}, /* {ARGS: "#TestChan", "abc123"} */
+    {"NS_SET_DEFAULTS_DONE", "All settings for %s have been reset to default values."}, /* {ARGS: "#TestChan"} */
+    {"NS_SET_TRIGGER_OWNER", "You must have access 500 in %s to change the channel trigger."}, /* {ARGS: "#TestChan"} */
+    {"NS_WIPEINFO_DONE", "Removed \002%s\002's infoline in \002%s\002."}, /* {ARGS: "TestUser", "#TestChan"} */
     {"NS_TRACE_HEADER", "The following users were found:"},
-    {"NS_ADDBAN_DONE", "\002%s\002 permantly added to the %s ban list. (matching %d users)"},
+    {"NS_ADDBAN_DONE", "\002%s\002 permantly added to the %s ban list. (matching %d users)"}, /* {ARGS: "*!*@Test.*", "#TestChan", 4} */
     {"NS_BANS_HEADER_MASK", "Mask"},
     {"NS_BANS_HEADER_SETBY", "Set By"},
     {"NS_BANS_HEADER_TRIGGERED", "Triggered"},
     {"NS_BANS_HEADER_EXPIRES", "Expires"},
     {"NS_BANS_HEADER_REASON", "Reason"},
-    {"NS_DELBAN_BANNED_BY", "%s is banned by %s."},
-    {"NS_DELBAN_FAIL", "Sorry, no ban found for \002%s\002."},
-    {"NS_DELBAN_DONE", "Removed \002%s\002 from the %s ban list."},
+    {"NS_DELBAN_BANNED_BY", "%s is banned by %s."}, /* {ARGS: "*!*@bla*", "*!*@b*"} */
+    {"NS_DELBAN_FAIL", "Sorry, no ban found for \002%s\002."}, /* {ARGS: "*!*@bla*"} */
+    {"NS_DELBAN_DONE", "Removed \002%s\002 from the %s ban list."}, /* {ARGS: "*!*@bla.*", "#TestChan"} */
     {"NS_NETINFO_HEADER", "\002Network information\002"},
     {"NS_NETINFO_BOTS", "Bots:"},
     {"NS_NETINFO_UPTIME", "Uptime:"},
@@ -148,36 +148,41 @@ static const struct default_language_entry msgtab[] = {
     {"NS_NETINFO_OTHER", "  Other:"},
     {"NS_NETINFO_VERSION", "Version:"},
     {"NS_NETINFO_CODE", "Code:"},
-    {"NS_NETINFO_CODE_VALUE", "%s lines c code (view it at http://git.pk910.de/?p=NeonServV5.git;a=summary)"},
+    {"NS_NETINFO_CODE_VALUE", "%s lines c code (view it at http://git.pk910.de/?p=NeonServV5.git;a=summary)"}, /* {ARGS: 20} */
     {"NS_NETINFO_COMPILER", "Compiler:"},
-    {"NS_NETINFO_COMPILER_VALUE", "%s  (%s)"},
-    {"NS_EXTTOPIC_INVALID_ID", "ADVANCEDTOPIC is enabled and \002%s\002 is an invalid TOPIC ID. Valid topic id's are: 1-9"},
-    {"NS_EXTTOPIC_TOPICID", "Topic %d: %s"},
-    {"NS_TOPIC_DONE", "Topic is now '%s'."},
-    {"NS_CHANSERVSYNC_UNSUPPORTED", "\0034WARNING\003: the user list style of %s is not known. %s can try to synchronize the userlist, but there is no guarantee that it is successful!"},
-    {"NS_CHANSERVSYNC_KEY", "If you really want to synchronize the %s userlist with %s use: chanservsync %s %s"},
+    {"NS_NETINFO_COMPILER_VALUE", "%s  (%s)"}, /* {ARGS: "GCC 4.4.5", "Sun Sep 18 2011 at 05:21:33 CEST"} */
+    {"NS_EXTTOPIC_INVALID_ID", "ADVANCEDTOPIC is enabled and \002%s\002 is an invalid TOPIC ID. Valid topic id's are: 1-9"}, /* {ARGS: 10} */
+    {"NS_EXTTOPIC_TOPICID", "Topic %d: %s"}, /* {ARGS: 5, "topic"} */
+    {"NS_TOPIC_DONE", "Topic is now '%s'."}, /* {ARGS: "i like you :D"} */
+    {"NS_CHANSERVSYNC_UNSUPPORTED", "\0034WARNING\003: the user list style of %s is not known. %s can try to synchronize the userlist, but there is no guarantee that it is successful!"}, /* {ARGS: "CowBot"} */
+    {"NS_CHANSERVSYNC_KEY", "If you really want to synchronize the %s userlist with %s use: chanservsync %s %s"}, /* {ARGS: "#TestChan", "CowBot", "CowBot", "abc123"} */
     {"NS_CHANSERVSYNC_INUSE", "\002chanservsync\002 is already in use by someone else. Please try again in a few seconds..."},
-    {"NS_CHANSERVSYNC_SYNCHRONIZING", "Synchronizing userlist in %s with \002%s\002..."},
-    {"NS_CHANSERVSYNC_SYNCHRONIZED", "Synchronized user \002%s\002: access \002%d\002"},
-    {"NS_REGISTER_ALREADY", "%s is already registered with %s."},
-    {"NS_INVALID_CHANNEL_NAME", "%s is not a valid channel name."},
+    {"NS_CHANSERVSYNC_SYNCHRONIZING", "Synchronizing userlist in %s with \002%s\002..."}, /* {ARGS: "#TestChan", "CowBot"} */
+    {"NS_CHANSERVSYNC_SYNCHRONIZED", "Synchronized user \002%s\002: access \002%d\002"}, /* {ARGS: "TestUser", 123} */
+    {"NS_REGISTER_ALREADY", "%s is already registered with %s."}, /* {ARGS: "#TestChan", "NeonServ"} */
+    {"NS_INVALID_CHANNEL_NAME", "%s is not a valid channel name."}, /* {ARGS: "#invalid"} */
     {"NS_REGISTER_FULL", "the bot can not join more channels."},
-    {"NS_REGISTER_DISCONNECTED", "%s has been registered with a Bot, that is currently NOT connected. The Bot should join the channel, when it reconnects to the IRC-Network."},
-    {"NS_REGISTER_DONE", "\002%s\002 is now registered to \002%s\002."},
-    {"NS_UNREGISTER_NOT_REGISTERED", "\002%s\002 is not registered with %s."},
-    {"NS_UNREGISTER_DONE", "\002%s\002 unregistered."},
-    {"NS_RECOVER_DONE", "\002%s\002 has been recovered."},
-    {"NS_RESYNC_DONE", "Synchronized users in \002%s\002 with the userlist."},
-    {"NS_TIMEBAN_DURATION_TOO_SHORT", "You must specify a ban duration of at least %d seconds."},
-    {"NS_TIMEBAN_DONE", "Banned \002%s\002 from %s for %s. (matching %d users)"},
-    {"NS_MODE_INVALID", "\002%c\002 is an invalid set of channel modes."},
-    {"NS_MODE_LOCKED", "Modes conflicting with \002%s\002 are not allowed in %s."},
-    {"NS_MODE_DONE", "Channel modes are now \002%s\002."},
-    {"NS_MODE_ENFOPS", "You may not op or deop users on \002%s\002."},
-    {"NS_MODE_ENFVOICE", "You may not voice or devoice users on \002%s\002."},
-    {"NS_MODE_CANBAN", "You may not ban or unban users on \002%s\002."},
+    {"NS_REGISTER_DISCONNECTED", "%s has been registered with a Bot, that is currently NOT connected. The Bot should join the channel, when it reconnects to the IRC-Network."}, /* {ARGS: "#TestChan"} */
+    {"NS_REGISTER_DONE", "\002%s\002 is now registered to \002%s\002."}, /* {ARGS: "#TestChan", "TestUser"} */
+    {"NS_UNREGISTER_NOT_REGISTERED", "\002%s\002 is not registered with %s."}, /* {ARGS: "#TestChan", "NeonServ"} */
+    {"NS_UNREGISTER_DONE", "\002%s\002 unregistered."}, /* {ARGS: "#TestChan"} */
+    {"NS_RECOVER_DONE", "\002%s\002 has been recovered."}, /* {ARGS: "#TestChan"} */
+    {"NS_RESYNC_DONE", "Synchronized users in \002%s\002 with the userlist."}, /* {ARGS: "#TestChan"} */
+    {"NS_TIMEBAN_DURATION_TOO_SHORT", "You must specify a ban duration of at least %d seconds."}, /* {ARGS: 30} */
+    {"NS_TIMEBAN_DONE", "Banned \002%s\002 from %s for %s. (matching %d users)"}, /* {ARGS: "*!*@bla*", "#TestChan", "2 hours", 5} */
+    {"NS_MODE_INVALID", "\002%c\002 is an invalid set of channel modes."}, /* {ARGS: "+xyz"} */
+    {"NS_MODE_LOCKED", "Modes conflicting with \002%s\002 are not allowed in %s."}, /* {ARGS: "+xyz", "#TestChan"} */
+    {"NS_MODE_DONE", "Channel modes are now \002%s\002."}, /* {ARGS: "+xyz"} */
+    {"NS_MODE_ENFOPS", "You may not op or deop users on \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_MODE_ENFVOICE", "You may not voice or devoice users on \002%s\002."}, /* {ARGS: "#TestChan"} */
+    {"NS_MODE_CANBAN", "You may not ban or unban users on \002%s\002."}, /* {ARGS: "#TestChan"} */
     {"NS_GOD_ON", "Security override has been enabled."},
     {"NS_GOD_OFF", "Security override has been disabled."},
+    {"NS_PEEK_HEADER", "\002%s\002 Status:"}, /* {ARGS: "#TestChan"} */
+    {"NS_PEEK_TOPIC", "Topic:       %s"}, /* {ARGS: "TOPIC"} */
+    {"NS_PEEK_MODES", "Modes:       %s"}, /* {ARGS: "+xyz"} */
+    {"NS_PEEK_USERS", "Total Users: %d (%d ops, %d voices, %d regulars, %d invisible)"}, /* {ARGS: 20, 4, 6, 8, 2} */
+    {"NS_PEEK_OPS", "Ops:"},
     {NULL, NULL}
 };
 
@@ -230,7 +235,7 @@ INCLUDE ALL CMD's HERE
 //#include "cmd_neonserv_invite.c"
 //#include "cmd_neonserv_info.c"
 #include "cmd_neonserv_netinfo.c"
-//#include "cmd_neonserv_peek.c"
+#include "cmd_neonserv_peek.c"
 #include "cmd_neonserv_set.c" /* TODO: parse, check and set modelock */
 //#include "cmd_neonserv_events.c"
 #include "cmd_neonserv_resync.c"
@@ -409,6 +414,8 @@ void init_NeonServ() {
     register_command(BOTID, "addtimeban",   neonserv_cmd_addtimeban,2, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH,  "#channel_staticban",   0);
     register_command(BOTID, "mode",         neonserv_cmd_mode,      1, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN | CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH,  "#channel_getop",       0);
     register_command(BOTID, "version",      neonserv_cmd_version,   0, 0,                                                                                           NULL,                   0);
+    register_command(BOTID, "peek",         neonserv_cmd_peek,      0, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN,                                              NULL,                   0);
+    //register_command(BOTID, "info",         neonserv_cmd_info,      0, CMDFLAG_REQUIRE_CHAN | CMDFLAG_REGISTERED_CHAN,                                              NULL,                   0);
     
     register_command(BOTID, "trace",        neonserv_cmd_trace,     1, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH,                                                   NULL,                   400);
     register_command(BOTID, "register",     neonserv_cmd_register,  2, CMDFLAG_REQUIRE_AUTH | CMDFLAG_CHECK_AUTH | CMDFLAG_CHAN_PARAM | CMDFLAG_OPLOG,              NULL,                   100);
diff --git a/cmd_neonserv_peek.c b/cmd_neonserv_peek.c
new file mode 100644 (file)
index 0000000..a6ae312
--- /dev/null
@@ -0,0 +1,64 @@
+
+/*
+* no parameters
+*/
+static USERLIST_CALLBACK(neonserv_cmd_peek_userlist_lookup);
+static void neonserv_cmd_peek_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan);
+
+struct neonserv_cmd_peek_cache {
+    struct ClientSocket *client, *textclient;
+    struct UserNode *user;
+};
+
+static CMD_BIND(neonserv_cmd_peek) {
+    struct neonserv_cmd_peek_cache *cache = malloc(sizeof(*cache));
+    if (!cache) {
+        perror("malloc() failed");
+        return;
+    }
+    cache->client = client;
+    cache->textclient = getTextBot();
+    cache->user = user;
+    get_userlist_with_invisible(chan, neonserv_cmd_peek_userlist_lookup, cache);
+}
+
+static USERLIST_CALLBACK(neonserv_cmd_peek_userlist_lookup) {
+    struct neonserv_cmd_peek_cache *cache = data;
+    neonserv_cmd_peek_async1(cache->client, cache->textclient, cache->user, chan);
+    free(cache);
+}
+
+static void neonserv_cmd_peek_async1(struct ClientSocket *client, struct ClientSocket *textclient, struct UserNode *user, struct ChanNode *chan) {
+    reply(textclient, user, "NS_PEEK_HEADER", chan->name);
+    reply(textclient, user, "NS_PEEK_TOPIC", chan->topic);
+    char tmpStr[MAXLEN];
+    reply(textclient, user, "NS_PEEK_MODES", getModeString(chan->modes, tmpStr));
+    struct ChanUser *chanuser;
+    int op_count = 0, voice_count = 0, normal_count = 0, invi_count = 0;
+    for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
+        if(chanuser->flags & CHANUSERFLAG_OPPED)
+            op_count++;
+        else if(chanuser->flags & CHANUSERFLAG_VOICED)
+            voice_count++;
+        else if(chanuser->flags & CHANUSERFLAG_VOICED)
+            invi_count++;
+        else
+            normal_count++;
+    }
+    reply(textclient, user, "NS_PEEK_USERS", op_count+voice_count+invi_count+normal_count, op_count, voice_count, normal_count, invi_count);
+    int tmpStrPos = 0;
+    int headerlen = 10 + strlen(user->nick);
+    for(chanuser = getChannelUsers(chan, NULL); chanuser; chanuser = getChannelUsers(chan, chanuser)) {
+        if(chanuser->flags & CHANUSERFLAG_OPPED) {
+            if(tmpStrPos + headerlen + strlen(chanuser->user->nick) + 2 >= 512) {
+                //clear buffer
+                reply(textclient, user, "%s", tmpStr);
+                tmpStrPos = 0;
+            }
+            tmpStrPos += sprintf(tmpStr + tmpStrPos, (tmpStrPos ? ", %s" : "%s"), chanuser->user->nick);
+        }
+    }
+    if(tmpStrPos) {
+        reply(textclient, user, "%s", tmpStr);
+    }
+}
index c3868ea7e8fb138fb17c50404d2caa2c29ee4569..507b907128f0010b83b8a5ee02c0671d27897b2e 100644 (file)
--- a/modcmd.c
+++ b/modcmd.c
@@ -38,8 +38,8 @@ static const struct default_language_entry msgtab[] = {
     {"MODCMD_LESS_PARAM_COUNT", "This command requires more parameters."},
     {"MODCMD_CHAN_REQUIRED",    "You must provide the name of a channel that exists."},
     {"MODCMD_AUTH_REQUIRED",    "You need to be authenticated with AuthServ to use this command."},
-    {"MODCMD_PRIVILEGED",       "\002%s\002 is a privileged command."},
-    {"MODCMD_PUBCMD",           "Public commands in \002%s\002 are restricted."},
+    {"MODCMD_PRIVILEGED",       "\002%s\002 is a privileged command."}, /* {ARGS: "god"} */
+    {"MODCMD_PUBCMD",           "Public commands in \002%s\002 are restricted."}, /* {ARGS: "#TestChan"} */
     {"MODCMD_ACCESS_DENIED",    "Access denied."},
     {NULL, NULL}
 };
diff --git a/tools.c b/tools.c
index c42fb128115a0fc0972ceec74c32a0081e58e786..097684855d8230a66cb21819ceb9240dce68a5cb 100644 (file)
--- a/tools.c
+++ b/tools.c
@@ -5,8 +5,8 @@
 #include "ClientSocket.h"
 
 static const struct default_language_entry msgtab[] = {
-    {"TIME_MASK_2_ITEMS", "%s and %s"},
-    {"TIME_MASK_3_ITEMS", "%s, %s and %s"},
+    {"TIME_MASK_2_ITEMS", "%s and %s"}, /* {ARGS: "2 days", "1 hour"} */
+    {"TIME_MASK_3_ITEMS", "%s, %s and %s"}, /* {ARGS: "2 days", "1 hour", "20 minutes"} */
     {"TIME_YEAR", "year"},
     {"TIME_YEARS", "years"},
     {"TIME_MONTH", "month"},