Hi there guys,
I'm interested in getting Adium to filter the screen name of an account's displayName for applescript commands, so I (Kiel) don't have the following display in my message windows, for example:
Kiel (%_album)
message
Dale
reply to message
Ideally, I want to be able to have the following output in the message window:
Kiel (Poodle Hat)
message
Dale
reply to message
Please note that Dale sees my screen name as "Kiel (Poodle Hat)". What I'd like to do is have "Kiel (Poodle Hat)" show on my end of the conversation/message window.
I've downloaded the source code and I'm looking to access the current screen name of the account and format it so the applescript command does not appear in it, rather the result of the command.
First of all, I don't understand how Adium filters NSStrings or NSAttributedStrings for AppleScript commands. It seems there's an instance method I can use in the AIContentController class but I'm unsure how to use it properly (for example, pre-processing the string).
Furthermore, I'm unsure of how to get the account's current displayName. I'm starting to think that I should make the filtering occur when the setDisplayName: method is called, filtering the displayName at the very start.
I'm not too familiar with the code and I'd like to contribute to correcting this minor display flaw. The removal of the %_album would make Adium look more polished and "lovely".
Any suggestions developers or am I on the wrong road?
Thanks in advance,
Kiel :-)
PS: I've written an NSLog() statement in the - [AIListObject ownDisplayName] method to show me the local variable called outName of the instance of AIAccount being used. When the method is called and I open up a message window and send someone a message, the Console writes my screen name as "Kiel (%_album)". Furthermore, if I message myself, Console writes "Kiel (%_album)" and on another line "Kiel (Poodle Hat)". Which screen name of which instance is being used?
Filtering strings with results of AppleScript commands
- evands
- Cocoaforge Admin
- Posts: 3152
- Joined: Thu Dec 02, 2004 10:55 pm
- Location: Decatur, GA
- Contact:
Processing the string is expensive and shouldn't be done more than necessary, so it's not as simple as just reprocessing it each time before displaying. You're right, I think, though -- it would look better if it displayed the same to you as it does to the other user.
Here's how I solved the problem:
Previously, AIAccount was responsible for setting the display name based on the entered name, which is stored as an object-specific preference on the key @"FullNameAttr". However, this occurs on the original, unfiltered string. Now, there is a subclassable method, - (BOOL)superclassManagesDisplayName. The MSN account class will return NO, making AIAccount ignore the display name entirely. It will then do its own setting in the method called once the string has been filtered, -(void)_setFriendlyNameTo:(NSAttributedString *)attributedFriendlyName.
I was going to just suggest the fixes, but I had a moment and realized that this was a somewhat convoluted situation that it'd be easier to do it than explain it before hand
Here's how I solved the problem:
Previously, AIAccount was responsible for setting the display name based on the entered name, which is stored as an object-specific preference on the key @"FullNameAttr". However, this occurs on the original, unfiltered string. Now, there is a subclassable method, - (BOOL)superclassManagesDisplayName. The MSN account class will return NO, making AIAccount ignore the display name entirely. It will then do its own setting in the method called once the string has been filtered, -(void)_setFriendlyNameTo:(NSAttributedString *)attributedFriendlyName.
I was going to just suggest the fixes, but I had a moment and realized that this was a somewhat convoluted situation that it'd be easier to do it than explain it before hand
Ok this is really great news! Thanks for your trouble! I agree with your conclusion, that it would have been simpler for you to do something about it then explain it to me and have me stuff around doing a 50% decent job :-)
Can't wait for 0.74
I'll still look at the source code as it's a very interesting program and I'll learn a lot from it. I'd also like to understand the structure of the program.
Congratulations on the fweakin' awesome job you guys have done so far - the program is downright excellent.
Kiel :-)
Can't wait for 0.74
Congratulations on the fweakin' awesome job you guys have done so far - the program is downright excellent.
Kiel :-)