TTracker::RefsReceived(): Forward "be:*" message fields

In some cases /bin/open puts some additional fields in the
B_REFS_RECEIVED message, but those were completely ignored. This makes
opening paths with appended line/column numbers actually work as
expected.
This commit is contained in:
Ingo Weinhold 2013-05-11 03:44:41 +02:00
parent 7e3f7da70a
commit 09cbc86d0d

View File

@ -830,11 +830,39 @@ TTracker::RefsReceived(BMessage* message)
// copy over "Poses" messenger so that refs received
// recipients know where the open came from
BMessage* bundleThis = NULL;
BMessage stackBundleThis;
BMessenger messenger;
if (message->FindMessenger("TrackerViewToken", &messenger)
== B_OK) {
bundleThis = new BMessage();
bundleThis = &stackBundleThis;
bundleThis->AddMessenger("TrackerViewToken", messenger);
} else {
// copy over any "be:*" fields -- e.g. /bin/open may include
// "be:line" and "be:column"
for (int32 i = 0;; i++) {
char* name;
type_code type;
int32 count;
status_t error = message->GetInfo(B_ANY_TYPE, i, &name,
&type, &count);
if (error != B_OK)
break;
if (strncmp(name, "be:", 3) != 0)
continue;
for (int32 k = 0; k < count; k++) {
const void* data;
ssize_t size;
if (message->FindData(name, type, k, &data, &size)
!= B_OK) {
break;
}
if (stackBundleThis.AddData(name, type, data, size)
!= B_OK) {
break;
}
bundleThis = &stackBundleThis;
}
}
}
for (int32 index = 0; index < count; index++) {
@ -854,7 +882,6 @@ TTracker::RefsReceived(BMessage* message)
bundleThis);
}
delete bundleThis;
break;
}
}