Instant Messaging Template

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

Thank!

+3
source share
2 answers

I am the author of the Objective-C library for instant messaging AOL. It provides a simple, object-oriented approach to instant messaging. People used it in the past to develop applications for iOS IM and even added support for features like Off-The-Record to it . You can check it on github , download the source code and add the source to the application by manually copying it. When you have the code in your project, you can enter it as follows:

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

Once you have logged in and received a session, you can do something like 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 friends:

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

, AIM . . MyTest.m. , , , ..

+1

Source: https://habr.com/ru/post/1769661/


All Articles