- Timestamp:
- Jun 1, 2003, 2:42:58 PM (20 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:
- df0d93a
- Parents:
- 0ff8fb57
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
zephyr.c
r8262340 r31e48a3 12 12 Code_t ZResetAuthentication(); 13 13 14 int owl_zephyr_loadsubs(char *filename) { 14 int owl_zephyr_loadsubs(char *filename) 15 { 15 16 /* return 0 on success 16 17 * -1 on file error … … 84 85 } 85 86 86 int owl_zephyr_loadloginsubs(char *filename) { 87 int owl_zephyr_loadloginsubs(char *filename) 88 { 87 89 FILE *file; 88 90 ZSubscription_t subs[3001]; … … 139 141 } 140 142 141 void unsuball() { 143 void unsuball() 144 { 142 145 int ret; 143 146 … … 149 152 } 150 153 151 int owl_zephyr_sub(char *class, char *inst, char *recip) { 154 int owl_zephyr_sub(char *class, char *inst, char *recip) 155 { 152 156 ZSubscription_t subs[5]; 153 157 int ret; … … 166 170 167 171 168 int owl_zephyr_unsub(char *class, char *inst, char *recip) { 172 int owl_zephyr_unsub(char *class, char *inst, char *recip) 173 { 169 174 ZSubscription_t subs[5]; 170 175 int ret; … … 183 188 184 189 185 char *owl_zephyr_get_field(ZNotice_t *n, int j, int *k) { 190 char *owl_zephyr_get_field(ZNotice_t *n, int j, int *k) 191 { 186 192 /* return a pointer to the Jth field, place the length in k. If the 187 193 field doesn't exist return an emtpy string */ … … 212 218 213 219 214 int owl_zephyr_get_num_fields(ZNotice_t *n) { 220 int owl_zephyr_get_num_fields(ZNotice_t *n) 221 { 215 222 int i, fields; 216 223 … … 224 231 225 232 226 char *owl_zephyr_get_message(ZNotice_t *n, int *k) { 233 char *owl_zephyr_get_message(ZNotice_t *n, int *k) 234 { 227 235 /* return a pointer to the message, place the message length in k */ 228 236 if (!strcasecmp(n->z_opcode, "ping")) { … … 235 243 236 244 237 char *owl_zephyr_get_zsig(ZNotice_t *n, int *k) { 245 char *owl_zephyr_get_zsig(ZNotice_t *n, int *k) 246 { 238 247 /* return a pointer to the zsig if there is one */ 239 248 … … 247 256 248 257 249 int send_zephyr(char *opcode, char *zsig, char *class, char *instance, char *recipient, char *message) { 258 int send_zephyr(char *opcode, char *zsig, char *class, char *instance, char *recipient, char *message) 259 { 250 260 int ret; 251 261 ZNotice_t notice; … … 287 297 } 288 298 289 Code_t send_zephyr_helper(ZNotice_t *notice, char *buf, int len, int wait) { 299 Code_t send_zephyr_helper(ZNotice_t *notice, char *buf, int len, int wait) 300 { 290 301 return(ZSendPacket(buf, len, 0)); 291 302 } 292 303 293 void send_ping(char *to) { 304 void send_ping(char *to) 305 { 294 306 send_zephyr("PING", "", "MESSAGE", "PERSONAL", to, ""); 295 307 } 296 308 297 void owl_zephyr_handle_ack(ZNotice_t *retnotice) { 309 void owl_zephyr_handle_ack(ZNotice_t *retnotice) 310 { 298 311 char *tmp; 299 312 … … 331 344 } 332 345 333 int owl_zephyr_notice_is_ack(ZNotice_t *n) { 346 int owl_zephyr_notice_is_ack(ZNotice_t *n) 347 { 334 348 if (n->z_kind == SERVNAK || n->z_kind == SERVACK || n->z_kind == HMACK) { 335 349 if (!strcasecmp(n->z_class, LOGIN_CLASS)) return(0); … … 339 353 } 340 354 341 void owl_zephyr_zaway(owl_message *m) { 355 void owl_zephyr_zaway(owl_message *m) 356 { 342 357 char *tmpbuff, *myuser, *to; 343 358 … … 380 395 381 396 382 void owl_zephyr_hackaway_cr(ZNotice_t *n) { 397 void owl_zephyr_hackaway_cr(ZNotice_t *n) 398 { 383 399 /* replace \r's with ' '. Gross-ish */ 384 400 int i; … … 391 407 } 392 408 393 void owl_zephyr_zlocate(char *user, char *out, int auth) { 409 void owl_zephyr_zlocate(char *user, char *out, int auth) 410 { 394 411 int ret, numlocs; 395 412 int one = 1; … … 419 436 } 420 437 421 void owl_zephyr_addsub(char *filename, char *class, char *inst, char *recip) { 438 void owl_zephyr_addsub(char *filename, char *class, char *inst, char *recip) 439 { 422 440 char *line, subsfile[LINE], buff[LINE]; 423 441 FILE *file; … … 461 479 } 462 480 463 void owl_zephyr_delsub(char *filename, char *class, char *inst, char *recip) { 481 void owl_zephyr_delsub(char *filename, char *class, char *inst, char *recip) 482 { 464 483 char *line, subsfile[LINE], buff[LINE], *text; 465 484 char backupfilename[LINE]; … … 527 546 } 528 547 529 char *owl_zephyr_makesubline(char *class, char *inst, char *recip) { 548 char *owl_zephyr_makesubline(char *class, char *inst, char *recip) 549 { 530 550 /* caller must free the return */ 531 551 char *out; … … 535 555 return(out); 536 556 } 557 558 559 void owl_zephyr_zlog_in(void) 560 { 561 char *exposure, *eset; 562 int ret; 563 564 ZResetAuthentication(); 565 566 eset=EXPOSE_REALMVIS; 567 exposure=ZGetVariable("exposure"); 568 if (exposure==NULL) { 569 eset=EXPOSE_REALMVIS; 570 } else if (!strcasecmp(exposure,EXPOSE_NONE)) { 571 eset = EXPOSE_NONE; 572 } else if (!strcasecmp(exposure,EXPOSE_OPSTAFF)) { 573 eset = EXPOSE_OPSTAFF; 574 } else if (!strcasecmp(exposure,EXPOSE_REALMVIS)) { 575 eset = EXPOSE_REALMVIS; 576 } else if (!strcasecmp(exposure,EXPOSE_REALMANN)) { 577 eset = EXPOSE_REALMANN; 578 } else if (!strcasecmp(exposure,EXPOSE_NETVIS)) { 579 eset = EXPOSE_NETVIS; 580 } else if (!strcasecmp(exposure,EXPOSE_NETANN)) { 581 eset = EXPOSE_NETANN; 582 } 583 584 ret=ZSetLocation(eset); 585 if (ret != ZERR_NONE) { 586 /* 587 char buff[LINE]; 588 sprintf(buff, "Error setting location: %s", error_message(ret)); 589 owl_function_makemsg(buff); 590 */ 591 } 592 } 593 594 void owl_zephyr_zlog_out(void) 595 { 596 int ret; 597 598 ZResetAuthentication(); 599 ret=ZUnsetLocation(); 600 if (ret != ZERR_NONE) { 601 /* 602 char buff[LINE]; 603 sprintf(buff, "Error unsetting location: %s", error_message(ret)); 604 owl_function_makemsg(buff); 605 */ 606 } 607 } 608
Note: See TracChangeset
for help on using the changeset viewer.