From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from homiemail-a75.g.dreamhost.com (caiajhbdcagg.dreamhost.com [208.97.132.66]) by che.dreamhost.com (Postfix) with ESMTP id CAB6CFE9A for ; Wed, 13 Apr 2011 14:26:45 -0700 (PDT) Received: from homiemail-a75.g.dreamhost.com (localhost [127.0.0.1]) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTP id 6B6555EC07C for ; Wed, 13 Apr 2011 14:26:15 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=the-brannons.com; h=from:to :subject:date:message-id; q=dns; s=the-brannons.com; b=wKcrQhQs7 IdZ5vEOrVmvP2GayDDbTxMT+vRrpL2vdHLsYTn6ed2CiWkJ6W5xs6t6EHpQPBmbV NmLTfkWEYiHEzZA8/tw0/SyP/q5Oj415EleWZTLZFPce5Iics0SXTh8DvbwSBWwp n5MV+RWlssol8Lfll7DfUIQi7LR3FU6i9M= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=the-brannons.com; h=from :to:subject:date:message-id; s=the-brannons.com; bh=WPaITGBMdT7r oG8d8/5BpZgO8X8=; b=RY/WKBRz6cnq7WTcEqFMlebICyVds8xgAJ8Sb98sulO/ g25CnRCSqxE4nBoIHR1I/rzMc3NR38WeBeHiaQcQ0lS2Mz5KtAbEm2gtJbf7QJ7g lyxjkMr+6PtjrtmO6O+OxMNhK54BYci1en5WQzNsPu7IrokxLNRjbcBqQt0sj84= Received: from localhost (ip68-12-125-253.ok.ok.cox.net [68.12.125.253]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) (Authenticated sender: chris@the-brannons.com) by homiemail-a75.g.dreamhost.com (Postfix) with ESMTPSA id 282B45EC079 for ; Wed, 13 Apr 2011 14:26:15 -0700 (PDT) From: Christopher Brannon To: edbrowse-dev@lists.the-brannons.com Date: Wed, 13 Apr 2011 21:26:14 +0000 Message-Id: <1302729974-23664-1-git-send-email-chris@the-brannons.com> X-Mailer: git-send-email 1.7.3.4 Subject: [Edbrowse-dev] [PATCH] Unbrowse html email during reply. X-BeenThere: edbrowse-dev@lists.the-brannons.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Edbrowse Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 13 Apr 2011 21:26:46 -0000 edbrowse's internal html representation needs to be stripped from the message when replying. (This is a rough draft. I'm probably missing something. Works for me.) --- src/buffers.c | 26 ++++++++++++++++++++++++++ src/eb.h | 3 ++- src/eb.p | 1 + src/fetchmail.c | 3 +++ todo | 4 ---- 5 files changed, 32 insertions(+), 5 deletions(-) diff --git a/src/buffers.c b/src/buffers.c index b2149b3..8d0a464 100644 --- a/src/buffers.c +++ b/src/buffers.c @@ -3305,6 +3305,31 @@ balanceLine(const char *line) return false; } /* balanceLine */ +/* Unbrowse a region. Strip html tags. */ +bool +unbrowseRange(int start, int end) +{ + int i; + const char *t = NULL; + int idx; + const char *map = sessionList[context].lw->map; + + if(start < 0 || end < start || start > cw->dol || end > cw->dol) { + setError(MSG_BadRange); + return false; + } + + for(i = start; i <= end; i++) { + pst newln = fetchLine(i, 1); + t = map + i * LNWIDTH; + idx = atoi(t); + nzFree(textLines[idx]); + textLines[idx] = newln; + } + + return true; +} /* unbrowseRange */ + /* Unfold the buffer into one long, allocated string. */ bool unfoldBuffer(int cx, bool cr, char **data, int *len) @@ -4798,6 +4823,7 @@ browseCurrentBuffer(void) rawbuf = newbuf; rawsize = j; prepareForBrowse(rawbuf, rawsize); + cw->htmlMailMode = true; } } diff --git a/src/eb.h b/src/eb.h index 8345fd0..3e424d8 100644 --- a/src/eb.h +++ b/src/eb.h @@ -348,7 +348,8 @@ struct ebWindow { /* Two text modes; these are incompatible with binMode */ bool utf8Mode; bool iso8859Mode; - bool browseMode; /* browsing html */ + bool browseMode; /* browsing html or mail */ + bool htmlMailMode; bool changeMode; /* something has changed in this file */ bool dirMode; /* directory mode */ bool firstOpMode; /* first change has been made, undo is possible */ diff --git a/src/eb.p b/src/eb.p index 0e3ebfb..620f677 100644 --- a/src/eb.p +++ b/src/eb.p @@ -32,6 +32,7 @@ void gotoLocation(char *url, int delay, bool rf) ; bool addTextToBuffer(const pst inbuf, int length, int destl, bool onside) ; void delText(int start, int end) ; bool readFile(const char *filename, const char *post) ; +bool unbrowseRange(int first, int last) ; bool unfoldBuffer(int cx, bool cr, char **data, int *len) ; bool runCommand(const char *line) ; bool edbrowseCommand(const char *line, bool script) ; diff --git a/src/fetchmail.c b/src/fetchmail.c index 63c8d63..25606d7 100644 --- a/src/fetchmail.c +++ b/src/fetchmail.c @@ -2072,6 +2072,9 @@ setupReply(bool all) memcpy(q2, swap, LNWIDTH); } + if(cw->htmlMailMode) + unbrowseRange(j + 1, cw->dol); + if(!cw->mailInfo) { cw->browseMode = false; if(all) { diff --git a/todo b/todo index 8297d86..a7c16bd 100644 --- a/todo +++ b/todo @@ -77,10 +77,6 @@ This is bad htmo, but it happens. Are these methods not yet implemented? history.go history.back history.forward -re on an html email leaves the internal codes in -38{link0} -In other words it doesn't unbrowse. - imap support. If edbrowse is started via an ebpager symlink, it should run in -- 1.7.3.4