Recently I was given a macbook at work, and since I live in IRC I
immediately installed limechat (I wanted this app even few years back
However, the server I am living on, limechat performs badly ;-(
Nick completion is broken, modes aren't recognized by app, renames
aren't tracked (!), so if user renames I cannot see it, and I see that
memberlist isn't updated.
I filled an issue - http://github.com/psychs/limechat/issues#issue/26
- and decided to do what people do in opensource community - make a
patch. Not only for greater good but to be able to use limechat in my
Okay, here's the problem:
At the moment limechat has a hardcoded mapping of modes and prefixes,
like 'o' = '@', and if user is named @User, then he will be op and his
nick is User.
To make life simpler, some servers (the only exception I know is
irc.2ch.net) send 005 message with PREFIX=(ohv)@%+ so you can make a
mapping yourself, for example, user @User is an operator, %User is a
halfop, and +User is just a "vote".
Limechat doesn't do anything with this piece of information provided
by a server at the moment.
On irc.irchighway.net mapping is different from hardcoded in limechat,
they treat ! as op but limechat is not aware of that.
This leads to such behaviour: "!" becomes a part of user's nickname,
and in order to complete a nickname, you have to start it with "!".
Also to make whois work, you need to !U<tab> and then erase the first
"!". Because "!" is not a part of nickname at all and whois will
respond with error.
So I added support for PREFIX= to limechat.
Here's what I made so far - github.com/kmerenkov/limechat/tree/005_prefixes
I never coded in objective-c before, so any advice or review is highly
appreciated. For example, I am not familiar with memory management in
My changes explained:
I parse this PREFIX= string and make two maps (dicts), one where mode
is a key and prefix is a value, and another one where prefix is a key
and mode is a value.
I could do with one map but they are not always 1:1 mirrored. Like, I
have a default map, and it has few prefixes mapped to the same mode.
So, IRCISupportInfo has this mapping and a new method -
userModeByPrefix, that returns "o" if it was given "@", for example.
IRCUser has a new method setModesMap, and when 'mark' is called, it
returns correct nick prefix for user's mode. The one it received from
server (and I think it is the biggest gain in this changeset). So if
server tells us that operators are ! and not @, it will be so in
member list, just as in many others IRC clients out there.
IRCClient takes rest of everything else.
Please comment on the code, I will improve it and send pull request.
I will try to tidy it up a bit myself, but still, this is my first
time with objective c.