2 # show recently used groups
19 return (1, "try sh/chatgroups xxx where xxx is the number of chat messages to search.");
23 if ($self->{_nospawn} || $main::is_win == 1) {
24 return (1, doit($self, DXLog::print(undef, $to, $main::systime, 'chat', undef)));
26 return (1, $self->spawn_cmd("show/groups $to", \&DXLog::print, args => [0, $to, $main::systime, 'chat', undef], cb => \&doit));
37 my ($time, $call, $group);
54 @chatlog = reverse @chatlog;
55 foreach $row(@chatlog) {
56 ($time, $call, $group) = ($row =~ m/^(\S+) (\S+) -> (\S+) /o);
57 if (!exists $g->{$group}) {
58 $time =~ m/^(\d\d)(\w{3})(\d{4})\@(\d\d):(\d\d):(\d\d)/o;
59 $g->{$group}->{sec} = timegm($6, $5, $4, $1, $month{$2}, $3-1900);
61 $g->{$group}->{last} = $time;
62 push @{ $g->{$group}->{calls} }, $call;
66 foreach (@{ $g->{$group}->{calls} }) {
72 push @{ $g->{$group}->{calls} }, $call unless $found;
74 $g->{$group}->{msgcount}++;
77 push (@out, "Chat groups recently used:");
78 push (@out, "($to messages searched)");
79 push (@out, "--------------------------");
84 foreach $group (sort { $g->{$b}->{sec} <=> $g->{$a}->{sec} } keys %$g) {
85 @calls = sort( @{ $g->{$group}->{calls} } );
86 $mtext = " " . $g->{$group}->{msgcount} . " messages by:";
87 push (@out, "$group: Last active " . $g->{$group}->{last});
89 push (@out, "$mtext @calls");
92 foreach $call(@calls) {
96 push (@out, "$mtext @l");
105 push (@out, " @l") if (@l);