- my $from = $thing->{user} if Route::Node::get($thing->{user});
- $from ||= $thing->{origin};
- my $to = $thing->{touser} if Route::Node::get($thing->{touser});
- $to ||= $thing->{group};
-
+ my ($from, $to);
+ if ($thing->{out}) {
+ $from = $thing->{o};
+ $from ||= $thing->{user} unless Route::User::get($thing->{user});
+ $from ||= $thing->{origin};
+ $to = $thing->{touser} unless Route::User::get($thing->{touser});
+ $to ||= $thing->{group};
+ } else {
+ $from ||= $thing->{user} unless Route::User::get($thing->{user});
+ $from ||= $thing->{origin};
+ $to = $thing->{o};
+ $to ||= $thing->{touser} unless Route::User::get($thing->{touser});
+ $to ||= $thing->{group};
+ }