Support user modes adverised by server

129 views
Skip to first unread message

Konstantin Merenkov

unread,
Nov 1, 2010, 8:43:28 PM11/1/10
to limec...@googlegroups.com
Hi all!

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
environment.


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
objective c.


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.

Thank you!

--
Best Regards,
Konstantin Merenkov

Ryccardo

unread,
May 13, 2011, 2:31:14 PM5/13/11
to limec...@googlegroups.com
I fully support this.

Sometimes it's impossible to get an IRCOp to change the PREFIX=* setting, even though most IRCDs are `properly` configured (with the exception of SporksIRCd).

Konstantin Merenkov

unread,
May 14, 2011, 8:29:03 AM5/14/11
to LimeChat
Unfortunately it seems like nobody cares :-(
Author doesn't respond on github and continues to improve limechat
without this important bugfix.

You can get old version of limechat with the issue fixed here
https://github.com/kmerenkov/limechat/downloads

Also the reason why I don't use limechat on iOS is that I am afraid it
won't work on the servers I live.
Reply all
Reply to author
Forward
0 new messages