Changeset ab31454
- Timestamp:
- Jun 25, 2003, 9:34:51 AM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- ceb8cfb
- Parents:
- ae0a5fc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
rae0a5fc rab31454 23 23 Removed libfaim/config.log from CVS 24 24 Fixed some easy fixed-length buffers 25 Wordwrap incoming AIM messages. 25 26 26 27 2.0.4-pre-1 -
aim.c
rb2b0773 rab31454 1197 1197 int clienttype = AIM_CLIENTTYPE_UNKNOWN; 1198 1198 owl_message *m; 1199 char *stripmsg, *nz_screenname ;1199 char *stripmsg, *nz_screenname, *wrapmsg; 1200 1200 char realmsg[8192+1] = {""}; 1201 1201 clienttype = aim_fingerprintclient(args->features, args->featureslen); … … 1273 1273 /* create a message, and put it on the message queue */ 1274 1274 stripmsg=owl_text_htmlstrip(realmsg); 1275 wrapmsg=owl_text_wordwrap(stripmsg, 70); 1275 1276 nz_screenname=owl_aim_normalize_screenname(userinfo->sn); 1276 1277 m=owl_malloc(sizeof(owl_message)); … … 1278 1279 nz_screenname, 1279 1280 owl_global_get_aim_screenname(&g), 1280 stripmsg,1281 wrapmsg, 1281 1282 OWL_MESSAGE_DIRECTION_IN, 1282 1283 0); 1283 1284 owl_global_messagequeue_addmsg(&g, m); 1284 1285 owl_free(stripmsg); 1286 owl_free(wrapmsg); 1285 1287 owl_free(nz_screenname); 1286 1288 -
text.c
rdafd919 rab31454 6 6 static const char fileIdent[] = "$Id$"; 7 7 8 int owl_text_truncate_lines(char *out, char *in, int aline, int lines) { 8 int owl_text_truncate_lines(char *out, char *in, int aline, int lines) 9 { 9 10 /* start with line aline (where the first line is 1) and print 10 11 * 'lines' lines … … 43 44 } 44 45 45 void owl_text_truncate_cols(char *out, char *in, int acol, int bcol) { 46 void owl_text_truncate_cols(char *out, char *in, int acol, int bcol) 47 { 46 48 char *ptr1, *ptr2, *tmpbuff, *last; 47 49 int len; … … 89 91 90 92 91 void owl_text_indent(char *out, char *in, int n) { 93 void owl_text_indent(char *out, char *in, int n) 94 { 92 95 char *ptr1, *ptr2, *last; 93 96 int i; … … 113 116 114 117 115 int owl_text_num_lines(char *in) { 118 int owl_text_num_lines(char *in) 119 { 116 120 int lines, i; 117 121 … … 129 133 130 134 /* caller must free the return */ 131 char *owl_text_htmlstrip(char *in) { 135 char *owl_text_htmlstrip(char *in) 136 { 132 137 char *ptr1, *end, *ptr2, *ptr3, *out; 133 138 … … 186 191 return(out); 187 192 } 193 194 /* caller must free the return */ 195 char *owl_text_wordwrap(char *in, int col) 196 { 197 char *out; 198 int cur, lastspace, len, lastnewline; 199 200 out=owl_strdup(in); 201 len=strlen(in); 202 cur=0; 203 lastspace=-1; 204 lastnewline=-1; 205 206 while (cur<(len-1)) { 207 if (out[cur]==' ') { 208 lastspace=cur; 209 cur++; 210 continue; 211 } else if (out[cur]=='\n') { 212 lastnewline=cur; 213 cur++; 214 continue; 215 } 216 217 /* do we need to wrap? */ 218 if ( (cur-(lastnewline+1)) > col ) { 219 if (lastspace==-1 || 220 (lastnewline>0 && (lastspace<=lastnewline))) { 221 /* we can't help, sorry */ 222 cur++; 223 continue; 224 } 225 226 /* turn the last space into a newline */ 227 out[lastspace]='\n'; 228 lastnewline=lastspace; 229 lastspace=-1; 230 cur++; 231 continue; 232 } 233 234 cur++; 235 continue; 236 } 237 return(out); 238 }
Note: See TracChangeset
for help on using the changeset viewer.