[Tilt, TyTN II, MDA Vario III Android Development] ibanezbass:
first is sent, second are recieved. i sent the first then hit edit and sent it again but thats what it looks like on my phone.

also theres

... WHERE thread_id = new.thread_id AND (m_type=132 OR m_type=130 OR m_type=128) AND msg_box != 3 AND pdu.m_id is NULL) + (SELECT COUNT(DISTINCT pdu.m_id) FROM pdu LEFT JOIN threads ON threads._id = thread_id WHERE thread_id = new.thread_id AND (m_type=132 OR m_type=130 OR m_type=128) AND msg_box != 3 AND pdu.m_id is not NULL) WHERE threads._id = new.thread_id; UPDATE threads SET read = CASE (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = threads._id) WHEN 0 THEN 1 ELSE 0 END WHERE threads._id = new.thread_id; UPDATE threads SET unread_count = (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = threads._id) + (SELECT COUNT(*) FROM pdu WHERE read = 0 AND thread_id = threads._id) WHERE threads._id = new.thread_id; END;
CREATE TRIGGER pdu_update_thread_read_on_update AFTER UPDATE OF read ON pdu WHEN new.m_type=132 OR new.m_type=130 OR new.m_type=128 BEGIN UPDATE threads SET read = CASE (SELECT COUNT(*) FROM pdu WHERE read = 0 AND (m_type=132 OR m_type=130) AND thread_id = threads._id) WHEN 0 THEN 1 ELSE 0 END WHERE threads._id = new.thread_id; UPDATE threads SET unread_count = (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = threads._id) + (SELECT COUNT(*) FROM pdu WHERE read = 0 AND thread_id = threads._id) WHERE threads._id = new.thread_id; END;
CREATE TRIGGER sms_update_thread_read_on_update AFTER UPDATE OF read ON sms BEGIN UPDATE threads SET read = CASE (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = threads._id) WHEN 0 THEN 1 ELSE 0 END WHERE threads._id = new.thread_id; UPDATE threads SET unread_count = (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = threads._id) + (SELECT COUNT(*) FROM pdu WHERE read = 0 AND thread_id = threads._id) WHERE threads._id = new.thread_id; END;
CREATE TRIGGER sms_update_thread_on_delete AFTER DELETE ON sms BEGIN UPDATE threads SET date = (strftime('%s','now') * 1000) WHERE threads._id = old.thread_id; UPDATE threads SET message_count = (SELECT COUNT(sms._id) FROM sms LEFT JOIN threads ON threads._id = thread_id WHERE thread_id = old.thread_id AND sms.type != 3) + (SELECT COUNT(pdu._id) FROM pdu LEFT JOIN threads ON threads._id = thread_id WHERE thread_id = old.thread_id AND (m_type=132 OR m_type=130 OR m_type=128) AND msg_box != 3) WHERE threads._id = old.thread_id; UPDATE threads SET unread_count = (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = old.thread_id) + (SELECT COUNT(*) FROM pdu WHERE read = 0 AND thread_id = old.thread_id) WHERE threads._id = old.thread_id; UPDATE threads SET snippet = (SELECT snippet FROM (SELECT date * 1000 AS date, sub AS snippet, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, body AS snippet, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; UPDATE threads SET snippet_cs = (SELECT snippet_cs FROM (SELECT date * 1000 AS date, sub_cs AS snippet_cs, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, 0 AS snippet_cs, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; UPDATE threads SET priority = (SELECT priority FROM (SELECT date * 1000 AS date, pri AS priority, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, 0 AS priority, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; END;
CREATE TRIGGER pdu_update_thread_on_delete AFTER DELETE ON pdu BEGIN UPDATE threads SET date = (strftime('%s','now') * 1000) WHERE threads._id = old.thread_id; UPDATE threads SET message_count = (SELECT COUNT(sms._id) FROM sms LEFT JOIN threads ON threads._id = thread_id WHERE thread_id = old.thread_id AND sms.type != 3) + (SELECT COUNT(pdu._id) FROM pdu LEFT JOIN threads ON threads._id = thread_id WHERE thread_id = old.thread_id AND (m_type=132 OR m_type=130 OR m_type=128) AND msg_box != 3) WHERE threads._id = old.thread_id; UPDATE threads SET unread_count = (SELECT COUNT(*) FROM sms WHERE read = 0 AND thread_id = old.thread_id) + (SELECT COUNT(*) FROM pdu WHERE read = 0 AND thread_id = old.thread_id) WHERE threads._id = old.thread_id; UPDATE threads SET snippet = (SELECT snippet FROM (SELECT date * 1000 AS date, sub AS snippet, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, body AS snippet, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; UPDATE threads SET snippet_cs = (SELECT snippet_cs FROM (SELECT date * 1000 AS date, sub_cs AS snippet_cs, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, 0 AS snippet_cs, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; UPDATE threads SET priority = (SELECT priority FROM (SELECT date * 1000 AS date, pri AS priority, thread_id FROM pdu WHERE m_type=132 OR m_type=130 OR m_type=128 UNION SELECT date, 0 AS priority, thread_id FROM sms) WHERE thread_id = OLD.thread_id ORDER BY date DESC LIMIT 1) WHERE threads._id = OLD.thread_id; END;
CREATE TRIGGER delete_obsolete_threads_pdu AFTER DELETE ON pdu BEGIN DELETE FROM threads WHERE _id = old.thread_id AND _id NOT IN (SELECT thread_id FROM sms UNION SELECT thread_id from pdu); END;
CREATE TRIGGER delete_obsolete_threads_when_update_pdu AFTER UPDATE OF thread_id ON pdu WHEN old.thread_id != new.thread_id BEGIN DELETE FROM threads WHERE _id = old.thread_id AND _id NOT IN (SELECT thread_id FROM sms UNION SELECT thread_id from pdu); END;
CREATE TRIGGER delete_obsolete_threads_sms AFTER DELETE ON sms BEGIN DELETE FROM threads WHERE _id = old.thread_id AND _id NOT IN (SELECT thread_id FROM sms UNION SELECT thread_id from pdu); END;
CREATE TRIGGER insert_mms_pending_on_insert AFTER INSERT ON pdu WHEN new.m_type=130 OR new.m_type=135 BEGIN INSERT INTO pending_msgs (proto_type, msg_id, msg_type, err_type, err_code, retry_index, due_time) VALUES (1, new._id, new.m_type,0,0,0,0);END;
CREATE TRIGGER insert_mms_pending_on_update AFTER UPDATE ON pdu WHEN new.m_type=128 AND new.msg_box=4 AND old.msg_box!=4 BEGIN INSERT INTO pending_msgs (proto_type, msg_id, msg_type, err_type, err_code, retry_index, due_time) VALUES (1, new._id, new.m_type,0,0,0,0);END;
CREATE TRIGGER delete_mms_pending_on_update AFTER UPDATE ON pdu WHEN old.msg_box=4 AND new.msg_box!=4 BEGIN DELETE FROM pending_msgs WHERE msg_id=new._id; END;
CREATE TRIGGER delete_mms_pending_on_delete AFTER DELETE ON pdu BEGIN DELETE FROM pending_msgs WHERE msg_id=old._id; END;
CREATE TRIGGER update_threads_error_on_update_mms AFTER UPDATE OF err_type ON pending_msgs WHEN (OLD.err_type < 10 AND NEW.err_type >= 10) OR (OLD.err_type >= 10 AND NEW.err_type < 10) BEGIN UPDATE threads SET error = CASE WHEN NEW.err_type >= 10 THEN error + 1 ELSE error - 1 END WHERE _id = (SELECT DISTINCT thread_id FROM pdu WHERE _id = NEW.msg_id); END;
CREATE TRIGGER update_threads_error_on_delete_mms BEFORE DELETE ON pdu WHEN OLD._id IN (SELECT DISTINCT msg_id FROM pending_msgs WHERE err_type >= 10) BEGIN UPDATE threads SET error = error - 1 WHERE _id = OLD.thread_id; END;
CREATE TRIGGER update_threads_error_on_move_mms BEFORE UPDATE OF msg_box ON pdu WHEN (OLD.msg_box = 4 AND NEW.msg_box != 4) AND (OLD._id IN (SELECT DISTINCT msg_id FROM pending_msgs WHERE err_type >= 10)) BEGIN UPDATE threads SET error = error - 1 WHERE _id = OLD.thread_id; END;
CREATE TRIGGER update_threads_error_on_update_sms AFTER UPDATE OF type ON sms WHEN (OLD.type != 5 AND NEW.type = 5) OR (OLD.type = 5 AND NEW.type != 5) BEGIN UPDATE threads SET error = CASE WHEN NEW.type = 5 THEN error + 1 ELSE error - 1 END WHERE _id = NEW.thread_id; END;
CREATE TRIGGER update_threads_error_on_delete_sms AFTER DELETE ON sms WHEN (OLD.type = 5) BEGIN UPDATE threads SET error = error - 1 WHERE _id = OLD.thread_id; END;
CREATE TRIGGER part_cleanup DELETE ON pdu BEGIN DELETE FROM part WHERE mid=old._id;END;
CREATE TRIGGER addr_cleanup DELETE ON pdu BEGIN DELETE FROM addr WHERE msg_id=old._id;END;
CREATE TRIGGER cleanup_delivery_and_read_report AFTER DELETE ON pdu WHEN old.m_type=128 BEGIN DELETE FROM pdu WHERE (m_type=134 OR m_type=136) AND m_id=old.m_id; END;