Changeset 275 for scripts


Ignore:
Timestamp:
May 17, 2016, 11:01:47 AM (9 years ago)
Author:
alloc
Message:

v101: Fixed log-monitor for chat

Location:
scripts/usr/local/lib/7dtd
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • scripts/usr/local/lib/7dtd/VERSION

    r265 r275  
    1 Version: 100
    2 Release: 2016-04-20
     1Version: 101
     2Release: 2016-05-17
    33
  • scripts/usr/local/lib/7dtd/monitor-log.sh

    r259 r275  
    5959
    6060handleChat() {
    61         echo "$(timestamp): $1" >> $CHATLOG
     61        echo "$(timestamp): $1: $2" >> $CHATLOG
    6262       
    6363        for H in $(getHooksFor chat $INSTANCE); do
     64                $H $INSTANCE "$1" "$2"
     65        done
     66}
     67
     68handleGmsg() {
     69        echo "$(timestamp): GMSG: $1" >> $CHATLOG
     70       
     71        for H in $(getHooksFor gmsg $INSTANCE); do
    6472                $H $INSTANCE "$1"
    6573        done
     
    134142                if [ -n "$(echo "$line" | grep -E '^GMSG: .+')" ]; then
    135143                        msg=$(expr "$line" : 'GMSG: \(.*\)$')
    136                         handleChat "$msg"
     144                        handleGmsg "$msg"
    137145                        unset msg
     146                else
     147                #Chat: 'name': .*$
     148                if [ -n "$(echo "$line" | grep -E '^Chat: .+')" ]; then
     149                        name=$(expr "$line" : "Chat: '\(.*\)': .*$")
     150                        msg=$(expr "$line" : "Chat: '.*': \(.*\)$")
     151                        handleChat "$name" "$msg"
     152                        unset name msg
    138153                else
    139154                #Executing command ".*" from client ".*"$
     
    155170                fi
    156171                fi
     172                fi
    157173        fi
    158174done
Note: See TracChangeset for help on using the changeset viewer.