Peek at current project

in Tech Stuff

I’ve been incubating a new IRC client for the past few months, as a way to learn cocoa and gain proficiency over the APIs. I thought I’d share a peek at a finished part of the application that I’m quite proud of; the connections preferences panel.

IRC is a pretty simple protocol, but there are a lot of things to consider when you’re organising a list of servers to connect to for an IRC client. Personally, I wanted this client to be useful for me, and for that it needed a simple yet comprehensive configuration for IRC networks, the servers that are associated to those networks, and all the settings related to all of that.

I came up with a basic list of requirements. Firstly, IRC networks;

  • Need a name.
  • Need an identity associated with it, as you’re most likely going to want to keep the same nickname/username/passwords across all servers in a network.
  • Need default encoding settings.
  • Need a list of channels to join.
  • Need a list of servers, and a notion of a ‘preferred’ server.
  • Other settings.

Servers need:

  • a hostname
  • a port
  • a password (some servers may have a password, where others in the same network may not).
  • a flag to indicate whether it is enabled (available to be connected to)
  • a flag for SSL.

Channels need:

  • a name
  • a channel key
  • an encoding
  • a flag for automatically joining the channel.

This is what I’ve come up with:

All of this uses cocoa bindings with a NSMutableArray as the storage. The method I use to avoid NSUserDefaults ending up with null values, is that I add entries programatically rather than relying on Bindings to create the row, etc. This means that when I serialize the data to NSUserDefaults, that there will always be an object for every key, and when reading it from disk, there are no problems.

The NSWindowController subclass I use for the preferences panel is quite useful, and I might write up a piece about it at some point; it automatically remembers it’s location, which tab was selected, and animates the resize. The view is blanked between resizes, rather than clipping or scrolling the view as it is resized; no crossfading. Crossfading actually looks pretty ugly, imho. I might experiment with a fade to blank, resize, fade in animation.

The application itself is coming along nicely. It’s able to connect to servers and all of the network communications stuff is done.

Now the hard part will be the style engine, which will take events on the console and the channels and turn them into pretty NSAttributedStrings for display in the channel/console windows.

And if you’re wondering as to what it is currently looking like, here’s a preview:

sneakpeek.png

If you’re thinking to yourself, my that looks a lot like Ircle, you’d be right; I loved that client and the way it was so uncluttered. Windows had very little decoration, just contained what you needed for to chat in a channel, and other UI components like user lists etc got out of the way.

It also makes it easier to code, if you don’t need to use dockable tabs etc. ;)

Anyway. This is just a prototype, and nothing is set in stone. The main priority is getting something that works out the door, first.

0 Comments

Leave a Reply

Using Gravatars in the comments - get your own and be recognized!

XHTML: These are some of the tags you can use: <a href=""> <b> <blockquote> <code> <em> <i> <strike> <strong>