edbrowse-dev - development list for edbrowse
 help / color / mirror / Atom feed
* [Edbrowse-dev] [PATCH] Unbrowse html email during reply.
@ 2011-04-13 21:26 Christopher Brannon
  0 siblings, 0 replies; only message in thread
From: Christopher Brannon @ 2011-04-13 21:26 UTC (permalink / raw)
  To: edbrowse-dev

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-04-13 21:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-13 21:26 [Edbrowse-dev] [PATCH] Unbrowse html email during reply Christopher Brannon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).