Mercurial > pidgin
comparison src/gaimrc.c @ 5563:9eb5b13fd412
[gaim-migrate @ 5965]
Just a taste of what's coming.
Standard "This won't compile" thing. Plugin authors, you're going to hate
me, but that's okay, because I have friends too!
It's really late. My brain resembles that of fish swimming in jello pudding
with neon lights flying around chanting musicals. I'm not on drugs. I'm
just that tired.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 30 May 2003 09:38:29 +0000 |
parents | b7319c094153 |
children | fb4f7bd7525c |
comparison
equal
deleted
inserted
replaced
5562:3c8d34574601 | 5563:9eb5b13fd412 |
---|---|
150 #define OPT_AWAY_QUEUE 0x00000020 | 150 #define OPT_AWAY_QUEUE 0x00000020 |
151 #define OPT_AWAY_IDLE_RESP 0x00000040 | 151 #define OPT_AWAY_IDLE_RESP 0x00000040 |
152 #define OPT_AWAY_QUEUE_UNREAD 0x00000080 | 152 #define OPT_AWAY_QUEUE_UNREAD 0x00000080 |
153 #define OPT_AWAY_DELAY_IN_USE 0x00000100 | 153 #define OPT_AWAY_DELAY_IN_USE 0x00000100 |
154 | 154 |
155 #define OPT_ACCT_AUTO 0x00000001 | |
156 /*#define OPT_ACCT_KEEPALV 0x00000002 this shouldn't be optional */ | |
157 #define OPT_ACCT_REM_PASS 0x00000004 | |
158 #define OPT_ACCT_MAIL_CHECK 0x00000008 | |
155 | 159 |
156 GSList *gaim_accounts = NULL; | 160 GSList *gaim_accounts = NULL; |
157 static guint misc_options; | 161 static guint misc_options; |
158 static guint logging_options; | 162 static guint logging_options; |
159 static guint blist_options; | 163 static guint blist_options; |
489 gaim_plugin_load(gaim_plugin_probe(p->value[0])); | 493 gaim_plugin_load(gaim_plugin_probe(p->value[0])); |
490 } | 494 } |
491 } | 495 } |
492 } | 496 } |
493 | 497 |
494 static struct gaim_account *gaimrc_read_user(FILE *f) | 498 static GaimAccount *gaimrc_read_user(FILE *f) |
495 { | 499 { |
496 struct parse parse_buffer; | 500 struct parse parse_buffer; |
497 struct parse *p; | 501 struct parse *p; |
498 struct gaim_account *account; | 502 GaimAccount *account; |
499 int i; | 503 int i; |
500 char buf[4096]; | 504 char buf[4096]; |
505 char user_info[2048]; | |
506 int flags; | |
501 | 507 |
502 if (!fgets(buf, sizeof(buf), f)) | 508 if (!fgets(buf, sizeof(buf), f)) |
503 return NULL; | 509 return NULL; |
504 | 510 |
505 p = parse_line(buf, &parse_buffer); | 511 p = parse_line(buf, &parse_buffer); |
506 | 512 |
507 if (strcmp(p->option, "ident")) | 513 if (strcmp(p->option, "ident")) |
508 return NULL; | 514 return NULL; |
509 | 515 |
510 account = g_new0(struct gaim_account, 1); | 516 account = gaim_account_new(p->value[0], GAIM_PROTO_DEFAULT); |
511 | 517 |
512 strcpy(account->username, p->value[0]); | 518 gaim_account_set_password(account, p->value[1]); |
513 strcpy(account->password, p->value[1]); | 519 gaim_account_set_remember_password(account, TRUE); |
514 | |
515 account->user_info[0] = 0; | |
516 account->options = OPT_ACCT_REM_PASS; | |
517 account->protocol = GAIM_PROTO_DEFAULT; | |
518 account->permit = account->deny = NULL; | |
519 | 520 |
520 if (!fgets(buf, sizeof(buf), f)) | 521 if (!fgets(buf, sizeof(buf), f)) |
521 return account; | 522 return account; |
522 | 523 |
523 if (strcmp(buf, "\t\tuser_info {\n")) { | 524 if (strcmp(buf, "\t\tuser_info {\n")) { |
524 return account; | 525 return account; |
525 } | 526 } |
526 | 527 |
527 if (!fgets(buf, sizeof(buf), f)) | 528 if (!fgets(buf, sizeof(buf), f)) |
528 return account; | 529 return account; |
530 | |
531 *user_info = '\0'; | |
529 | 532 |
530 while (strncmp(buf, "\t\t}", 3)) { | 533 while (strncmp(buf, "\t\t}", 3)) { |
531 if (strlen(buf) > 3) | 534 if (strlen(buf) > 3) |
532 strcat(account->user_info, buf + 3); | 535 strcat(user_info, buf + 3); |
533 | 536 |
534 if (!fgets(buf, sizeof(buf), f)) { | 537 if (!fgets(buf, sizeof(buf), f)) { |
538 gaim_account_set_user_info(account, user_info); | |
539 | |
535 return account; | 540 return account; |
536 } | 541 } |
537 } | 542 } |
538 | 543 |
539 if ((i = strlen(account->user_info))) { | 544 if ((i = strlen(account->user_info))) |
540 account->user_info[i - 1] = '\0'; | 545 user_info[i - 1] = '\0'; |
541 } | 546 |
547 gaim_account_set_user_info(account, user_info); | |
542 | 548 |
543 if (!fgets(buf, sizeof(buf), f)) { | 549 if (!fgets(buf, sizeof(buf), f)) { |
544 return account; | 550 return account; |
545 } | 551 } |
546 | 552 |
551 p = parse_line(buf, &parse_buffer); | 557 p = parse_line(buf, &parse_buffer); |
552 | 558 |
553 if (strcmp(p->option, "user_opts")) | 559 if (strcmp(p->option, "user_opts")) |
554 return account; | 560 return account; |
555 | 561 |
556 account->options = atoi(p->value[0]); | 562 /* TODO: Handle OPT_ACCT_AUTO and OPT_ACCT_MAIL_CHECK */ |
557 account->protocol = atoi(p->value[1]); | 563 |
564 flags = atoi(p->value[0]); | |
565 | |
566 if (!(flags & OPT_ACCT_REM_PASS)) | |
567 gaim_account_set_remember_password(account, FALSE); | |
568 | |
569 gaim_account_set_protocol(account, atoi(p->value[1])); | |
558 | 570 |
559 if (!fgets(buf, sizeof(buf), f)) | 571 if (!fgets(buf, sizeof(buf), f)) |
560 return account; | 572 return account; |
561 | 573 |
562 if (!strcmp(buf, "\t}")) | 574 if (!strcmp(buf, "\t}")) |
565 p = parse_line(buf, &parse_buffer); | 577 p = parse_line(buf, &parse_buffer); |
566 | 578 |
567 if (strcmp(p->option, "proto_opts")) | 579 if (strcmp(p->option, "proto_opts")) |
568 return account; | 580 return account; |
569 | 581 |
570 for (i = 0; i < 7; i++) | 582 /* TODO: Server and port should be preserved! :/ */ |
583 #if 0 | |
584 for (i = 0; i < 7; i++) { | |
585 char buf[256]; | |
586 | |
571 g_snprintf(account->proto_opt[i], sizeof account->proto_opt[i], "%s", p->value[i]); | 587 g_snprintf(account->proto_opt[i], sizeof account->proto_opt[i], "%s", p->value[i]); |
588 } | |
589 #endif | |
572 | 590 |
573 if (!fgets(buf, sizeof(buf), f)) | 591 if (!fgets(buf, sizeof(buf), f)) |
574 return account; | 592 return account; |
575 | 593 |
576 if (!strcmp(buf, "\t}")) | 594 if (!strcmp(buf, "\t}")) |
579 p = parse_line(buf, &parse_buffer); | 597 p = parse_line(buf, &parse_buffer); |
580 | 598 |
581 if (strcmp(p->option, "iconfile")) | 599 if (strcmp(p->option, "iconfile")) |
582 return account; | 600 return account; |
583 | 601 |
584 g_snprintf(account->iconfile, sizeof(account->iconfile), "%s", p->value[0]); | 602 gaim_account_set_buddy_icon(account, p->value[0]); |
585 | 603 |
586 if (!fgets(buf, sizeof(buf), f)) | 604 if (!fgets(buf, sizeof(buf), f)) |
587 return account; | 605 return account; |
588 | 606 |
589 if (!strcmp(buf, "\t}")) | 607 if (!strcmp(buf, "\t}")) |
592 p = parse_line(buf, &parse_buffer); | 610 p = parse_line(buf, &parse_buffer); |
593 | 611 |
594 if (strcmp(p->option, "alias")) | 612 if (strcmp(p->option, "alias")) |
595 return account; | 613 return account; |
596 | 614 |
597 g_snprintf(account->alias, sizeof(account->alias), "%s", p->value[0]); | 615 gaim_account_set_alias(account, p->value[0]); |
598 | 616 |
599 if (!fgets(buf, sizeof(buf), f)) | 617 if (!fgets(buf, sizeof(buf), f)) |
600 return account; | 618 return account; |
601 | 619 |
602 if (!strcmp(buf, "\t}")) | 620 if (!strcmp(buf, "\t}")) |
624 } | 642 } |
625 | 643 |
626 static void gaimrc_read_users(FILE *f) | 644 static void gaimrc_read_users(FILE *f) |
627 { | 645 { |
628 char buf[2048]; | 646 char buf[2048]; |
629 struct gaim_account *account = NULL; | 647 GaimAccount *account = NULL; |
630 struct parse parse_buffer; | 648 struct parse parse_buffer; |
631 struct parse *p=NULL; | 649 struct parse *p=NULL; |
632 | 650 |
633 buf[0] = 0; | 651 buf[0] = 0; |
634 | 652 |
1342 load_pounces() | 1360 load_pounces() |
1343 { | 1361 { |
1344 GList *l; | 1362 GList *l; |
1345 struct pounce_placeholder *ph; | 1363 struct pounce_placeholder *ph; |
1346 struct gaim_pounce *pounce; | 1364 struct gaim_pounce *pounce; |
1347 struct gaim_account *account; | 1365 GaimAccount *account; |
1348 | 1366 |
1349 for (l = buddy_pounces; l != NULL; l = l->next) { | 1367 for (l = buddy_pounces; l != NULL; l = l->next) { |
1350 GaimPounceEvent events = GAIM_POUNCE_NONE; | 1368 GaimPounceEvent events = GAIM_POUNCE_NONE; |
1351 GaimGtkPounceAction actions = GAIM_GTKPOUNCE_NONE; | 1369 GaimGtkPounceAction actions = GAIM_GTKPOUNCE_NONE; |
1352 ph = (struct pounce_placeholder *)l->data; | 1370 ph = (struct pounce_placeholder *)l->data; |