Re: Determinating iChat status
Re: Determinating iChat status
- Subject: Re: Determinating iChat status
- From: Bob Ippolito <email@hidden>
- Date: Tue, 1 Jun 2004 03:09:05 -0400
On Jun 1, 2004, at 1:50 AM, Wade Tregaskis wrote:
>
> [NSClassFromString(@"AddressBookPeople") loadBuddyList];
>
> [NSClassFromString(@"DaemonicService") connectToDaemonWithLaunch:YES];
>
>
>
> IMService *service=[IMService mostLoggedInService];
>
> int chatstatus=[service serviceLoginStatus];
>
>
Just a note, the above code (in fact any that tries to use
>
InstantMessage.framework) will just fail and cause exceptions if not
>
run from a GUI (possibly Cocoa-only) app. Something about an invalid
>
signature... I think it requires a plist file for the current app or
>
something. Dunno. Caused me hours of frustration, anyway. :)
PyObjC (
http://pyobjc.sf.net/ ) is great for reverse engineering
frameworks like this because you can do it interactively; with no
headers or compilation step required. Check this out:
[crack:~] bob% pythonw
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>
>> import objc
>
>> objc.loadBundle('InstantMessage', globals(),
'/System/Library/PrivateFrameworks/InstantMessage.framework')
>
>> AddressBookPeople.loadBuddyList()
>
>> DaemonicService.connectToDaemonWithLaunch_(True)
1
>
>> service = IMService.mostLoggedInService()
>
>> service.serviceLoginStatus()
4
>
>> service.loginID()
u'etrepum'
>
>> IMService.myPicture()
BuddyPicture[of MeCard(Bob Ippolito); data=2571bytes]
(note: the pythonw script runs from inside a bundle, so it doesn't have
the problem connecting to WindowServer that caused you the frustration)
-bob
[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.