示例#1
0
文件: FiSH.c 项目: kelek-/FiSH-irssi
void setup_fish()
{
	signal_add_first("server sendmsg", (SIGNAL_FUNC) encrypt_msg);
	signal_add_first("message private", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message public", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message irc notice", (SIGNAL_FUNC) decrypt_notice);
	signal_add_first("message irc action", (SIGNAL_FUNC) decrypt_action);
 
	signal_add_first("message own_private", (SIGNAL_FUNC) format_msg);
	signal_add_first("message own_public", (SIGNAL_FUNC) format_msg);
 
	signal_add_first("channel topic changed",
			 (SIGNAL_FUNC) decrypt_changed_topic);
	signal_add_first("message topic", (SIGNAL_FUNC) decrypt_topic);
	signal_add_first("server incoming", (SIGNAL_FUNC) raw_handler);
 
	signal_add("query created", (SIGNAL_FUNC) do_auto_keyx);
	signal_add("query nick changed", (SIGNAL_FUNC) query_nick_changed);
 
	signal_add("complete command topic+", (SIGNAL_FUNC) sig_complete_topic_plus);
 
	command_bind("topic+", NULL, (SIGNAL_FUNC) cmd_crypt_topic);
	command_bind("notice+", NULL, (SIGNAL_FUNC) cmd_crypt_notice);
	command_bind("me+", NULL, (SIGNAL_FUNC) cmd_crypt_action);
	command_bind("setkey", NULL, (SIGNAL_FUNC) cmd_setkey);
	command_bind("delkey", NULL, (SIGNAL_FUNC) cmd_delkey);
	command_bind("key", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("showkey", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("keyx", NULL, (SIGNAL_FUNC) cmd_keyx);
	command_bind("setinipw", NULL, (SIGNAL_FUNC) cmd_setinipw);
	command_bind("unsetinipw", NULL, (SIGNAL_FUNC) cmd_unsetinipw);
 
	settings_add_bool_module("fish", "fish", "process_outgoing", 1);
	settings_add_bool_module("fish", "fish", "process_incoming", 1);
	settings_add_bool_module("fish", "fish", "auto_keyxchange", 1);
	settings_add_bool_module("fish", "fish", "nicktracker", 1);
 
	settings_add_str_module("fish", "fish", "mark_broken_block",
				"\002&\002");
	settings_add_str_module("fish", "fish", "mark_encrypted", "\002>\002 ");
	settings_add_str_module("fish", "fish", "plain_prefix", "+p ");
 
	settings_add_int_module("fish", "fish", "mark_position", 1);
}
static PyObject *PyScript_settings_add_str(PyScript *self, PyObject *args, PyObject *kwds)
{
    static char *kwlist[] = {"section", "key", "def", NULL};
    char *section = "";
    char *key = "";
    char *def = "";

    if (!PyArg_ParseTupleAndKeywords(args, kwds, "sss", kwlist, 
           &section, &key, &def))
        return NULL;

    if (!py_settings_add(self, key))
        return PyErr_Format(PyExc_ValueError, "key, %s, already added by script", key);

    settings_add_str_module(MODULE_NAME"/scripts", section, key, def);
    
    Py_RETURN_NONE;
}
示例#3
0
文件: FiSH.c 项目: bcome/FiSH-irssi
void fish_init(void)
{
	char iniPasswordHash[50], B64digest[50];

	strcpy(iniPath, get_irssi_config());	// path to irssi config file
	strcpy(strrchr(iniPath, '/'), blow_ini);

	if (DH1080_Init() == FALSE)
		return;

	getIniValue("FiSH", "ini_password_Hash", "0", iniPasswordHash,
		    sizeof(iniPasswordHash), iniPath);
	if (strlen(iniPasswordHash) == 43) {
		prompt_for_password(iniKey);
		calculate_password_key_and_hash(iniKey, iniKey, B64digest);

		if (strcmp(B64digest, iniPasswordHash) != 0) {
			printtext(NULL, NULL, MSGLEVEL_CRAP,
				  "\002FiSH:\002 Wrong blow.ini password entered, try again...");
			printtext(NULL, NULL, MSGLEVEL_CRAP,
				  "\002FiSH module NOT loaded.\002");
			return;
		}
		printtext(NULL, NULL, MSGLEVEL_CRAP,
			  "\002FiSH:\002 Correct blow.ini password entered, lets go!");
	} else {
		strcpy(iniKey, default_iniKey);
		printtext(NULL, NULL, MSGLEVEL_CRAP,
			  "\002FiSH:\002 Using default password to decrypt blow.ini... Try /setinipw to set a custom password.");
	}

	signal_add_first("server sendmsg", (SIGNAL_FUNC) encrypt_msg);
	signal_add_first("message private", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message public", (SIGNAL_FUNC) decrypt_msg);
	signal_add_first("message irc notice", (SIGNAL_FUNC) decrypt_notice);
	signal_add_first("message irc action", (SIGNAL_FUNC) decrypt_action);

	signal_add_first("message own_private", (SIGNAL_FUNC) format_msg);
	signal_add_first("message own_public", (SIGNAL_FUNC) format_msg);

	signal_add_first("channel topic changed",
			 (SIGNAL_FUNC) decrypt_changed_topic);
	signal_add_first("message topic", (SIGNAL_FUNC) decrypt_topic);
	signal_add_first("server incoming", (SIGNAL_FUNC) raw_handler);

	signal_add("query created", (SIGNAL_FUNC) do_auto_keyx);
	signal_add("query nick changed", (SIGNAL_FUNC) query_nick_changed);

	command_bind("topic+", NULL, (SIGNAL_FUNC) cmd_crypt_topic);
	command_bind("notice+", NULL, (SIGNAL_FUNC) cmd_crypt_notice);
	command_bind("notfish", NULL, (SIGNAL_FUNC) cmd_crypt_notice);
	command_bind("me+", NULL, (SIGNAL_FUNC) cmd_crypt_action);
	command_bind("setkey", NULL, (SIGNAL_FUNC) cmd_setkey);
	command_bind("delkey", NULL, (SIGNAL_FUNC) cmd_delkey);
	command_bind("key", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("showkey", NULL, (SIGNAL_FUNC) cmd_key);
	command_bind("keyx", NULL, (SIGNAL_FUNC) cmd_keyx);
	command_bind("setinipw", NULL, (SIGNAL_FUNC) cmd_setinipw);
	command_bind("unsetinipw", NULL, (SIGNAL_FUNC) cmd_unsetinipw);

	command_bind("fishhelp", NULL, (SIGNAL_FUNC) cmd_helpfish);
	command_bind("helpfish", NULL, (SIGNAL_FUNC) cmd_helpfish);

	settings_add_bool_module("fish", "FiSH", "process_outgoing", 1);
	settings_add_bool_module("fish", "FiSH", "process_incoming", 1);
	settings_add_bool_module("fish", "FiSH", "auto_keyxchange", 1);
	settings_add_bool_module("fish", "FiSH", "nicktracker", 1);

	settings_add_str_module("fish", "FiSH", "mark_broken_block",
				" \002&\002");
	settings_add_str_module("fish", "FiSH", "mark_encrypted", "");
	settings_add_str_module("fish", "FiSH", "plain_prefix", "+p ");

	settings_add_int_module("fish", "FiSH", "mark_position", 0);

	printtext(NULL, NULL, MSGLEVEL_CLIENTNOTICE,
		  "FiSH v1.00 - encryption module for irssi loaded! URL: https://github.com/falsovsky/FiSH-irssi\n"
		  "Try /helpfish or /fishhelp for a short command overview");

	module_register("fish", "core");
}