- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.