This file is indexed.

/usr/share/roundcube/plugins/quickrules/quickrules.js is in roundcube-plugins-extra 0.7-20120110.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
/**
 * QuickRules plugin script
 */

function rcmail_quickrules() {
	if (!rcmail.env.uid && (!rcmail.message_list || !rcmail.message_list.get_selection().length))
		return;

	var uids = rcmail.env.uid ? rcmail.env.uid : rcmail.message_list.get_selection().join(',');

	var lock = rcmail.set_busy(true, 'loading');
	rcmail.http_post('plugin.quickrules.add', '_uid='+uids+'&_mbox='+urlencode(rcmail.env.mailbox), lock);
}

function quickrules_add_filter() {
	rcmail.command('plugin.sieverules.add');
}

function quickrules_setup_rules() {
	var rulesTable = rcube_find_object('rules-table');
	var actsTable = rcube_find_object('actions-table');

	if (rcmail_quickrules_rules.length < 1)
		return;

	for (i = 1; i < rcmail_quickrules_rules.length; i++)
		rcmail.command('plugin.sieverules.add_rule','', rulesTable.tBodies[0].rows[0]);

	var headers = document.getElementsByName('_selheader[]');
	var ops = document.getElementsByName('_operator[]');
	var targets = document.getElementsByName('_target[]');
	var otherHeaders = document.getElementsByName('_header[]');
	var headerParts = "";

	for (var i = 1; i < headers.length; i++) {
		$(headers[i]).val(rcmail_quickrules_rules[i-1].header);
		$(ops[i]).val(rcmail_quickrules_rules[i-1].op);
		headerParts = "";

		// other headers
		if (rcmail_quickrules_rules[i-1].header.indexOf('other') == 0) {
			headerParts = rcmail_quickrules_rules[i-1].header.split('::');
			rcmail_quickrules_rules[i-1].header = 'header::other'
			$(headers[i]).val(rcmail_quickrules_rules[i-1].header);
		}

		// check values set ok before adding rule
		if ($(headers[i]).val() == rcmail_quickrules_rules[i-1].header && $(ops[i]).val() == rcmail_quickrules_rules[i-1].op) {
			rcmail.sieverules_header_select(headers[i]);

			if (headerParts)
				$(otherHeaders[i]).val(headerParts[1]);

			// set the op again (header onchange resets it)
			$(ops[i]).val(rcmail_quickrules_rules[i-1].op);
			rcmail.sieverules_rule_op_select(ops[i]);

			targets[i].value = rcmail_quickrules_rules[i-1].target;
		}
		else {
			headers[i].selectedIndex = 0;
			ops[i].selectedIndex = 0;
		}
	}

	if (rcmail_quickrules_actions.length < 1)
		return;

	for (i = 1; i < rcmail_quickrules_actions.length; i++)
		rcmail.command('plugin.sieverules.add_action','', actsTable.tBodies[0].rows[0]);

	var acts = document.getElementsByName('_act[]');
	var folders = document.getElementsByName('_folder[]');
	var flags = document.getElementsByName('_imapflags[]');

	for (var i = 1; i < acts.length; i++) {
		$(acts[i]).val(rcmail_quickrules_actions[i-1].act);

		// check for imap4flags
		if (rcmail_quickrules_actions[i-1].act == 'imapflags') {
			if ($(acts[i]).val() != rcmail_quickrules_actions[i-1].act)
				$(acts[i]).val('imap4flags');

			// check values set ok before adding action
			if ($(acts[i]).val() == rcmail_quickrules_actions[i-1].act) {
				rcmail.sieverules_action_select(acts[i]);
				$(flags[i]).val(rcmail_quickrules_actions[i-1].props);
			}
			else {
				acts[i].selectedIndex = 0;
			}
		}
		else {
			// check values set ok before adding action
			if ($(acts[i]).val() == rcmail_quickrules_actions[i-1].act) {
				rcmail.sieverules_action_select(acts[i]);
				$(folders[i]).val(rcmail_quickrules_actions[i-1].props);
			}
			else {
				acts[i].selectedIndex = 0;
			}
		}
	}
}

function rcmail_quickrules_status(command) {
	switch (command) {
		case 'beforedelete':
			if (!rcmail.env.flag_for_deletion && rcmail.env.trash_mailbox &&
				rcmail.env.mailbox != rcmail.env.trash_mailbox &&
				(rcmail.message_list && !rcmail.message_list.shiftkey))
				rcmail.enable_command('plugin.quickrules.create', false);

			break;
		case 'beforemove':
		case 'beforemoveto':
			rcmail.enable_command('plugin.quickrules.create', false);
			break;
		case 'aftermove':
		case 'aftermoveto':
			if (rcmail.env.action == 'show')
				rcmail.enable_command('plugin.quickrules.create', true);

			break;
		case 'afterpurge':
		case 'afterexpunge':
			if (!rcmail.env.messagecount && rcmail.task == 'mail')
				rcmail.enable_command('plugin.quickrules.create', false);

			break;
	}
}

function rcmail_quickrules_init() {
	if (rcmail.env.action == 'plugin.sieverules')
		quickrules_add_filter();

	if (rcmail.env.action == 'plugin.sieverules.add')
		quickrules_setup_rules();

	if (window.rcm_contextmenu_register_command)
		rcm_contextmenu_register_command('quickrules', 'rcmail_quickrules', rcmail.gettext('quickrules.createfilter'), 'moveto', 'after', false);
}

$(document).ready(function() {
	if (window.rcmail) {
		rcmail.addEventListener('init', function(evt) {
			// register command (directly enable in message view mode)
			rcmail.register_command('plugin.quickrules.create', rcmail_quickrules, rcmail.env.uid);

			if (rcmail.message_list && rcmail.env.junk_mailbox) {
				rcmail.message_list.addEventListener('select', function(list) {
					rcmail.enable_command('plugin.quickrules.create', list.get_single_selection() != null);
				});
			}
		});

		rcmail.add_onload('rcmail_quickrules_init()');

		// update button activation after external events
		rcmail.addEventListener('beforedelete', function(props) { rcmail_quickrules_status('beforedelete'); } );
		rcmail.addEventListener('beforemove', function(props) { rcmail_quickrules_status('beforemove'); } );
		rcmail.addEventListener('beforemoveto', function(props) { rcmail_quickrules_status('beforemoveto'); } );
		rcmail.addEventListener('aftermove', function(props) { rcmail_quickrules_status('aftermove'); } );
		rcmail.addEventListener('aftermoveto', function(props) { rcmail_quickrules_status('aftermoveto'); } );
		rcmail.addEventListener('afterpurge', function(props) { rcmail_quickrules_status('afterpurge'); } );
		rcmail.addEventListener('afterexpunge', function(props) { rcmail_quickrules_status('afterexpunge'); } );
	}
});