Changeset b0430a6
- Timestamp:
- Dec 21, 2003, 8:19:14 PM (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:
- 2de4f20
- Parents:
- 72836b5
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r72836b5 rb0430a6 9 9 new attributes 'pseudo' 'logintty' and 'loginhost' 10 10 Don't print extra new lines in popless_file 11 New zephyr_get_field function 11 12 12 13 2.0.14 -
functions.c
r72836b5 rb0430a6 1479 1479 sprintf(buff, " Field %i : ", i+1); 1480 1480 1481 ptr=owl_zephyr_get_field(n, i+1 , &len);1482 if (!ptr) break;1481 ptr=owl_zephyr_get_field(n, i+1); 1482 len=strlen(ptr); 1483 1483 if (len<30) { 1484 1484 strncpy(tmpbuff, ptr, len); … … 1489 1489 strcat(tmpbuff, "..."); 1490 1490 } 1491 owl_free(ptr); 1491 1492 1492 1493 for (j=0; j<strlen(tmpbuff); j++) { -
message.c
r5a95b69 rb0430a6 714 714 { 715 715 struct hostent *hent; 716 int k, len;717 716 char *ptr, *tmp, *tmp2; 718 717 … … 755 754 if (!strcasecmp(n->z_class, "login") || !strcasecmp(n->z_class, OWL_WEBZEPHYR_CLASS)) { 756 755 if (!strcasecmp(n->z_opcode, "user_login") || !strcasecmp(n->z_opcode, "user_logout")) { 757 ptr=owl_zephyr_get_field(n, 1, &len); 758 tmp=owl_malloc(len+10); 759 strncpy(tmp, ptr, len); 760 tmp[len]='\0'; 756 tmp=owl_zephyr_get_field(n, 1); 761 757 owl_message_set_attribute(m, "loginhost", tmp); 762 758 owl_free(tmp); 763 759 764 ptr=owl_zephyr_get_field(n, 3, &len); 765 tmp=owl_malloc(len+10); 766 strncpy(tmp, ptr, len); 767 tmp[len]='\0'; 760 tmp=owl_zephyr_get_field(n, 3); 768 761 owl_message_set_attribute(m, "logintty", tmp); 769 762 owl_free(tmp); … … 786 779 787 780 /* set the body */ 788 ptr=owl_zephyr_get_message(n, &k); 789 tmp=owl_malloc(k+10); 790 memcpy(tmp, ptr, k); 791 tmp[k]='\0'; 781 tmp=owl_zephyr_get_message(n); 792 782 if (owl_global_is_newlinestrip(&g)) { 793 783 tmp2=owl_util_stripnewlines(tmp); -
perlconfig.c
r27c3a93 rb0430a6 26 26 HV *h; 27 27 SV *hr; 28 char *ptr, * ptr2, *blessas;29 int len,i, j;28 char *ptr, *blessas; 29 int i, j; 30 30 31 31 if (!m) return &PL_sv_undef; … … 43 43 j=owl_zephyr_get_num_fields(owl_message_get_notice(m)); 44 44 for (i=0; i<j; i++) { 45 ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1, &len); 46 ptr2=owl_malloc(len+1); 47 memcpy(ptr2, ptr, len); 48 ptr2[len]='\0'; 49 av_push(av_zfields, newSVpvn(ptr2, len)); 50 owl_free(ptr2); 45 ptr=owl_zephyr_get_field(owl_message_get_notice(m), i+1); 46 av_push(av_zfields, newSVpvn(ptr, strlen(ptr))); 47 owl_free(ptr); 51 48 } 52 49 hv_store(h, "fields", strlen("fields"), newRV_noinc((SV*)av_zfields), 0); -
zephyr.c
r5a95b69 rb0430a6 257 257 } 258 258 259 #ifdef HAVE_LIBZEPHYR 260 char *owl_zephyr_get_field(ZNotice_t *n, int j, int *k) 261 { 262 /* return a pointer to the Jth field, place the length in k. If the 263 field doesn't exist return an emtpy string */ 259 /* return a pointer to the data in the Jth field, (NULL terminated by 260 * definition). Caller must free the return. 261 */ 262 #ifdef HAVE_LIBZEPHYR 263 char *owl_zephyr_get_field(ZNotice_t *n, int j) 264 { 264 265 int i, count, save; 266 char *out; 265 267 266 268 count=save=0; … … 270 272 if (count==j) { 271 273 /* just found the end of the field we're looking for */ 272 *k=i-save; 273 return(n->z_message+save); 274 return(owl_strdup(n->z_message+save)); 274 275 } else { 275 276 save=i+1; … … 277 278 } 278 279 } 279 /* catch the last field */280 /* catch the last field, which might not be null terminated */ 280 281 if (count==j-1) { 281 *k=n->z_message_len-save; 282 return(n->z_message+save); 283 } 284 285 *k=0; 286 return(""); 282 out=owl_malloc(n->z_message_len-save+5); 283 memcpy(out, n->z_message+save, n->z_message_len-save); 284 out[n->z_message_len-save]='\0'; 285 return(out); 286 } 287 288 return(owl_strdup("")); 287 289 } 288 290 #else 289 291 char *owl_zephyr_get_field(void *n, int j, int *k) 290 292 { 291 return(""); 292 } 293 #endif 293 return(owl_strdup("")); 294 } 295 #endif 296 294 297 295 298 #ifdef HAVE_LIBZEPHYR … … 313 316 314 317 #ifdef HAVE_LIBZEPHYR 315 char *owl_zephyr_get_message(ZNotice_t *n, int *k) 316 { 317 /* return a pointer to the message, place the message length in k */ 318 /* return a pointer to the message, place the message length in k */ 319 char *owl_zephyr_get_message(ZNotice_t *n) 320 { 318 321 if (!strcasecmp(n->z_opcode, "ping")) { 319 *k=0;320 322 return(""); 321 323 } 322 324 323 return(owl_zephyr_get_field(n, 2 , k));325 return(owl_zephyr_get_field(n, 2)); 324 326 } 325 327 #endif … … 793 795 } 794 796 795 796 797 /* Strip a local realm fron the zephyr user name. 797 798 * The caller must free the return
Note: See TracChangeset
for help on using the changeset viewer.