Home‎ > ‎Working with SugarLabs‎ > ‎

Journal Implementation to XO IRC

posted Jun 14, 2010, 8:50 PM by Quoc-Bao Vuong
For this enhancement for the IRC Activity, I was assigned to have these features done:
  • Save the current nickname
  • Save the history scrollback
  • Save the current channels
  • Save the current server
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.

Comments