Changeset 895 for trunk/dll/newview.c
- Timestamp:
- Dec 30, 2007, 12:46:11 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/newview.c
r894 r895 28 28 17 Dec 07 GKY Make WPURLDEFAULTSETTINGS the fall back for ftp/httprun 29 29 28 Dec 07 GKY Add mailrun to allow mailto by clicking on an email address in the viewer 30 29 Dec 07 GKY Formated email address using "<mailto:" 30 31 31 32 ***********************************************************************/ … … 78 79 #define COLORS_MAILFORE 13 79 80 80 static LONG Colors[COLORS_MAX] = { COLR_WHITE, COLR_DARKGRAY, 81 static LONG Colors[COLORS_MAX] = { 82 COLR_WHITE, COLR_DARKGRAY, 81 83 COLR_PALEGRAY, COLR_BLACK, 82 84 COLR_BLACK, COLR_RED, … … 91 93 typedef struct 92 94 { 93 USHORT size; 94 USHORT flags; 95 USHORT cliptype; 96 CHAR filename[CCHMAXPATH]; 95 FATTRS fattrs; 96 LONG colors[COLORS_MAX]; 97 97 CHAR *text; 98 98 CHAR **lines, *markedlines; … … 100 100 ULONG textsize, numlines, topline, cursored, selected, numalloc, multiplier, 101 101 lastselected, found; 102 CHAR stopflag, busy;103 102 LONG oldwidth, lastdirection, lMaxAscender, lMaxDescender, lMaxHeight, 104 103 maxx, horzscroll; 105 BOOL hex, mousecaptured, sensitive, dummy, literalsearch, clientfocused,106 alsoselect, wrapon, relining, httpin, ftpin, mailin, ignorehttp, ignoreftp,107 ignoremail, needrefreshing;108 104 HMTX ScanSem; 109 105 HWND hvscroll, hwndMenu, hwndStatus1, hwndStatus2, hwndStatus3, hwndRestore, 110 106 hwndPopup, hwndListbox, hwndFrame, hwndDrag, hwndParent, hhscroll; 111 107 HPS hps; 112 FATTRS fattrs; 113 LONG colors[COLORS_MAX]; 108 USHORT size; 109 USHORT flags; 110 USHORT cliptype; 111 CHAR filename[CCHMAXPATH]; 112 CHAR stopflag, busy; 113 BOOL hex, mousecaptured, sensitive, dummy, literalsearch, clientfocused, 114 alsoselect, wrapon, relining, httpin, ftpin, mailin, ignorehttp, ignoreftp, 115 ignoremail, needrefreshing; 114 116 } 115 117 VIEWDATA; … … 117 119 typedef struct 118 120 { 121 ULONG len; 122 CHAR *line; 119 123 USHORT size; 120 124 USHORT dummy; 121 ULONG len;122 CHAR *line;123 125 CHAR url[SEARCHSTRINGLEN]; 124 126 } … … 137 139 138 140 // mailstr checks for a designated character in a string then cuts the string 139 //to the first word that contains the character 140 141 CHAR *mailstr(CHAR * t, CHAR *s, LONG lens)141 //to the first word that contains the character then prepends <mailto: and appends > 142 143 CHAR *mailstr(CHAR *pszSrc, CHAR *pszFindChar, LONG StrLens) 142 144 { 143 CHAR *pp; 144 CHAR *test = t; 145 146 if (!strnstr(test, s, lens)) 145 CHAR *pszCharCounter; 146 CHAR *pszTestStr = pszSrc; 147 CHAR szMailTo[1024] = "<mailto:"; 148 CHAR szMailEnd[] = ">"; 149 150 if (!strnstr(pszTestStr, pszFindChar, StrLens)) 147 151 return NULL; 148 bstripcr(t); 149 if (!strstr(t, " ")) 150 return t; 151 while (strchr(t, ' ') < strchr(t, (CHAR) s)){ 152 pp = t; 153 while (*pp && *pp != ' '){ 154 *pp = ' '; 155 pp++; 156 } 157 lstrip(t); 152 bstripcr(pszSrc); 153 remove_first_occurence_of_character("\r", pszSrc); 154 remove_first_occurence_of_character("\n", pszSrc); 155 if (!strstr(pszSrc, " ")){ 156 if (!stristr(pszSrc, "<mailto:")) { 157 strip_lead_char("<", pszSrc); 158 strip_trail_char(">", pszSrc); 159 strcat(szMailTo, pszSrc); 160 strcat(szMailTo, szMailEnd); 161 pszSrc = szMailTo; 162 return pszSrc; 163 } 164 else { 165 return pszSrc; 166 } 158 167 } 159 pp = t; 160 while (*pp && *pp != ' ' && *pp != '\r' && *pp != '\n' && 161 *pp != '\"') 162 pp++; 163 *pp = 0; 164 strip_lead_char(t, "<"); 165 strip_trail_char(t, ">"); 166 return t; 168 while (strchr(pszSrc, ' ') < strchr(pszSrc, *pszFindChar)){ 169 pszCharCounter = pszSrc; 170 while (*pszCharCounter && *pszCharCounter != ' '){ 171 *pszCharCounter = ' '; 172 pszCharCounter++; 173 } 174 lstrip(pszSrc); 175 } 176 pszCharCounter = pszSrc; 177 while (*pszCharCounter && *pszCharCounter != ' ' && *pszCharCounter != '\r' && 178 *pszCharCounter != '\n' && *pszCharCounter != '\"') 179 pszCharCounter++; 180 *pszCharCounter = 0; 181 if (!stristr(pszSrc, "<mailto:")) { 182 strip_lead_char("<", pszSrc); 183 strip_trail_char(">", pszSrc); 184 strcat(szMailTo, pszSrc); 185 strcat(szMailTo, szMailEnd); 186 pszSrc = szMailTo; 187 return pszSrc; 188 } 189 else { 190 return pszSrc; 191 } 167 192 } 168 193 … … 216 241 p = urld->line; 217 242 if (mailstr(p, "@", e - p)) { 218 strcpy(urld->url, p); 243 pp = mailstr(p, "@", e - p); 244 strcpy(urld->url, pp); 219 245 WinSendDlgItemMsg(hwnd, URL_LISTBOX, LM_INSERTITEM, 220 246 MPFROM2SHORT(LIT_END, 0), MPFROMP(urld->url));
Note:
See TracChangeset
for help on using the changeset viewer.