Implemented IM_PROGRESS, closes #479.

This commit is contained in:
plfiorini 2010-05-30 12:17:32 +00:00
parent f560943e6f
commit d503077fac

View File

@ -11,7 +11,9 @@
#include <Application.h> #include <Application.h>
#include <Debug.h> #include <Debug.h>
#include <Entry.h> #include <Entry.h>
#include <Notification.h>
#include <Path.h> #include <Path.h>
#include <Roster.h>
#include <TranslationUtils.h> #include <TranslationUtils.h>
#include "Account.h" #include "Account.h"
@ -294,6 +296,34 @@ Server::ImMessage(BMessage* msg)
result = B_SKIP_MESSAGE; result = B_SKIP_MESSAGE;
break; break;
} }
case IM_PROGRESS:
{
const char* protocol = NULL;
const char* title = NULL;
const char* message = NULL;
float progress = 0.0f;
if (msg->FindString("protocol", &protocol) != B_OK)
return result;
if (msg->FindString("title", &title) != B_OK)
return result;
if (msg->FindString("message", &message) != B_OK)
return result;
if (msg->FindFloat("progress", &progress) != B_OK)
return result;
CayaProtocolAddOn* addOn
= ProtocolManager::Get()->ProtocolAddOn(protocol);
BNotification notification(B_PROGRESS_NOTIFICATION);
notification.SetApplication("Caya");
notification.SetTitle(title);
notification.SetIcon(addOn->Icon());
notification.SetContent(message);
notification.SetProgress(progress);
be_roster->Notify(notification);
break;
}
default: default:
break; break;
} }