* 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_AVATAR_SET:
|
||||||
case IM_CONTACT_INFO:
|
case IM_CONTACT_INFO:
|
||||||
|
case IM_EXTENDED_CONTACT_INFO:
|
||||||
{
|
{
|
||||||
RosterItem* rosterItem
|
RosterItem* rosterItem
|
||||||
= fServer->RosterItemForId(msg->FindString("id"));
|
= fServer->RosterItemForId(msg->FindString("id"));
|
||||||
|
|
|
@ -219,15 +219,18 @@ Server::ImMessage(BMessage* msg)
|
||||||
return B_SKIP_MESSAGE;
|
return B_SKIP_MESSAGE;
|
||||||
|
|
||||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||||
if (linker) {
|
if (!linker)
|
||||||
linker->SetNotifyStatus((CayaStatus)status);
|
break;
|
||||||
linker->SetNotifyPersonalStatus(msg->FindString("message"));
|
|
||||||
}
|
linker->SetNotifyStatus((CayaStatus)status);
|
||||||
|
linker->SetNotifyPersonalStatus(msg->FindString("message"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IM_CONTACT_INFO:
|
case IM_CONTACT_INFO:
|
||||||
{
|
{
|
||||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||||
|
if (!linker)
|
||||||
|
break;
|
||||||
|
|
||||||
const char* name = NULL;
|
const char* name = NULL;
|
||||||
|
|
||||||
|
@ -239,9 +242,11 @@ Server::ImMessage(BMessage* msg)
|
||||||
case IM_EXTENDED_CONTACT_INFO:
|
case IM_EXTENDED_CONTACT_INFO:
|
||||||
{
|
{
|
||||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||||
|
if (!linker)
|
||||||
|
break;
|
||||||
|
|
||||||
if (linker->GetName().Length() > 0)
|
if (linker->GetName().Length() > 0)
|
||||||
return result;
|
break;
|
||||||
|
|
||||||
const char* name = NULL;
|
const char* name = NULL;
|
||||||
|
|
||||||
|
@ -253,17 +258,16 @@ Server::ImMessage(BMessage* msg)
|
||||||
case IM_AVATAR_SET:
|
case IM_AVATAR_SET:
|
||||||
{
|
{
|
||||||
ContactLinker* linker = _EnsureContactLinker(msg);
|
ContactLinker* linker = _EnsureContactLinker(msg);
|
||||||
|
if (!linker)
|
||||||
|
break;
|
||||||
|
|
||||||
entry_ref ref;
|
entry_ref ref;
|
||||||
if (linker) {
|
|
||||||
if (msg->FindRef("ref", &ref) == B_OK) {
|
if (msg->FindRef("ref", &ref) == B_OK) {
|
||||||
// BPath fullPath(&ref);
|
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
|
||||||
// BBitmap* bitmap = ImageCache::GetImage(
|
linker->SetNotifyAvatarBitmap(bitmap);
|
||||||
// BString(fullPath.Path()), BString(fullPath.Path()));
|
} else
|
||||||
BBitmap* bitmap = BTranslationUtils::GetBitmap(&ref);
|
linker->SetNotifyAvatarBitmap(NULL);
|
||||||
linker->SetNotifyAvatarBitmap(bitmap);
|
|
||||||
} else
|
|
||||||
linker->SetNotifyAvatarBitmap(NULL);
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case IM_SEND_MESSAGE: {
|
case IM_SEND_MESSAGE: {
|
||||||
|
|
|
@ -84,9 +84,10 @@ AccountDialog::MessageReceived(BMessage* msg)
|
||||||
{
|
{
|
||||||
switch (msg->what) {
|
switch (msg->what) {
|
||||||
case kOK: {
|
case kOK: {
|
||||||
// Are we renaming settings?
|
// Are we renaming or adding?
|
||||||
bool renaming = ((fAccount.Length() > 0)
|
bool renaming = ((fAccount.Length() > 0)
|
||||||
&& (fAccount != fAccountName->Text()));
|
&& (fAccount != fAccountName->Text()));
|
||||||
|
bool adding = fAccount.Length() == 0;
|
||||||
|
|
||||||
// Rename account settings
|
// Rename account settings
|
||||||
if (renaming) {
|
if (renaming) {
|
||||||
|
@ -102,9 +103,9 @@ AccountDialog::MessageReceived(BMessage* msg)
|
||||||
|
|
||||||
// Save account settings
|
// Save account settings
|
||||||
if (fSettings->Save(fAccountName->Text(), fTop) == B_OK) {
|
if (fSettings->Save(fAccountName->Text(), fTop) == B_OK) {
|
||||||
if (fTarget) {
|
if (fTarget && (adding || renaming)) {
|
||||||
BMessage* saveMsg = new BMessage(renaming
|
BMessage* saveMsg = new BMessage(renaming
|
||||||
? kAccountRenamed : kAccountSaved);
|
? kAccountRenamed : kAccountAdded);
|
||||||
saveMsg->AddPointer("settings", fSettings);
|
saveMsg->AddPointer("settings", fSettings);
|
||||||
if (renaming) {
|
if (renaming) {
|
||||||
saveMsg->AddString("from", fAccount.String());
|
saveMsg->AddString("from", fAccount.String());
|
||||||
|
|
|
@ -13,8 +13,8 @@ class BTextControl;
|
||||||
class AccountView;
|
class AccountView;
|
||||||
class ProtocolSettings;
|
class ProtocolSettings;
|
||||||
|
|
||||||
const uint32 kAccountSaved = 'acsd';
|
const uint32 kAccountAdded = 'acad';
|
||||||
const uint32 kAccountRenamed = 'acrd';
|
const uint32 kAccountRenamed = 'acrd';
|
||||||
|
|
||||||
class AccountDialog : public BWindow {
|
class AccountDialog : public BWindow {
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -164,7 +164,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case kAccountSaved:
|
case kAccountAdded:
|
||||||
case kAccountRenamed: {
|
case kAccountRenamed: {
|
||||||
void* pointer = NULL;
|
void* pointer = NULL;
|
||||||
BString account;
|
BString account;
|
||||||
|
@ -172,7 +172,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
||||||
|
|
||||||
if (msg->FindPointer("settings", &pointer) != B_OK)
|
if (msg->FindPointer("settings", &pointer) != B_OK)
|
||||||
return;
|
return;
|
||||||
if (msg->what == kAccountSaved) {
|
if (msg->what == kAccountAdded) {
|
||||||
if (msg->FindString("account", &account) != B_OK)
|
if (msg->FindString("account", &account) != B_OK)
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
|
@ -187,7 +187,7 @@ PreferencesAccounts::MessageReceived(BMessage* msg)
|
||||||
if (!settings)
|
if (!settings)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (msg->what == kAccountSaved) {
|
if (msg->what == kAccountAdded) {
|
||||||
// Add list item
|
// Add list item
|
||||||
AccountListItem* listItem
|
AccountListItem* listItem
|
||||||
= new AccountListItem(settings, account.String());
|
= new AccountListItem(settings, account.String());
|
||||||
|
|
Ŝarĝante…
Reference in New Issue