2 # show recently used groups
17 return (1, "try sh/chatgroups xxx where xxx is the number of chat messages to search.");
23 @out = $self->spawn_cmd("show/groups $to", \&DXLog::print,
24 args => [0, $to, $main::systime, 'chat', undef],
32 my ($time, $call, $group);
49 @chatlog = reverse @chatlog;
50 foreach $row(@chatlog) {
51 ($time, $call, $group) = ($row =~ m/^(\S+) (\S+) -> (\S+) /o);
52 if (!exists $g->{$group}) {
53 $time =~ m/^(\d\d)(\w{3})(\d{4})\@(\d\d):(\d\d):(\d\d)/o;
54 $g->{$group}->{sec} = timegm($6, $5, $4, $1, $month{$2}, $3-1900);
56 $g->{$group}->{last} = $time;
57 push @{ $g->{$group}->{calls} }, $call;
61 foreach (@{ $g->{$group}->{calls} }) {
67 push @{ $g->{$group}->{calls} }, $call unless $found;
69 $g->{$group}->{msgcount}++;
72 push (@out, "Chat groups recently used:");
73 push (@out, "($to messages searched)");
74 push (@out, "--------------------------");
79 foreach $group (sort { $g->{$b}->{sec} <=> $g->{$a}->{sec} } keys %$g) {
80 @calls = sort( @{ $g->{$group}->{calls} } );
81 $mtext = " " . $g->{$group}->{msgcount} . " messages by:";
82 push (@out, "$group: Last active " . $g->{$group}->{last});
84 push (@out, "$mtext @calls");
87 foreach $call(@calls) {
91 push (@out, "$mtext @l");
100 push (@out, " @l") if (@l);
109 # my @chatlog = DXLog::print(undef, $to, $main::systime, 'chat', undef);