| 694 #endif |
697 #endif |
| 695 gaim_request_fields_add_group(fields, g); |
698 gaim_request_fields_add_group(fields, g); |
| 696 |
699 |
| 697 g = gaim_request_field_group_new(NULL); |
700 g = gaim_request_field_group_new(NULL); |
| 698 f = gaim_request_field_string_new("vcard", _("Your VCard File"), |
701 f = gaim_request_field_string_new("vcard", _("Your VCard File"), |
| 699 gaim_prefs_get_string("/plugins/prpl/silc/vcard"), |
702 gaim_account_get_string(sg->account, "vcard", ""), |
| 700 FALSE); |
703 FALSE); |
| 701 gaim_request_field_group_add_field(g, f); |
704 gaim_request_field_group_add_field(g, f); |
| 702 #ifdef _WIN32 |
705 #ifdef _WIN32 |
| 703 f = gaim_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); |
706 f = gaim_request_field_string_new("timezone", _("Timezone"), _tzname[0], FALSE); |
| 704 #else |
707 #else |
| 705 f = gaim_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); |
708 f = gaim_request_field_string_new("timezone", _("Timezone"), tzname[0], FALSE); |
| 706 #endif |
709 #endif |
| 707 gaim_request_field_group_add_field(g, f); |
710 gaim_request_field_group_add_field(g, f); |
| 708 gaim_request_fields_add_group(fields, g); |
711 gaim_request_fields_add_group(fields, g); |
| 709 |
|
| 710 |
712 |
| 711 gaim_request_fields(gc, _("User Online Status Attributes"), |
713 gaim_request_fields(gc, _("User Online Status Attributes"), |
| 712 _("User Online Status Attributes"), |
714 _("User Online Status Attributes"), |
| 713 _("You can let other users see your online status information " |
715 _("You can let other users see your online status information " |
| 714 "and your personal information. Please fill the information " |
716 "and your personal information. Please fill the information " |
| 760 tmp, NULL, NULL); |
762 tmp, NULL, NULL); |
| 761 g_free(tmp); |
763 g_free(tmp); |
| 762 } |
764 } |
| 763 |
765 |
| 764 static void |
766 static void |
| |
767 silcgaim_create_keypair_cancel(GaimConnection *gc, GaimRequestFields *fields) |
| |
768 { |
| |
769 /* Nothing */ |
| |
770 } |
| |
771 |
| |
772 static void |
| |
773 silcgaim_create_keypair_cb(GaimConnection *gc, GaimRequestFields *fields) |
| |
774 { |
| |
775 SilcGaim sg = gc->proto_data; |
| |
776 GaimRequestField *f; |
| |
777 const char *val, *pkfile = NULL, *prfile = NULL; |
| |
778 const char *pass1 = NULL, *pass2 = NULL, *un = NULL, *hn = NULL; |
| |
779 const char *rn = NULL, *e = NULL, *o = NULL, *c = NULL; |
| |
780 char *identifier; |
| |
781 int keylen = SILCGAIM_DEF_PKCS_LEN; |
| |
782 SilcPublicKey public_key; |
| |
783 |
| |
784 sg = gc->proto_data; |
| |
785 if (!sg) |
| |
786 return; |
| |
787 |
| |
788 val = NULL; |
| |
789 f = gaim_request_fields_get_field(fields, "pass1"); |
| |
790 if (f) |
| |
791 val = gaim_request_field_string_get_value(f); |
| |
792 if (val && *val) |
| |
793 pass1 = val; |
| |
794 else |
| |
795 pass1 = ""; |
| |
796 val = NULL; |
| |
797 f = gaim_request_fields_get_field(fields, "pass2"); |
| |
798 if (f) |
| |
799 val = gaim_request_field_string_get_value(f); |
| |
800 if (val && *val) |
| |
801 pass2 = val; |
| |
802 else |
| |
803 pass2 = ""; |
| |
804 |
| |
805 if (strcmp(pass1, pass2)) { |
| |
806 gaim_notify_error( |
| |
807 gc, _("Create New SILC Key Pair"), _("Passphrases do not match"), NULL); |
| |
808 return; |
| |
809 } |
| |
810 |
| |
811 val = NULL; |
| |
812 f = gaim_request_fields_get_field(fields, "key"); |
| |
813 if (f) |
| |
814 val = gaim_request_field_string_get_value(f); |
| |
815 if (val && *val) |
| |
816 keylen = atoi(val); |
| |
817 f = gaim_request_fields_get_field(fields, "pkfile"); |
| |
818 if (f) |
| |
819 pkfile = gaim_request_field_string_get_value(f); |
| |
820 f = gaim_request_fields_get_field(fields, "prfile"); |
| |
821 if (f) |
| |
822 prfile = gaim_request_field_string_get_value(f); |
| |
823 |
| |
824 f = gaim_request_fields_get_field(fields, "un"); |
| |
825 if (f) |
| |
826 un = gaim_request_field_string_get_value(f); |
| |
827 f = gaim_request_fields_get_field(fields, "hn"); |
| |
828 if (f) |
| |
829 hn = gaim_request_field_string_get_value(f); |
| |
830 f = gaim_request_fields_get_field(fields, "rn"); |
| |
831 if (f) |
| |
832 rn = gaim_request_field_string_get_value(f); |
| |
833 f = gaim_request_fields_get_field(fields, "e"); |
| |
834 if (f) |
| |
835 e = gaim_request_field_string_get_value(f); |
| |
836 f = gaim_request_fields_get_field(fields, "o"); |
| |
837 if (f) |
| |
838 o = gaim_request_field_string_get_value(f); |
| |
839 f = gaim_request_fields_get_field(fields, "c"); |
| |
840 if (f) |
| |
841 c = gaim_request_field_string_get_value(f); |
| |
842 |
| |
843 identifier = silc_pkcs_encode_identifier((char *)un, (char *)hn, |
| |
844 (char *)rn, (char *)e, (char *)o, (char *)c); |
| |
845 |
| |
846 /* Create the key pair */ |
| |
847 if (!silc_create_key_pair(SILCGAIM_DEF_PKCS, keylen, pkfile, prfile, |
| |
848 identifier, pass1, NULL, &public_key, NULL, |
| |
849 FALSE)) { |
| |
850 gaim_notify_error( |
| |
851 gc, _("Create New SILC Key Pair"), _("Key Pair Generation failed"), NULL); |
| |
852 return; |
| |
853 } |
| |
854 |
| |
855 silcgaim_show_public_key(sg, NULL, public_key, NULL, NULL); |
| |
856 |
| |
857 silc_pkcs_public_key_free(public_key); |
| |
858 silc_free(identifier); |
| |
859 } |
| |
860 |
| |
861 static void |
| |
862 silcgaim_create_keypair(GaimPluginAction *action) |
| |
863 { |
| |
864 GaimConnection *gc = (GaimConnection *) action->context; |
| |
865 SilcGaim sg = gc->proto_data; |
| |
866 GaimRequestFields *fields; |
| |
867 GaimRequestFieldGroup *g; |
| |
868 GaimRequestField *f; |
| |
869 const char *username, *realname; |
| |
870 char *hostname, **u; |
| |
871 char tmp[256], pkd[256], pkd2[256], prd[256], prd2[256]; |
| |
872 |
| |
873 username = gaim_account_get_username(sg->account); |
| |
874 u = g_strsplit(username, "@", 2); |
| |
875 username = u[0]; |
| |
876 realname = gaim_account_get_user_info(sg->account); |
| |
877 hostname = silc_net_localhost(); |
| |
878 g_snprintf(tmp, sizeof(tmp), "%s@%s", username, hostname); |
| |
879 |
| |
880 g_snprintf(pkd2, sizeof(pkd2), "%s" G_DIR_SEPARATOR_S"public_key.pub", silcgaim_silcdir()); |
| |
881 g_snprintf(prd2, sizeof(prd2), "%s" G_DIR_SEPARATOR_S"private_key.prv", silcgaim_silcdir()); |
| |
882 g_snprintf(pkd, sizeof(pkd) - 1, "%s", |
| |
883 gaim_account_get_string(gc->account, "public-key", pkd2)); |
| |
884 g_snprintf(prd, sizeof(prd) - 1, "%s", |
| |
885 gaim_account_get_string(gc->account, "private-key", prd2)); |
| |
886 |
| |
887 fields = gaim_request_fields_new(); |
| |
888 |
| |
889 g = gaim_request_field_group_new(NULL); |
| |
890 f = gaim_request_field_string_new("key", _("Key Length"), "2048", FALSE); |
| |
891 gaim_request_field_group_add_field(g, f); |
| |
892 f = gaim_request_field_string_new("pkfile", _("Public Key File"), pkd, FALSE); |
| |
893 gaim_request_field_group_add_field(g, f); |
| |
894 f = gaim_request_field_string_new("prfile", _("Private Key File"), prd, FALSE); |
| |
895 gaim_request_field_group_add_field(g, f); |
| |
896 gaim_request_fields_add_group(fields, g); |
| |
897 |
| |
898 g = gaim_request_field_group_new(NULL); |
| |
899 f = gaim_request_field_string_new("un", _("Username"), username ? username : "", FALSE); |
| |
900 gaim_request_field_group_add_field(g, f); |
| |
901 f = gaim_request_field_string_new("hn", _("Hostname"), hostname ? hostname : "", FALSE); |
| |
902 gaim_request_field_group_add_field(g, f); |
| |
903 f = gaim_request_field_string_new("rn", _("Real Name"), realname ? realname : "", FALSE); |
| |
904 gaim_request_field_group_add_field(g, f); |
| |
905 f = gaim_request_field_string_new("e", _("Email"), tmp, FALSE); |
| |
906 gaim_request_field_group_add_field(g, f); |
| |
907 f = gaim_request_field_string_new("o", _("Organization"), "", FALSE); |
| |
908 gaim_request_field_group_add_field(g, f); |
| |
909 f = gaim_request_field_string_new("c", _("Country"), "", FALSE); |
| |
910 gaim_request_field_group_add_field(g, f); |
| |
911 gaim_request_fields_add_group(fields, g); |
| |
912 |
| |
913 g = gaim_request_field_group_new(NULL); |
| |
914 f = gaim_request_field_string_new("pass1", _("Passphrase"), "", FALSE); |
| |
915 gaim_request_field_string_set_masked(f, TRUE); |
| |
916 gaim_request_field_group_add_field(g, f); |
| |
917 f = gaim_request_field_string_new("pass2", _("Re-type Passphrase"), "", FALSE); |
| |
918 gaim_request_field_string_set_masked(f, TRUE); |
| |
919 gaim_request_field_group_add_field(g, f); |
| |
920 gaim_request_fields_add_group(fields, g); |
| |
921 |
| |
922 gaim_request_fields(gc, _("Create New SILC Key Pair"), |
| |
923 _("Create New SILC Key Pair"), NULL, fields, |
| |
924 _("Generate Key Pair"), G_CALLBACK(silcgaim_create_keypair_cb), |
| |
925 _("Cancel"), G_CALLBACK(silcgaim_create_keypair_cancel), gc); |
| |
926 |
| |
927 g_strfreev(u); |
| |
928 silc_free(hostname); |
| |
929 } |
| |
930 |
| |
931 static void |
| 765 silcgaim_change_pass(GaimPluginAction *action) |
932 silcgaim_change_pass(GaimPluginAction *action) |
| 766 { |
933 { |
| 767 GaimConnection *gc = (GaimConnection *) action->context; |
934 GaimConnection *gc = (GaimConnection *) action->context; |
| 768 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
935 gaim_account_request_change_password(gaim_connection_get_account(gc)); |
| 769 } |
936 } |
| 1441 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_names, |
1612 GAIM_CMD_FLAG_ALLOW_WRONG_ARGS, "prpl-silc", silcgaim_cmd_names, |
| 1442 _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); |
1613 _("names [-count|-ops|-halfops|-voices|-normal] <channel(s)>: List specific users in channel(s)")); |
| 1443 #endif |
1614 #endif |
| 1444 } |
1615 } |
| 1445 |
1616 |
| 1446 static GaimPluginPrefFrame * |
|
| 1447 silcgaim_pref_frame(GaimPlugin *plugin) |
|
| 1448 { |
|
| 1449 GaimPluginPrefFrame *frame; |
|
| 1450 GaimPluginPref *ppref; |
|
| 1451 |
|
| 1452 frame = gaim_plugin_pref_frame_new(); |
|
| 1453 |
|
| 1454 ppref = gaim_plugin_pref_new_with_label(_("Instant Messages")); |
|
| 1455 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1456 |
|
| 1457 ppref = gaim_plugin_pref_new_with_name_and_label( |
|
| 1458 "/plugins/prpl/silc/sign_im", |
|
| 1459 _("Digitally sign all IM messages")); |
|
| 1460 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1461 |
|
| 1462 ppref = gaim_plugin_pref_new_with_name_and_label( |
|
| 1463 "/plugins/prpl/silc/verify_im", |
|
| 1464 _("Verify all IM message signatures")); |
|
| 1465 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1466 |
|
| 1467 ppref = gaim_plugin_pref_new_with_label(_("Channel Messages")); |
|
| 1468 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1469 |
|
| 1470 ppref = gaim_plugin_pref_new_with_name_and_label( |
|
| 1471 "/plugins/prpl/silc/sign_chat", |
|
| 1472 _("Digitally sign all channel messages")); |
|
| 1473 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1474 |
|
| 1475 ppref = gaim_plugin_pref_new_with_name_and_label( |
|
| 1476 "/plugins/prpl/silc/verify_chat", |
|
| 1477 _("Verify all channel message signatures")); |
|
| 1478 gaim_plugin_pref_frame_add(frame, ppref); |
|
| 1479 |
|
| 1480 return frame; |
|
| 1481 } |
|
| 1482 |
|
| 1483 static GaimPluginUiInfo prefs_info = |
|
| 1484 { |
|
| 1485 silcgaim_pref_frame, |
|
| 1486 }; |
|
| 1487 |
|
| 1488 static GaimWhiteboardPrplOps silcgaim_wb_ops = |
1617 static GaimWhiteboardPrplOps silcgaim_wb_ops = |
| 1489 { |
1618 { |
| 1490 silcgaim_wb_start, |
1619 silcgaim_wb_start, |
| 1491 silcgaim_wb_end, |
1620 silcgaim_wb_end, |
| 1492 silcgaim_wb_get_dimensions, |
1621 silcgaim_wb_get_dimensions, |
| 1633 "block-ims", FALSE); |
1762 "block-ims", FALSE); |
| 1634 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1763 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1635 option = gaim_account_option_bool_new(_("Reject online status attribute requests"), |
1764 option = gaim_account_option_bool_new(_("Reject online status attribute requests"), |
| 1636 "reject-attrs", FALSE); |
1765 "reject-attrs", FALSE); |
| 1637 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
1766 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1638 |
1767 option = gaim_account_option_bool_new(_("Block messages to whiteboard"), |
| 1639 /* Preferences */ |
1768 "block-wb", FALSE); |
| 1640 gaim_prefs_add_none("/plugins/prpl/silc"); |
1769 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1641 gaim_prefs_add_bool("/plugins/prpl/silc/sign_im", FALSE); |
1770 option = gaim_account_option_bool_new(_("Automatically open whiteboard"), |
| 1642 gaim_prefs_add_bool("/plugins/prpl/silc/verify_im", FALSE); |
1771 "open-wb", FALSE); |
| 1643 gaim_prefs_add_bool("/plugins/prpl/silc/sign_chat", FALSE); |
1772 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| 1644 gaim_prefs_add_bool("/plugins/prpl/silc/verify_chat", FALSE); |
1773 option = gaim_account_option_bool_new(_("Digitally sign and verify all messages"), |
| 1645 gaim_prefs_add_string("/plugins/prpl/silc/vcard", ""); |
1774 "sign-verify", FALSE); |
| |
1775 prpl_info.protocol_options = g_list_append(prpl_info.protocol_options, option); |
| |
1776 |
| |
1777 gaim_prefs_remove("/plugins/prpl/silc"); |
| 1646 |
1778 |
| 1647 silcgaim_register_commands(); |
1779 silcgaim_register_commands(); |
| 1648 |
1780 |
| 1649 #ifdef _WIN32 |
1781 #ifdef _WIN32 |
| 1650 silc_net_win32_init(); |
1782 silc_net_win32_init(); |