3

Can someone show an example on how to log in to AIM, then send and receive messages using the IMframework?

Thanks!

objectiveccoder001
  • 2,981
  • 10
  • 48
  • 72

2 Answers2

1

I know Google is using OpenAIM in gTalk. You can find out more at: http://dev.aol.com/aim

GMail: http://www.google.com/support/chat/bin/answer.py?hl=en&answer=61024

Emil Orol
  • 593
  • 6
  • 20
1

I am the author of an Objective-C library for AOL instant messenger. It provides a simple Object Oriented approach to instant messaging. People have used it in the past to develop iOS IM applications, and even added on to it to support things like Off-The-Record. You can check it out on github, download the source, and add the source to your application by manually copying them. Once you have the code in your project, you can sign in like this:

AIMLogin * login = [[AIMLogin alloc] initWithUsername:username password:password];
[login setDelegate:self];
if (![login beginAuthorization]) {
    NSLog(@"Failed to start authenticating.");
    abort();
}

After you have logged in and gotten a session, you can do things like set your status message as follows:

AIMBuddyStatus * newStatus = [[AIMBuddyStatus alloc] initWithMessage:@"Using LibOrange on Mac!" type:AIMBuddyStatusAvailable timeIdle:0 caps:nil];
[session.statusHandler updateStatus:newStatus];
[newStatus release];

You can send messages to buddies like this:

AIMBlistBuddy * buddy = [[theSession.session buddyList] buddyWithUsername:buddyName];
[theSession.messageHandler sendMessage:[AIMMessage messageWithBuddy:buddy message:@"<BODY>Hello, world!</BODY>"]];

The library supports pretty much every standard feature that AIM users experience on a day to day basis. See my working example in MyTest.m. Note that it includes things other than the core functionality, such as thread blocking detection, etc.

Alex Nichol
  • 7,512
  • 4
  • 32
  • 30