Android and Linux

Sunday, February 6, 2011

temp post

#! /system/bin/sh
label="'YOURLABEL'"
yourmail="YOUREMAIL@gmail.com"

dir="/data/data/com.google.android.gm/databases/"

case "$1" in

name)
sqlite3 ${dir}mailstore.${yourmail}.db "select fromAddress from messages ORDER BY _id DESC LIMIT 1" | grep -o '"[^"]*"' | tr -d \";;

email)
sqlite3 ${dir}mailstore.${yourmail}.db "select fromAddress from messages ORDER BY _id DESC LIMIT 1" | grep -o \<.*\> | tr -d '<>';;

subject)
sqlite3 ${dir}mailstore.${yourmail}.db "select subject from messages ORDER BY _id DESC LIMIT 1";;

lname)
sqlite3 ${dir}mailstore.${yourmail}.db "select subject from messages,message_labels,labels where labels.name = "$label" and message_labels.labels_id = labels._id and messages.messageId = message_labels.message_messageId order by messages._id desc limit 1" | grep -o '"[^"]*"' | tr -d \";;

lemail)
sqlite3 ${dir}mailstore.${yourmail}.db "select fromAddress,subject from messages,message_labels,labels where labels.name = "$label" and message_labels.labels_id = labels._id and messages.messageId = message_labels.message_messageId order by messages._id desc limit 1" | grep -o \<.*\> | tr -d '<>';;

lsubject)
sqlite3 ${dir}mailstore.${yourmail}.db "select subject from messages,message_labels,labels where labels.name = "$label" and message_labels.labels_id = labels._id and messages.messageId = message_labels.message_messageId order by messages._id desc limit 1";;

labelall)
sqlite3 ${dir}mailstore.${yourmail}.db "select fromAddress,subject from messages,message_labels,labels where labels.name = "$label" and message_labels.labels_id = labels._id and messages.messageId = message_labels.message_messageId order by messages._id desc limit 1";;

*)
sqlite3 ${dir}mailstore.${yourmail}.db "select fromAddress,subject from messages ORDER BY _id DESC LIMIT 1";;

esac

Followers