* More NULL checks for ContactLinkers.
* When you edit an account in the preferences dialog, this is not readded to the list anymore and so its login is not triggered another time.
This commit is contained in:
parent
9d075c91a0
commit
95657d52ba
|
@ -240,6 +240,7 @@ MainWindow::ImMessage(BMessage* msg)
|
|||
}
|
||||
case IM_AVATAR_SET:
|
||||
case IM_CONTACT_INFO:
|
||||
case IM_EXTENDED_CONTACT_INFO:
|
||||
{
|
||||
RosterItem* rosterItem
|
||||
= fServer->RosterItemForId(msg->FindString("id"));
|
||||
|
|
|
@ -219,15 +219,18 @@ Server::ImMessage(BMessage* msg)
|
|||
return B_SKIP_MESSAGE;
|
||||
|
||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||
if (linker) {
|
||||
if (!linker)
|
||||
break;
|
||||
|
||||
linker->SetNotifyStatus((CayaStatus)status);
|
||||
linker->SetNotifyPersonalStatus(msg->FindString("message"));
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IM_CONTACT_INFO:
|
||||
{
|
||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||
if (!linker)
|
||||
break;
|
||||
|
||||
const char* name = NULL;
|
||||
|
||||
|
@ -239,9 +242,11 @@ Server::ImMessage(BMessage* msg)
|
|||
case IM_EXTENDED_CONTACT_INFO:
|
||||
{
|
||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||
if (!linker)
|
||||
break;
|
||||
|
||||
if (linker->GetName().Length() > 0)
|
||||
return result;
|
||||
break;
|
||||
|
||||
const char* name = NULL;
|
||||
|
||||
|
@ -253,17 +258,16 @@ Server::ImMessage(BMessage* msg)
|
|||
case IM_AVATAR_SET:
|
||||
{
|
||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||
if (!linker)
|
||||
break;
|
||||
|
||||
entry_ref ref;
|
||||
if (linker) {
|
||||
|
||||
if (msg->FindRef("ref", &ref) == B_OK) {
|
||||
// BPath fullPath(&ref);
|
||||
// BBitmap* bitmap = ImageCache::GetImage(
|
||||
// BString(fullPath.Path()), BString(fullPath.Path()));
|
||||
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
|
||||
linker->SetNotifyAvatarBitmap(bitmap);
|
||||
} else
|
||||
linker->SetNotifyAvatarBitmap(NULL);
|
||||
}
|
||||
break;
|
||||
}
|
||||
case IM_SEND_MESSAGE: {
|
||||
|
|
|
@ -84,9 +84,10 @@ AccountDialog::MessageReceived(BMessage* msg)
|
|||
{
|
||||
switch (msg->what) {
|
||||
case kOK: {
|
||||
// Are we renaming settings?
|
||||
// Are we renaming or adding?
|
||||
bool renaming = ((fAccount.Length() > 0)
|
||||
&& (fAccount != fAccountName->Text()));
|
||||
bool adding = fAccount.Length() == 0;
|
||||
|
||||
// Rename account settings
|
||||
if (renaming) {
|
||||
|
@ -102,9 +103,9 @@ AccountDialog::MessageReceived(BMessage* msg)
|
|||
|
||||
// Save account settings
|
||||
if (fSettings->Save(fAccountName->Text(), fTop) == B_OK) {
|
||||
if (fTarget) {
|
||||
if (fTarget && (adding || renaming)) {
|
||||
BMessage* saveMsg = new BMessage(renaming
|
||||
? kAccountRenamed : kAccountSaved);
|
||||
? kAccountRenamed : kAccountAdded);
|
||||
saveMsg->AddPointer("settings", fSettings);
|
||||
if (renaming) {
|
||||
saveMsg->AddString("from", fAccount.String());
|
||||
|
|
|
@ -13,7 +13,7 @@ class BTextControl;
|
|||
class AccountView;
|
||||
class ProtocolSettings;
|
||||
|
||||
const uint32 kAccountSaved = 'acsd';
|
||||
const uint32 kAccountAdded = 'acad';
|
||||
const uint32 kAccountRenamed = 'acrd';
|
||||
|
||||
class AccountDialog : public BWindow {
|
||||
|
|
|
@ -164,7 +164,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
|||
}
|
||||
break;
|
||||
}
|
||||
case kAccountSaved:
|
||||
case kAccountAdded:
|
||||
case kAccountRenamed: {
|
||||
void* pointer = NULL;
|
||||
BString account;
|
||||
|
@ -172,7 +172,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
|||
|
||||
if (msg->FindPointer("settings", &pointer) != B_OK)
|
||||
return;
|
||||
if (msg->what == kAccountSaved) {
|
||||
if (msg->what == kAccountAdded) {
|
||||
if (msg->FindString("account", &account) != B_OK)
|
||||
return;
|
||||
} else {
|
||||
|
@ -187,7 +187,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
|||
if (!settings)
|
||||
return;
|
||||
|
||||
if (msg->what == kAccountSaved) {
|
||||
if (msg->what == kAccountAdded) {
|
||||
// Add list item
|
||||
AccountListItem* listItem
|
||||
= new AccountListItem(settings, account.String());
|
||||
|
|
Ŝarĝante…
Reference in New Issue