File: date.patch

package info (click to toggle)
liblivejournal-perl 1.3-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd, stretch, wheezy
  • size: 256 kB
  • ctags: 197
  • sloc: perl: 757; makefile: 4
file content (51 lines) | stat: -rw-r--r-- 1,302 bytes parent folder | download
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
Description: Added a 'date' key, based on an idea from Joshua Kwan
Origin: vendor
Bug-Debian: http://bugs.debian.org/251001
Forwarded: no
Author: Decklin Foster <decklin@red-bean.com>
Reviewed-by: gregor herrmann <gregoa@debian.org>
Last-Update: 2011-02-11

--- a/LiveJournal.pm
+++ b/LiveJournal.pm
@@ -309,10 +309,6 @@
 		substr($args->{subject}, 254) = '';
 	}
 
-	while (my ($k, $v) = each (%$args)) {
-		$content .= "&" . $k . "=" . $v;
-	}
-
   my (undef, $min, $hour, $day, $mon, $year) = localtime(time);
 
 	$year += 1900;
@@ -320,11 +316,15 @@
   $day = sprintf("%02d", $day);
   $min = sprintf("%02d", $min);
 
-	$content .= "&year=$year";
-	$content .= "&mon=$mon";
-	$content .= "&day=$day";
-	$content .= "&hour=$hour";
-	$content .= "&min=$min";
+	$args->{'year'} ||= $year;
+	$args->{'mon'}  ||= $mon;
+	$args->{'day'}  ||= $day;
+	$args->{'hour'} ||= $hour;
+	$args->{'min'}  ||= $min;
+
+	while (my ($k, $v) = each (%$args)) {
+		$content .= "&" . $k . "=" . $v;
+	}
 
 	my $response = $self->_send_mode($content);
 
@@ -419,7 +419,7 @@
 		$content .= "&" . $k . "=" . $v;
 	}
 
-  my (undef, $min, $hour, $day, $mon, $year) = localtime(time);
+  my (undef, $min, $hour, $day, $mon, $year) = localtime($args->{'date'} || time);
 
 	$year += 1900;
   $mon = sprintf("%02d", $mon + 1);