Mercurial > pidgin
comparison src/gaimrc.c @ 5205:fefad67de2c7
[gaim-migrate @ 5573]
I had a damn good commit message, but it was eaten. Let's try it again.
Announcing, Gaim Plugin API version 2.0, or GPAPIV2.0 for short.
There are lots'a cool thingies here.
Okay now, this isn't as cool as the previous message, but:
1) There's now a single entry function for all plugin types. It returns a
detailed information structure on the plugin. This removes a lot of the
ugliness from old plugins. Oh yeah, libicq wasn't converted to this, so
if you use it, well, you shouldn't have used it anyway, but now you
can't! bwahahaha. Use AIM/ICQ.
2) There are now 3 types of plugins: Standard, Loader, and Protocol
plugins.
Standard plugins are, well, standard, compiled plugins.
Loader plugins load other plugins. For example, the perl support is now
a loader plugin. It loads perl scripts. In the future, we'll have
Ruby and Python loader plugins.
Protocol plugins are, well, protocol plugins... yeah...
3) Plugins have unique IDs, so they can be referred to or automatically
updated from a plugin database in the future. Neat, huh?
4) Plugins will have dependency support in the future, and can be hidden,
so if you have, say, a logging core plugin, it won't have to show up,
but then you load the GTK+ logging plugin and it'll auto-load the core
plugin. Core/UI split plugins!
5) There will eventually be custom plugin signals and RPC of some sort, for
the core/ui split plugins.
So, okay, back up .gaimrc.
I'd like to thank my parents for their support, javabsp for helping convert
a bunch of protocol plugins, and Etan for helping convert a bunch of
standard plugins.
Have fun. If you have any problems, please let me know, but you probably
won't have anything major happen. You will have to convert your plugins,
though, and I'm not guaranteeing that all perl scripts will still work.
I'll end up changing the perl script API eventually, so I know they won't
down the road. Don't worry, though. It'll be mass cool.
faceprint wants me to just commit the damn code already. So, here we go!!!
..
..
I need a massage. From a young, cute girl. Are there any young, cute girls
in the audience? IM me plz k thx.
committer: Tailor Script <tailor@pidgin.im>
author | Christian Hammond <chipx86@chipx86.com> |
---|---|
date | Fri, 25 Apr 2003 06:47:33 +0000 |
parents | 145587c11207 |
children | 0241d6b6702d |
comparison
equal
deleted
inserted
replaced
5204:44de70702205 | 5205:fefad67de2c7 |
---|---|
64 guint away_resend; | 64 guint away_resend; |
65 static guint is_loading_prefs = 0; | 65 static guint is_loading_prefs = 0; |
66 static guint request_save_prefs = 0; | 66 static guint request_save_prefs = 0; |
67 static guint is_saving_prefs = 0; | 67 static guint is_saving_prefs = 0; |
68 static guint request_load_prefs = 0; | 68 static guint request_load_prefs = 0; |
69 static guint prefs_initial_load = 0; | |
69 guint proxy_info_is_from_gaimrc = 1; /* Only save proxy info if it | 70 guint proxy_info_is_from_gaimrc = 1; /* Only save proxy info if it |
70 * was loaded from the file | 71 * was loaded from the file |
71 * or otherwise explicitly requested */ | 72 * or otherwise explicitly requested */ |
72 | 73 |
73 int report_idle; | 74 int report_idle; |
532 } | 533 } |
533 | 534 |
534 fprintf(f, "}\n"); | 535 fprintf(f, "}\n"); |
535 } | 536 } |
536 | 537 |
537 #ifdef GAIM_PLUGINS | |
538 static void gaimrc_write_plugins(FILE *f) | 538 static void gaimrc_write_plugins(FILE *f) |
539 { | 539 { |
540 GList *pl = plugins; | 540 GList *pl; |
541 struct gaim_plugin *p; | 541 GaimPlugin *p; |
542 | 542 |
543 fprintf(f, "plugins {\n"); | 543 fprintf(f, "plugins {\n"); |
544 | 544 |
545 while (pl) { | 545 for (pl = gaim_plugins_get_loaded(); pl != NULL; pl = pl->next) { |
546 char *path; | 546 char *path; |
547 | 547 |
548 p = (struct gaim_plugin *)pl->data; | 548 p = (GaimPlugin *)pl->data; |
549 | 549 |
550 path = escape_text2(p->path); | 550 if (p->info->type != GAIM_PLUGIN_PROTOCOL) { |
551 fprintf(f, "\tplugin { %s }\n", path); | 551 path = escape_text2(p->path); |
552 free(path); | 552 fprintf(f, "\tplugin { %s }\n", path); |
553 | 553 free(path); |
554 pl = pl->next; | 554 } |
555 } | 555 } |
556 | 556 |
557 fprintf(f, "}\n"); | 557 fprintf(f, "}\n"); |
558 } | 558 } |
559 | 559 |
560 static void gaimrc_read_plugins(FILE *f) | 560 static void gaimrc_read_plugins(FILE *f) |
561 { | 561 { |
562 struct parse parse_buffer; | 562 struct parse parse_buffer; |
563 struct parse *p; | 563 struct parse *p; |
564 char buf[4096]; | 564 char buf[4096]; |
565 GSList *load = NULL; | |
566 | 565 |
567 buf[0] = 0; | 566 buf[0] = 0; |
568 | 567 |
569 while (buf[0] != '}') { | 568 while (buf[0] != '}') { |
570 if (!fgets(buf, sizeof(buf), f)) | 569 if (!fgets(buf, sizeof(buf), f)) |
573 if (buf[0] == '}') | 572 if (buf[0] == '}') |
574 break; | 573 break; |
575 | 574 |
576 p = parse_line(buf, &parse_buffer); | 575 p = parse_line(buf, &parse_buffer); |
577 if (!strcmp(p->option, "plugin")) { | 576 if (!strcmp(p->option, "plugin")) { |
578 load = g_slist_append(load, g_strdup(p->value[0])); | 577 gaim_plugin_load(gaim_plugin_probe(p->value[0])); |
579 } | 578 } |
580 } | 579 } |
581 /* this is such a fucked up hack. the reason we do this is because after | 580 } |
582 * we load a plugin the gaimrc file gets rewrit. so we have to remember | |
583 * which ones to load before loading them. */ | |
584 while (load) { | |
585 if (load->data) | |
586 load_plugin(load->data); | |
587 g_free(load->data); | |
588 load = g_slist_remove(load, load->data); | |
589 } | |
590 } | |
591 #endif /* GAIM_PLUGINS */ | |
592 | 581 |
593 static struct gaim_account *gaimrc_read_user(FILE *f) | 582 static struct gaim_account *gaimrc_read_user(FILE *f) |
594 { | 583 { |
595 struct parse parse_buffer; | 584 struct parse parse_buffer; |
596 struct parse *p; | 585 struct parse *p; |
611 strcpy(account->username, p->value[0]); | 600 strcpy(account->username, p->value[0]); |
612 strcpy(account->password, p->value[1]); | 601 strcpy(account->password, p->value[1]); |
613 | 602 |
614 account->user_info[0] = 0; | 603 account->user_info[0] = 0; |
615 account->options = OPT_ACCT_REM_PASS; | 604 account->options = OPT_ACCT_REM_PASS; |
616 account->protocol = DEFAULT_PROTO; | 605 account->protocol = GAIM_PROTO_DEFAULT; |
617 account->permit = account->deny = NULL; | 606 account->permit = account->deny = NULL; |
618 | 607 |
619 if (!fgets(buf, sizeof(buf), f)) | 608 if (!fgets(buf, sizeof(buf), f)) |
620 return account; | 609 return account; |
621 | 610 |
1025 | 1014 |
1026 if (!away_resend) | 1015 if (!away_resend) |
1027 away_resend = 120; | 1016 away_resend = 120; |
1028 | 1017 |
1029 if (misc_options & OPT_MISC_BUDDY_TICKER) { | 1018 if (misc_options & OPT_MISC_BUDDY_TICKER) { |
1030 #ifdef GAIM_PLUGINS | 1019 if (gaim_plugins_enabled()) { |
1031 gchar* buf; | 1020 gchar* buf; |
1032 | 1021 |
1033 buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, | 1022 buf = g_strconcat(LIBDIR, G_DIR_SEPARATOR_S, |
1034 #ifndef _WIN32 | 1023 #ifndef _WIN32 |
1035 "ticker.so", | 1024 "ticker.so", |
1036 #else | 1025 #else |
1037 "ticker.dll", | 1026 "ticker.dll", |
1038 #endif | 1027 #endif |
1039 NULL); | 1028 NULL); |
1040 load_plugin(buf); | 1029 |
1041 g_free(buf); | 1030 gaim_plugin_load(gaim_plugin_probe(buf)); |
1042 #endif | 1031 g_free(buf); |
1032 } | |
1033 | |
1043 misc_options &= ~OPT_MISC_BUDDY_TICKER; | 1034 misc_options &= ~OPT_MISC_BUDDY_TICKER; |
1044 } | 1035 } |
1045 } | 1036 } |
1046 | 1037 |
1047 static void gaimrc_write_options(FILE *f) | 1038 static void gaimrc_write_options(FILE *f) |
1467 { | 1458 { |
1468 FILE *f; | 1459 FILE *f; |
1469 char buf[1024]; | 1460 char buf[1024]; |
1470 int ver = 0; | 1461 int ver = 0; |
1471 debug_printf("load_prefs\n"); | 1462 debug_printf("load_prefs\n"); |
1463 | |
1472 if (is_saving_prefs) { | 1464 if (is_saving_prefs) { |
1473 request_load_prefs = 1; | 1465 request_load_prefs = 1; |
1474 debug_printf("currently saving, will request load\n"); | 1466 debug_printf("currently saving, will request load\n"); |
1475 return; | 1467 return; |
1476 } | 1468 } |
1506 gaimrc_read_options(f); | 1498 gaimrc_read_options(f); |
1507 break; | 1499 break; |
1508 case 2: | 1500 case 2: |
1509 gaimrc_read_away(f); | 1501 gaimrc_read_away(f); |
1510 break; | 1502 break; |
1511 #ifdef GAIM_PLUGINS | |
1512 case 3: | 1503 case 3: |
1513 gaimrc_read_plugins(f); | 1504 if (gaim_plugins_enabled()) |
1505 gaimrc_read_plugins(f); | |
1514 break; | 1506 break; |
1515 #endif | |
1516 case 4: | 1507 case 4: |
1517 gaimrc_read_pounce(f); | 1508 gaimrc_read_pounce(f); |
1518 break; | 1509 break; |
1519 case 6: | 1510 case 6: |
1520 gaimrc_read_sounds(f); | 1511 gaimrc_read_sounds(f); |
1542 set_defaults(); | 1533 set_defaults(); |
1543 } else { | 1534 } else { |
1544 set_defaults(); | 1535 set_defaults(); |
1545 save_prefs(); | 1536 save_prefs(); |
1546 } | 1537 } |
1538 | |
1539 prefs_initial_load = 1; | |
1547 } | 1540 } |
1548 | 1541 |
1549 void save_prefs() | 1542 void save_prefs() |
1550 { | 1543 { |
1551 FILE *f; | 1544 FILE *f; |
1552 gchar *filename; | 1545 gchar *filename; |
1553 gchar *filename_temp; | 1546 gchar *filename_temp; |
1554 | 1547 |
1555 debug_printf("enter save_prefs\n"); | 1548 debug_printf("enter save_prefs\n"); |
1549 if (!prefs_initial_load) | |
1550 return; | |
1551 | |
1556 if (is_loading_prefs) { | 1552 if (is_loading_prefs) { |
1557 request_save_prefs = 1; | 1553 request_save_prefs = 1; |
1558 debug_printf("currently loading, will request save\n"); | 1554 debug_printf("currently loading, will request save\n"); |
1559 return; | 1555 return; |
1560 } | 1556 } |
1574 gaimrc_write_users(f); | 1570 gaimrc_write_users(f); |
1575 gaimrc_write_options(f); | 1571 gaimrc_write_options(f); |
1576 gaimrc_write_sounds(f); | 1572 gaimrc_write_sounds(f); |
1577 gaimrc_write_away(f); | 1573 gaimrc_write_away(f); |
1578 gaimrc_write_pounce(f); | 1574 gaimrc_write_pounce(f); |
1579 #ifdef GAIM_PLUGINS | 1575 |
1580 gaimrc_write_plugins(f); | 1576 if (gaim_plugins_enabled()) |
1581 #endif | 1577 gaimrc_write_plugins(f); |
1578 | |
1582 gaimrc_write_proxy(f); | 1579 gaimrc_write_proxy(f); |
1583 fclose(f); | 1580 fclose(f); |
1584 if (rename(filename_temp, filename) < 0) | 1581 if (rename(filename_temp, filename) < 0) |
1585 debug_printf("error renaming %s to %s\n", filename_temp, filename); | 1582 debug_printf("error renaming %s to %s\n", filename_temp, filename); |
1586 is_saving_prefs = 0; | 1583 is_saving_prefs = 0; |