Feature chat_logs()

I was thinking it would be cool to be able to load up old chat logs similar to session_logs().

Perhaps instead of "last X days" you could load a specific file from disc (restricted to logs from the current character?) or maybe just give a date and instead of integer indexing maybe use string indexing in case there are multiple chat rooms used/private messages sent on said date.

Just an idea, up for exploration and debate.
 
For what purpose would you use this? Suggesting a practical implementation makes a huge difference in the likelihood that a dev will want to bother.
 
I do run a chat bot and yes, that's probably the only real use for it.
I suppose a more broad request (and probably less work on you guys) would be for a way to load files that aren't stored as maps. Like visit_url() but on the local filesystem. Unless there's already a way to do this, in which case that'd be awesome.
 
I do run a chat bot and yes, that's probably the only real use for it.
I suppose a more broad request (and probably less work on you guys) would be for a way to load files that aren't stored as maps. Like visit_url() but on the local filesystem. Unless there's already a way to do this, in which case that'd be awesome.

Attempt (using visit_url with file:///path/to/local/file) yielded the following:

Code:
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
      KoLmafia v15.6 r11526, Linux, Java 1.7.0_b147-icedtea
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Please note: do not post this log in the KoLmafia thread. If you
 would like the dev team to look at it, please write a bug report
 at kolmafia.us. Include specific information about what you were 
 doing when you made this and include the log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
 Timestamp: Wed Oct 24 09:44:38 PDT 2012
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


Unexpected error, debug log printed.
class java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
java.lang.ClassCastException: sun.net.www.protocol.file.FileURLConnection cannot be cast to java.net.HttpURLConnection
        at net.sourceforge.kolmafia.request.GenericRequest.prepareConnection(GenericRequest.java:1487)
        at net.sourceforge.kolmafia.request.GenericRequest.execute(GenericRequest.java:1438)
        at net.sourceforge.kolmafia.request.GenericRequest.run(GenericRequest.java:1336)
        at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:222)
        at net.sourceforge.kolmafia.RequestThread.postRequest(RequestThread.java:185)
        at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:1865)
        at net.sourceforge.kolmafia.textui.RuntimeLibrary.visit_url(RuntimeLibrary.java:1819)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:601)
        at net.sourceforge.kolmafia.textui.parsetree.LibraryFunction.execute(LibraryFunction.java:115)
        at net.sourceforge.kolmafia.textui.parsetree.FunctionCall.execute(FunctionCall.java:169)
        at net.sourceforge.kolmafia.textui.parsetree.BasicScope.execute(BasicScope.java:465)
        at net.sourceforge.kolmafia.textui.Interpreter.executeScope(Interpreter.java:348)
        at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:296)
        at net.sourceforge.kolmafia.textui.Interpreter.execute(Interpreter.java:289)
        at net.sourceforge.kolmafia.textui.command.AshSingleLineCommand.run(AshSingleLineCommand.java:73)
        at net.sourceforge.kolmafia.KoLmafiaCLI.doExecuteCommand(KoLmafiaCLI.java:592)
        at net.sourceforge.kolmafia.KoLmafiaCLI.executeCommand(KoLmafiaCLI.java:545)
        at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:446)
        at net.sourceforge.kolmafia.KoLmafiaCLI.executeLine(KoLmafiaCLI.java:314)
        at net.sourceforge.kolmafia.KoLmafiaCLI$CommandProcessorThread.run(KoLmafiaCLI.java:236)

So... I don't think it's possible yet? And it'd probably be a security vulnerability (I don't know that I'd trust user scripts nearly as much if this were possible).
 
Maybe just a file_to_string() that follows the same rules as file_to_map(), then the script writer can parse that text manually? Regardless, that should be fixed to print an error message saying we don't allow local file access through visit_url() instead of throwing an exception.
 
Back
Top