[Adium-devl] Some questions about write a new service plugin
Evan JIANG
firstfan at gmail.com
Thu Apr 23 02:15:31 UTC 2009
Zachary,
Thank you very much.
Yes, I didn't implement the host method. After add it, issue 1&3
are fixed. But after that, when I try to set the account to offline,
it will be offline, and re-connect immediately.
About issue 2, after add host method, the [self statusType] is still
offlinetype in connect method (I print out [self statusType] after
called [super connect]).
And issue 4, Chat_NudgeBuzzOccured is not defined in both
Adium.framework, AIUtilities.framework and FriBidi.framework. Anyway,
I found out the string value and use it as
[[adium notificationCenter] postNotificationName:@"Chat_NudgeBuzzOccured"
object:chat];
It works partly. I mean, the chat window will add a message like "XXX
need your attention". But the window still doesn't shake. After look
into the AINudgeBuzzHandlerPlugin's source code, I guess it may check
the service to decide whether to shake the window.
Thank you agian. Your mail really helps me.
Best regards,
On Thu, Apr 23, 2009 at 4:20 AM, Zachary West <zacwest at gmail.com> wrote:
> Hi,
>
> On Wed, Apr 22, 2009 at 15:02, Evan JIANG <firstfan at gmail.com> wrote:
>> Hi all,
>> I'm a newbie to adium's code. I'm trying to write a service plugin
>> for adium to support Fetion IM (China Mobile Messenger). It basicly
>> works. While developing it, I use adium 1.3.3 source code for
>> reference, especially the purple service code.
>> But I met some problems, really hard for myself to solve by studying
>> the existing code.
>> 1. I need to add
>> if ([self enabled])
>> [self setShouldBeOnline:TRUE];
>> into the end of "initAccount" method to make the enabled service
>> start to connect when launching adium. But I didn't see such kind of
>> code in CBPurpleAccount.m. How does it work?
>
> You probably aren't responding to -host on the account. Note that this
> uses, by default, a preference for the account:
>
> /*!
> * @brief Connect Host
> *
> * Convenience method for retrieving the connect host for this account
> */
> - (NSString *)host
> {
> return [self preferenceForKey:KEY_CONNECT_HOST group:GROUP_ACCOUNT_STATUS];
> }
>
> This is used to determine connectivity, you shouldn't need to add that
> to the init. When the server specified by -host is available, it will
> connect. See also:
>
>
>> 2. Adium will keep service's status as the last time it is. For
>> example, if I set the MSN account to be away, and then quit adium and
>> re-launch again, the MSN account is still be away. I think this status
>> should be set before login to the server, for most of IM protocols
>> support to set login status. But before call "[self didConnect]",
>> [self statusState] always be AIOfflineStatusType. Though I found I
>> can get the last time staus with "[self
>> valueForProperty:@"StatusState"]", I found CBPurpleAccount doesn't use
>> that. Then what's the right way to implement it?
>>
>
> This is probably related to #1/#3. If it doesn't fix it by returning a
> -host, please respond.
>
>> 3. In Adium's preference - account panel, if I set my service to
>> disable, and try to enable that again, it will not start to connect.
>> Even the UI of account panel won't update, I mean, when I try to
>> enable the servie, the checkbox shows not checked, I need to press up
>> key and down key to move the highlight to that service to force the UI
>> update again, then I can see the checkbox is checked. Maybe this issue
>> is similar as the 1st question.
>
> It might be, I'm not all that sure I understand. Does the checkbox not
> work, or is it merely not connecting? The initial connect here, that
> is when enabling, probably requires the host be connectable, so #1
> applies.
>
>> 4. Fetion, the service I'm developing on, supports nudge message. I
>> want to know, when I receive the nudge message, how to make the window
>> shaked? It seems that
>> [[adium contactAlertsController] generateEvent:CONTENT_NUDGE_BUZZ_OCCURED
>> forListObject:listObject
>> userInfo:nil
>> previouslyPerformedActionIDs:nil];
>> doesn't work.
>
> The window won't shake. You should be posting Chat_NudgeBuzzOccured like so:
>
>
> [[NSNotificationCenter defaultCenter]
> postNotificationName:Chat_NudgeBuzzOccured object:chat nil];
>
>>
>> That's all. I'm waiting for your reply. Thank you.
>>
>> Best regards,
>> Evan JIANG
>>
>>
>
> Zac
>
More information about the devel
mailing list