2 # show recently used groups
14 return (1, "try sh/chatgroups xxx where xxx is the number of chat messages to search.");
22 my @chatlog = DXLog::print(undef, $to, $main::systime, 'chat', undef);
24 my ($time, $call, $group);
41 @chatlog = reverse @chatlog;
42 foreach $row(@chatlog) {
43 ($time, $call, $group) = ($row =~ m/^(\S+) (\S+) -> (\S+) /o);
44 if (!exists $g->{$group}) {
45 $time =~ m/^(\d\d)(\w{3})(\d{4})\@(\d\d):(\d\d):(\d\d)/o;
46 $g->{$group}->{sec} = timegm($6, $5, $4, $1, $month{$2}, $3-1900);
48 $g->{$group}->{last} = $time;
49 push @{ $g->{$group}->{calls} }, $call;
52 foreach (@{ $g->{$group}->{calls} }) {
58 push @{ $g->{$group}->{calls} }, $call unless $found;
60 $g->{$group}->{msgcount}++;
63 push (@out, "Chat groups recently used:");
64 push (@out, "($to messages searched)");
65 push (@out, "--------------------------");
70 foreach $group (sort { $g->{$b}->{sec} <=> $g->{$a}->{sec} } keys %$g) {
71 @calls = sort( @{ $g->{$group}->{calls} } );
72 $mtext = " " . $g->{$group}->{msgcount} . " messages by:";
73 push (@out, "$group: Last active " . $g->{$group}->{last});
75 push (@out, "$mtext @calls");
77 foreach $call(@calls) {
81 push (@out, "$mtext @l");
89 push (@out, " @l") if (@l);