[Adium-devl] Some questions about write a new service plugin
zacwest at gmail.com
Wed Apr 22 20:20:33 UTC 2009
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
> 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
> doesn't work.
The window won't shake. You should be posting Chat_NudgeBuzzOccured like so:
postNotificationName:Chat_NudgeBuzzOccured object:chat nil];
> That's all. I'm waiting for your reply. Thank you.
> Best regards,
> Evan JIANG
More information about the Adium-devl