Opened 9 years ago

Closed 7 years ago

#581 closed enhancement (fixed)

IRC Journal support

Reported by: wadeb Owned by: bvuong
Priority: Unspecified by Maintainer Milestone: Unspecified
Component: Irc Version: Git as of bugdate
Severity: Major Keywords:
Cc: mchua Distribution/OS: Unspecified
Bug Status: Unconfirmed

Description

Currently, IRC doesn't appear to restore anything from the Journal when a saved instance is resumed.

When resuming from the Journal, IRC should restore (at least):

  • Server
  • Nickname
  • Channels
  • Scrollback history

Change History (9)

comment:1 Changed 9 years ago by wadeb

  • Component changed from sugar to Irc
  • Owner changed from tomeu to mchua

Wrong component, my bad!

comment:2 Changed 7 years ago by bvuong

To get started, I looked up on how the journal interacts with a Sugar Activity, which is through the write_file() and read_file() methods. The write_file() method of the activity will save the data given from it and will be used later from the journal using the read_file() method. Nicknames are stored in Network.nicks in irc.py. Channels are stored in Core.channels in core.py. The server is stored in Network.server in irc.py. I haven't found out where all the messages go at the moment.

When making the write_file(), I was able to read in the current nickname, server, and channels. When I try putting them back in when opening the latest journal, I just get the default settings. Default nickname, default server, and default channels. The server makes sense, because irc.freenode.net was written in the code when opening up. The channels and nicknames were also written in the code as well, but I thought running add_channel() or run_command("/nick myname") would overwrite those settings. For channels, when I ran the command "/join," it did not actually add the channel into the the Core.channels list. Only when I put the line "add_channel(#example)," that would work.

so now I have some questions hoping to be answered:

  • How can I overwrite the settings wanted?
  • Where can I find the text for the history scrollback?
  • Do the commands /nick and /join actually store the information to their respected lists
  • What is the proper way to write the write_file() and read_file() methods for a sugar activity. I've seen two ways (using metadata and writing/reading into files), but I'm not sure what works best for this type of situation.

Much help would be appreciated.

comment:3 Changed 7 years ago by mchua

  • Cc mchua added
  • Owner changed from mchua to bvuong
  • Status changed from new to assigned

comment:4 follow-up: Changed 7 years ago by bvuong

# found in Network of irc.py

def raw(self, msg):

self.events.trigger("OwnRaw", network=self, raw=msg)
if self.status >= INITIALIZING:

self.socket.send(msg + "\r\n")


I got the error: Error handling: OwnRaw
when running self.client.run_command("/nick " + self.metadatanickname?) or self.client.run_command("/nick testingname")

comment:5 in reply to: ↑ 4 Changed 7 years ago by ganderson

I was working on this last night because the run_command() function calls the events.trigger() function (which gets called again with "OwnRaw" and the message is "NICK :geoffisawesome" (where 'geoffisawesome' is a nick that I plugged in with the run_command :P)

So you to dive into this some more. I wonder if there's an issue "under the hood"

-Geoff

Replying to bvuong:

# found in Network of irc.py

def raw(self, msg):

self.events.trigger("OwnRaw", network=self, raw=msg)
if self.status >= INITIALIZING:

self.socket.send(msg + "\r\n")


I got the error: Error handling: OwnRaw
when running self.client.run_command("/nick " + self.metadatanickname?) or self.client.run_command("/nick testingname")

comment:6 Changed 7 years ago by ganderson

Another thing I noticed with reading/writing the channels to the journal. When the python list of the channels is stored in the journal (self.metadatachannels?), the system seems to marshall the data as a dbus bytearray of a dbus array. When reading it back in, we can't seem to get it to convert back into a python list and thus, it's stuck as the string "dbus.Array(...". Tried different methods of casting but none seemed to work.

comment:7 Changed 7 years ago by mchua

bvuong has wrapped up his internship, summary at https://sites.google.com/a/lv5.org/bvworks/home/working-with-sugarlabs/lastday - thanks, bvuong! Do you want to continue owning (and working on) this ticket? You seem to be making good progress.

comment:8 Changed 7 years ago by mchua

Development on this ticket is being done in this branch: http://git.sugarlabs.org/projects/irc/repos/journal-development/logs/master

comment:9 Changed 7 years ago by fran

  • Resolution set to fixed
  • Status changed from assigned to closed

Development on this ticket seems to have stalled, so I took a whack at it - the latest version in Git mainline now supports saving to and loading from the Journal. The user's nick, server they're on, channels they're in, and channel and query window scrollback should now be persistent between sessions.

Note: See TracTickets for help on using tickets.