如何显示远程电子邮件信息?

发布于 2024-08-20 20:52:07 字数 1310 浏览 6 评论 0原文

我一直在使用此代码来显示 IMAP4 消息:

void DisplayMessageL( const TMsvId &aId )
        {
        // 1. construct the client MTM
        TMsvEntry indexEntry;
        TMsvId serviceId;
        User::LeaveIfError( iMsvSession->GetEntry(aId, serviceId, indexEntry));
        CBaseMtm* mtm = iClientReg->NewMtmL(indexEntry.iMtm);
        CleanupStack::PushL(mtm);

        // 2. construct the user interface MTM
        CBaseMtmUi* uiMtm = iUiReg->NewMtmUiL(*mtm);
        CleanupStack::PushL(uiMtm);

        // 3. display the message
        uiMtm->BaseMtm().SwitchCurrentEntryL(indexEntry.Id());
        CMsvOperationWait* waiter=CMsvOperationWait::NewLC();
        waiter->Start(); //we use synchronous waiter
        CMsvOperation* op = uiMtm->OpenL(waiter->iStatus);
        CleanupStack::PushL(op);
        CActiveScheduler::Start();

        // 4. cleanup for example even members
        CleanupStack::PopAndDestroy(4); // op,waiter, mtm, uimtm
        }

但是,如果用户尝试下载远程消息(即以前未从邮件服务器检索到的电子邮件之一),然后取消请求,我的代码仍然被阻止,并且它永远不会收到操作被取消的信息。

我的问题是:

  • 上述问题的解决方法是什么,这样应用程序就不会卡住?
  • 任何人都可以提供一个用于异步调用的工作示例,用于打开远程消息,而不会导致应用程序恐慌和崩溃?

POP3、SMTP 和本地 IMAP4 消息的异步调用工作正常,但远程 IMAP4 消息会产生此问题。

我正在测试 S60 第 5 版的这些示例。

预先感谢大家。

I have been using this code to display IMAP4 messages:

void DisplayMessageL( const TMsvId &aId )
        {
        // 1. construct the client MTM
        TMsvEntry indexEntry;
        TMsvId serviceId;
        User::LeaveIfError( iMsvSession->GetEntry(aId, serviceId, indexEntry));
        CBaseMtm* mtm = iClientReg->NewMtmL(indexEntry.iMtm);
        CleanupStack::PushL(mtm);

        // 2. construct the user interface MTM
        CBaseMtmUi* uiMtm = iUiReg->NewMtmUiL(*mtm);
        CleanupStack::PushL(uiMtm);

        // 3. display the message
        uiMtm->BaseMtm().SwitchCurrentEntryL(indexEntry.Id());
        CMsvOperationWait* waiter=CMsvOperationWait::NewLC();
        waiter->Start(); //we use synchronous waiter
        CMsvOperation* op = uiMtm->OpenL(waiter->iStatus);
        CleanupStack::PushL(op);
        CActiveScheduler::Start();

        // 4. cleanup for example even members
        CleanupStack::PopAndDestroy(4); // op,waiter, mtm, uimtm
        }

However, in case when user attempts to download a remote message (i.e. one of the emails previously not retrieved from the mail server), and then cancels the request, my code remains blocked, and it never receives information that the action was canceled.

My question is:

  • what is the workaround for the above, so the application is not stuck?
  • can anyone provide a working example for asynchronous call for opening remote messages which do not panic and crash the application?

Asynchronous calls for POP3, SMTP and local IMAP4 messages work perfectly, but remote IMAP4 messages create this issue.

I am testing these examples for S60 5th edition.

Thank you all in advance.

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

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

发布评论

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

评论(1

叹梦 2024-08-27 20:52:07

首先,我将重试删除 CMsvOperationWait 并异步处理打开的请求 - 即有一个活动对象等待 CMsvOperation 完成。

CMsvOperationWait 只不过是让异步操作看起来同步的一种方便,我怀疑这是罪魁祸首 - 在下载->显示消息的情况下,有两个异步操作链接在一起。

First of all, I would retry removing CMsvOperationWait and deal with the open request asynchronously - i.e. have an active object waiting for the CMsvOperation to complete.

CMsvOperationWait is nothing more than a convenience to make an asynch operation appear synchronous and my suspicion is that this is culprit - in the case of download->show message, there are two asynch operations chained.

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