This file is indexed.

/usr/share/perl5/Shutter/Upload/UbuntuOne.pm is in shutter 0.90.1-0ubuntu1.

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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
###################################################
#
#  Copyright (C) 2008-2013 Mario Kemper <mario.kemper@gmail.com>
#
#  This file is part of Shutter.
#
#  Shutter is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either version 3 of the License, or
#  (at your option) any later version.
#
#  Shutter is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with Shutter; if not, write to the Free Software
#  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
#
###################################################

package Shutter::Upload::UbuntuOne;

use utf8;
use strict;

#DBus message system
use Net::DBus::GLib;

#Glib
use Glib qw/TRUE FALSE/;

#--------------------------------------

sub new {
	my $class = shift;

	my $self = {
		_sc    => shift,
	};
	
	bless $self, $class;
	return $self;
}

#~ sub DESTROY {
    #~ my $self = shift;
    #~ print "$self dying at\n";
#~ } 

sub connect_to_bus {
	my $self = shift;
	
	eval{
		$self->{_bus} = Net::DBus::GLib->session();
		$self->{_service} = $self->{_bus}->get_service("com.ubuntuone.SyncDaemon");
	};
	if($@){
		print "Warning: $@", "\n";
		return ($@);
	}
	
	return ($self->{_service});
}

sub check_api {
	my $self = shift;
	return FALSE unless $self->is_connected;
	my $api = $self->{_service}->get_object("/", "org.freedesktop.DBus.Introspectable");
	my $node = $api->Introspect();
	if($node =~ /name=\"publicfiles\"/){
		return TRUE;
	}
	print "Warning: Node 'publicfiles' not found. Your Ubuntu One installation seems to be out of date.", "\n";	
	return FALSE;
}

sub get_syncdaemon {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd}){
		$self->{_sd} = $self->{_service}->get_object("/", "com.ubuntuone.SyncDaemon.SyncDaemon");
	}
	return $self->{_sd};
}

sub get_syncdaemon_fs {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_fs}){
		$self->{_sd_fs} = $self->{_service}->get_object("/filesystem", "com.ubuntuone.SyncDaemon.FileSystem");
	}
	return $self->{_sd_fs};
}

sub get_syncdaemon_events {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_ev}){
		$self->{_sd_ev} = $self->{_service}->get_object("/events", "com.ubuntuone.SyncDaemon.Events");
	}
	return $self->{_sd_ev};
}

sub get_syncdaemon_folders {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_folders}){
		$self->{_sd_folders} = $self->{_service}->get_object("/folders", "com.ubuntuone.SyncDaemon.Folders");
	}
	return $self->{_sd_folders};
}

sub get_syncdaemon_config {
	my $self = shift;
	return FALSE unless $self->is_connected;
	
	#the following does not exist in all versions of U1
	my $api = $self->{_service}->get_object("/", "org.freedesktop.DBus.Introspectable");
	my $node = $api->Introspect();
	if($node =~ /name=\"config\"/){
		unless(defined $self->{_sd_config}){
			$self->{_sd_config} = $self->{_service}->get_object("/config", "com.ubuntuone.SyncDaemon.Config");
		}
		return $self->{_sd_config};
	}
	print "Warning: Node 'config' not found. Your Ubuntu One installation seems to be out of date. Unable to check for configuration.", "\n";	
	return FALSE;
}

sub get_syncdaemon_shares {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_shares}){
		$self->{_sd_shares} = $self->{_service}->get_object("/shares", "com.ubuntuone.SyncDaemon.Shares");
	}
	return $self->{_sd_shares};
}

sub get_syncdaemon_status {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_status}){
		$self->{_sd_status} = $self->{_service}->get_object("/status", "com.ubuntuone.SyncDaemon.Status");
	}
	return $self->{_sd_status};
}

sub get_syncdaemon_public {
	my $self = shift;
	return FALSE unless $self->is_connected;
	unless(defined $self->{_sd_public}){
		$self->{_sd_public} = $self->{_service}->get_object("/publicfiles", "com.ubuntuone.SyncDaemon.PublicFiles");
	}
	return $self->{_sd_public};
}

sub is_connected {
	my $self = shift;
	return TRUE if defined $self->{_bus} && defined $self->{_service};
	print "Warning: Not connected to bus, you need to call 'connect_to_bus' first", "\n";
	return FALSE;
}

sub is_online {
	my $self = shift;
	return FALSE unless $self->is_connected;
	my ($is_connected, $is_online, $text) = $self->get_current_status;
	return TRUE if $is_connected && $is_online;
	print "Warning: Not online, maybe your computer is not connected to a network", "\n";
	return FALSE;
}

sub get_current_status {
	my $self = shift;
	my $status_ref = shift;

	return FALSE unless $self->is_connected;

	my %status;
	if(defined $status_ref){
		%status = %{$status_ref};
	}else{
		%status = %{$self->get_syncdaemon_status->current_status};
	}
	
	#create human readable messages
	my $d = $self->{_sc}->get_gettext;
	my $text = $d->get("Disconnected");
	if($status{is_connected}){
		if($status{name} eq 'QUEUE_MANAGER' && $status{queues} eq 'IDLE'){
			$text = $d->get("Synchronization complete");
		}else{
			$text = $d->get("Synchronization in progress...");
		}
	}
	
	return ($status{is_connected}, $status{is_online}, $text);
}

sub is_synced_folder {
	my $self = shift;
	my $folder = shift;
	
	return FALSE unless defined $folder;
	return FALSE unless $self->is_connected;

	my $sd_fs = $self->get_syncdaemon_fs($folder);
	
	my %meta;
	eval{
		%meta = %{$sd_fs->get_metadata($folder)};
		print Dumper %meta;	
	};
	if($@){
		return FALSE;
	}
	return $meta{is_dir};
}

sub is_notifications_enabled {
	my $self = shift;
	
	return FALSE unless $self->is_connected;

	my $sd_cf = $self->get_syncdaemon_config;
	
	#does not exist in all version of U1
	return FALSE unless $sd_cf;
	
	my $is_enabled = TRUE;
	eval{
		$is_enabled = $sd_cf->show_all_notifications_enabled;
	};
	if($@){
		return FALSE;
	}
	return $is_enabled;
}

1;