即时消息框架示例

发布于 2024-09-27 21:31:27 字数 63 浏览 0 评论 0原文

有人可以展示如何登录 AIM,然后使用 IMframework 发送和接收消息的示例吗?

谢谢!

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

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半夏半凉 2024-10-04 21:31:27

我是 AOL 即时通讯程序 Objective-C 库的作者。它提供了一种简单的面向对象的即时消息传递方法。人们过去曾使用它来开发 iOS IM 应用程序,甚至添加它来支持诸如 Off-The -记录。您可以在 github 上查看,下载源代码,然后通过手动复制源代码将其添加到您的应用程序中。一旦您的项目中有了代码,您就可以像这样登录:

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

登录并获得会话后,您可以执行诸如设置状态消息之类的操作,如下所示:

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

您可以像这样向好友发送消息:

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

该库支持几乎 AIM 用户日常体验的所有标准功能。请参阅 MyTest.m 中的工作示例。请注意,它还包括核心功能以外的东西,例如线程阻塞检测等。

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.

無心 2024-10-04 21:31:27

我知道 Google 在 gTalk 中使用 OpenAIM。您可以在以下位置了解更多信息:http://dev.aol.com/aim

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

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文