Hi Sergiu/Sorin, On Dec 15, 2010, at 8:58 PM, sdumitriu (SVN) wrote:
Author: sdumitriu Date: 2010-12-15 20:58:05 +0100 (Wed, 15 Dec 2010) New Revision: 33548
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClass.xml platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassSheet.xml platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassTemplate.xml platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCBot.xml platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/WebHome.xml Log: XAIRCBOT-2: Changed ircbot syntax logging, colouring and full 2.0 syntax Done. Patch from Sorin Burjan applied with some XML cleanup
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClass.xml =================================================================== --- platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClass.xml 2010-12-15 19:57:51 UTC (rev 33547) +++ platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClass.xml 2010-12-15 19:58:05 UTC (rev 33548) @@ -20,7 +20,7 @@ <validationScript></validationScript> <comment></comment> <minorEdit>false</minorEdit> -<syntaxId>xwiki/1.0</syntaxId> +<syntaxId>xwiki/2.0</syntaxId> <hidden>false</hidden> <class> <name>IRC.IRCArchiveClass</name> @@ -63,7 +63,13 @@ <classType>com.xpn.xwiki.objects.classes.TextAreaClass</classType> </content> </class> -<content>#set($defaultparent = "IRC.WebHome") +− +<content> +{{velocity filter="none"}}
We shouldn't use this filter. It's set automatically by the converter but it's not necessary and makes the code more complex than it should be and prevents us to use indentation! There are some other cases below where it's used too. Thanks -Vincent
+#set($defaultparent = "IRC.WebHome") #set($defaultweb = "IRC") -#includeForm("XWiki.ClassSheet")</content> +{{/velocity}} + +{{include document="XWiki.ClassSheet"/}} +</content> </xwikidoc>
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassSheet.xml =================================================================== --- platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassSheet.xml 2010-12-15 19:57:51 UTC (rev 33547) +++ platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassSheet.xml 2010-12-15 19:58:05 UTC (rev 33548) @@ -20,12 +20,10 @@ <validationScript></validationScript> <comment></comment> <minorEdit>false</minorEdit> -<syntaxId>xwiki/1.0</syntaxId> +<syntaxId>xwiki/2.0</syntaxId> <hidden>false</hidden> -<content>$doc.use("IRC.IRCArchiveClass") -{pre} -<pre> -$xwiki.getXMLEncoded($doc.display("content")) -</pre> -{/pre}</content> -</xwikidoc> +<content>{{velocity filter="none"}} +{{code language="irc"}} +$doc.getObject('IRC.IRCArchiveClass').getProperty('content').getValue() +{{/code}} +{{/velocity}}</content></xwikidoc>
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassTemplate.xml =================================================================== --- platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassTemplate.xml 2010-12-15 19:57:51 UTC (rev 33547) +++ platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCArchiveClassTemplate.xml 2010-12-15 19:58:05 UTC (rev 33548) @@ -20,7 +20,7 @@ <validationScript></validationScript> <comment></comment> <minorEdit>false</minorEdit> -<syntaxId>xwiki/1.0</syntaxId> +<syntaxId>xwiki/2.0</syntaxId> <hidden>false</hidden> -<content>#includeForm("IRC.IRCArchiveClassSheet") -</content></xwikidoc> \ No newline at end of file +<content>{{include document="IRC.IRCArchiveClassSheet"/}}</content> +</xwikidoc>
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCBot.xml =================================================================== --- platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCBot.xml 2010-12-15 19:57:51 UTC (rev 33547) +++ platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/IRCBot.xml 2010-12-15 19:58:05 UTC (rev 33548) @@ -188,8 +188,8 @@ * [[$item]]: $itemDoc.getValue("description") #end {{/velocity}} -)))
+ = Status =
{{include document="IRC.IRCBotlet"/}} @@ -258,8 +258,14 @@ { initExecutionContext() def date = xwiki.formatDate(new Date(), "HH:mm", context) - log(channel, "${sender} - (${date}): ${message}\n") - + def User[] pircUsers = this.getUsers(channel) + def userPrefix = ""; + for (User singleUser in pircUsers) { + if (singleUser.equals(sender)) { + userPrefix = singleUser.getPrefix(); + } + } + log(channel, "${date} <${userPrefix}${sender}> ${message}\n") for (IRCBotlet botlet : Utils.getComponentManager().lookupList(IRCBotlet.class)) { try { def result = botlet.handleMessage(channel, sender, login, hostname, message, xwiki, context) @@ -291,21 +297,21 @@ { initExecutionContext() def date = xwiki.formatDate(new Date(), "HH:mm", context) - log(channel, "${sender} joined ${channel} at ${date}\n") + log(channel, "${date} <${sender}> has joined ${channel}\n") }
void onPart(String channel, String sender, String login, String hostname) { initExecutionContext() def date = xwiki.formatDate(new Date(), "HH:mm", context) - log(channel, "${sender} left ${channel} at ${date}\n") + log(channel, "${date} <${sender}> has left ${channel}\n") }
void onQuit(String sourceNick, String sourceLogin, String sourceHostname, String reason) { initExecutionContext() def date = xwiki.formatDate(new Date(), "HH:mm", context) - log(getChannels()[0], "${sourceNick} left at ${date} (${reason}\n") + log(getChannels()[0], "${date} <${sourceNick}> has quit\n") }
public void onPrivateMessage(String sender, String login, String hostname, String message) @@ -317,7 +323,8 @@ void onNickChange(String oldNick, String login, String hostname, String newNick) { initExecutionContext() - log(getChannels()[0], "${oldNick} is now known as ${newNick} (${login}@${hostname}\n") + def date = xwiki.formatDate(new Date(), "HH:mm", context) + log(getChannels()[0], "${date} <${oldNick}> is now known as <${newNick}>\n") }
XWikiDocument getLoggingDocument(String channelName)
Modified: platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/WebHome.xml =================================================================== --- platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/WebHome.xml 2010-12-15 19:57:51 UTC (rev 33547) +++ platform/xwiki-applications/trunk/ircbot/src/main/resources/IRC/WebHome.xml 2010-12-15 19:58:05 UTC (rev 33548) @@ -37,6 +37,7 @@ }) #set($options = { "className":"IRC.IRCArchiveClass", + "translationPrefix" : "irc.", "rowCount": 10 }) #livetable("ircarchives" $columns $columnsProperties $options)