Deletion of the avatar looper/messagerunner in the destructor, moved a piece of code to set the status before to send the list.

This commit is contained in:
barrett 2012-03-20 02:13:35 +00:00
parent 0e3579b9c3
commit 5cf285f588
2 changed files with 13 additions and 10 deletions

View File

@ -186,12 +186,12 @@ MSNP::MSNP()
fCachePath(""), fCachePath(""),
fRunnerTime(40000000) fRunnerTime(40000000)
{ {
AvatarLooper* looper = new AvatarLooper(this); AvatarLooper* fAvatarLooper = new AvatarLooper(this);
BMessenger* mess = new BMessenger(NULL, looper); BMessenger* mess = new BMessenger(NULL, fAvatarLooper);
if (!mess->IsValid()) { if (!mess->IsValid()) {
printf("Avatar BMessenger error\n"); printf("Avatar BMessenger error\n");
} }
looper->Run(); fAvatarLooper->Run();
fAvatarRunner = new BMessageRunner(*mess, new BMessage(kAvatarCheckMessage), fRunnerTime); fAvatarRunner = new BMessageRunner(*mess, new BMessage(kAvatarCheckMessage), fRunnerTime);
if (fAvatarRunner->InitCheck() != B_OK) { if (fAvatarRunner->InitCheck() != B_OK) {
printf("Avatar MessageRunner error %s\n", printf("Avatar MessageRunner error %s\n",
@ -247,7 +247,8 @@ status_t
MSNP::Shutdown() MSNP::Shutdown()
{ {
// LogOut(); // LogOut();
delete fAvatarRunner;
delete fAvatarLooper;
return B_OK; return B_OK;
} }
@ -920,6 +921,13 @@ void MSNP::gotOIMList(MSN::NotificationServerConnection * conn, std::vector<MSN:
void MSNP::connectionReady(MSN::Connection * conn) void MSNP::connectionReady(MSN::Connection * conn)
{ {
fLogged = true; fLogged = true;
BMessage msg(IM_MESSAGE);
msg.AddInt32("im_what", IM_OWN_STATUS_SET);
msg.AddString("protocol", kProtocolSignature);
msg.AddInt32("status", CAYA_ONLINE);
fServerMsgr->SendMessage(&msg);
BMessage serverBased(IM_MESSAGE); BMessage serverBased(IM_MESSAGE);
serverBased.AddInt32("im_what", IM_CONTACT_LIST); serverBased.AddInt32("im_what", IM_CONTACT_LIST);
serverBased.AddString("protocol", kProtocolSignature); serverBased.AddString("protocol", kProtocolSignature);
@ -941,12 +949,6 @@ void MSNP::connectionReady(MSN::Connection * conn)
} }
} }
BMessage msg(IM_MESSAGE);
msg.AddInt32("im_what", IM_OWN_STATUS_SET);
msg.AddString("protocol", kProtocolSignature);
msg.AddInt32("status", CAYA_ONLINE);
fServerMsgr->SendMessage(&msg);
BString content(fUsername.c_str()); BString content(fUsername.c_str());
content << " has logged in!"; content << " has logged in!";
_Notify(B_INFORMATION_NOTIFICATION, "Connected", _Notify(B_INFORMATION_NOTIFICATION, "Connected",

View File

@ -95,6 +95,7 @@ private:
unsigned int fID; unsigned int fID;
BMessageRunner* fAvatarRunner; BMessageRunner* fAvatarRunner;
BMessageRunner* fAvatarLooper;
bigtime_t fRunnerTime; bigtime_t fRunnerTime;
CayaProtocolMessengerInterface* fServerMsgr; CayaProtocolMessengerInterface* fServerMsgr;