My favorites | Sign in
Project Home Downloads Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 14: NetNewsWire Support
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Oct 2008


 
Reported by del...@gmail.com, Oct 6, 2008
sqlite3 /private/var/mobile/Applications/EC683CFC-45ED-4B19-AF28-
EBEDD9F59B86/Documents/Feeds.sqlite3 'select count(*) from newsItemStatus where read=0;'
Oct 6, 2008
Project Member #1 zcsizma...@gmail.com
Will be added to 0.2.8
Oct 6, 2008
#2 del...@gmail.com
great! you can use this icons if you don't start charging for the .app :)

http://foo.xpto.org/Default_NNWT.png http://foo.xpto.org/FSO_NNWT.png


this is the last version of the re-written daemon.sh
#!/bin/bash

# Hacked by Delfim Machado dbcm@profundos.org
# Added suport for SwirlyMMS
# Cleaned this issue (SQL error: database is locked)


# TODO:
# dont exec always sbar with the same value (check)

# NNW icons powered by Diogo Matias

# Erica utilities
SBAR=/usr/bin/sbar
PLUTIL=/usr/bin/plutil

DEBUG=$1

# generic function to test all services, easy to add more :)
function check() {
    SN_KEY=$1
    # SN stands for StatusNotifier
    SN_SERVICE=$2
    # for the record, this defaults the params to 0 and add both params, necessary for calls and voicemails
    SN_CMD=$((${3-0}+${4-0}))
    
    # more verbose to check if everything is OK
    [ ! -z "$DEBUG" ] && echo "Checking $SN_SERVICE $2+$3=$SN_CMD"
    
    if [ ! -z "$SN_CMD" ]; then
        if [ "$SN_CMD" -gt 0 ]; then
            if [ "${SN_CONTROL[$SN_KEY]}" != "ON" ]; then
                $SBAR -s $SN_SERVICE
                SN_CONTROL[$SN_KEY]="ON"
            else
                [ ! -z "$DEBUG" ] && echo "ALREADY ON! $SN_SERVICE"
            fi
        else
            if [ "${SN_CONTROL[$SN_KEY]}" != "OFF" ]; then
                $SBAR -r $SN_SERVICE
                SN_CONTROL[$SN_KEY]="OFF"
            else
                [ ! -z "$DEBUG" ] && echo "ALREADY OFF! $SN_SERVICE"
            fi
        fi
    fi
}

while :; do

# check for new SMSs
check 1 SMST `sqlite3 /var/mobile/Library/SMS/sms.db 'select count(*) from message where flags=0;'`

# check for lost calls or new voicemails
LAST=`$PLUTIL -v RecentsLastViewedDate /var/mobile/Library/Preferences/com.apple.mobilephone.plist 
2>&1 | awk '{printf "%.6f", $4 + 978307200;}'`
check 2 CALLT `sqlite3 /var/mobile/Library/CallHistory/call_history.db "select count(*) from call where flags 
== 4 and duration == 0 and date > $LAST;"` \
            `sqlite3 /var/mobile/Library/Voicemail/voicemail.db "select count(*) from voicemail where flags & 1 = 
0;"`

# check for new mails
check 3 EMAILT `sqlite3 /var/mobile/Library/Mail/Envelope\ Index "select count(*) from messages where 
read='0';"`

# check for new MMSs, integration with SwirlyMMS
check 4 MMST `ls /private/var/root/Library/MMSApp/Folders/Inbox/*.notif 2>/dev/null | wc -l`

# check for new messages in NetNewsWire
# TODO: detect where is NNW installed...
check 5 NNWT `sqlite3 /private/var/mobile/Applications/EC683CFC-45ED-4B19-AF28-
EBEDD9F59B86/Documents/Feeds.sqlite3 'select count(*) from newsItemStatus where read=0;'`

# check if we are in a PTWIFI kid garden :)
# to check if /private/var/preferences/SystemConfiguration/com.apple.wifi.plist
#check 6 PTWIFIT `grep -c ZeeBipPlace /private/var/preferences/SystemConfiguration/com.apple.wifi.plist`
#check 7 LockIcon `grep -c PT-WIFI /private/var/preferences/SystemConfiguration/com.apple.wifi.plist`
# are we in PTWIFI
#$SBAR -r 0_AirPort
# are we logging in
#$SBAR -r 1_AirPort
# are we logged in
#$SBAR -r 2_AirPort


[ ! -z "$DEBUG" ] && echo ALL SN_CONTROL ${SN_CONTROL[@]:0}

# Delay (1 min)
sleep 60


done

Oct 6, 2008
Project Member #3 zcsizma...@gmail.com
0.2.6 is not script based any more :)
Oct 7, 2008
Project Member #4 zcsizma...@gmail.com
(No comment was entered for this change.)
Status: Fixed

Powered by Google Project Hosting