[go: up one dir, main page]

File: date.patch

package info (click to toggle)
torbirdy 0.1.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 664 kB
  • ctags: 198
  • sloc: makefile: 28; sh: 19
file content (70 lines) | stat: -rw-r--r-- 2,767 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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# HG changeset patch
# Parent ec138f1fcabf10f11ba4a4ba662cba34ab625691
# User Sukhbir Singh <sukhbir.in@gmail.com>
Added support for removing the Date header


diff --git a/mailnews/compose/src/nsMsgCompUtils.cpp b/mailnews/compose/src/nsMsgCompUtils.cpp
--- a/mailnews/compose/src/nsMsgCompUtils.cpp
+++ b/mailnews/compose/src/nsMsgCompUtils.cpp
@@ -364,36 +364,42 @@ mime_generate_headers (nsMsgCompFields *
     if (deliver_mode == MSG_SaveAsTemplate) {
       const char *pStr = fields->GetTemplateName();
       pStr = pStr ? pStr : "";
       ENCODE_AND_PUSH("X-Template: ", false, pStr, charset, usemime);
     }
 #endif /* SUPPORT_X_TEMPLATE_NAME */
   }
 
-  PRExplodedTime now;
-  PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
-  int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
+  bool local_date_header = true;
+  prefs->GetBoolPref("mailnews.local_date_header_generation", &local_date_header);
 
-  /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
-     then figure out what our local GMT offset is, and append it (since
-     PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
-     per RFC 1123 (superceding RFC 822.)
-   */
-  PR_FormatTimeUSEnglish(buffer_tail, 100,
-               "Date: %a, %d %b %Y %H:%M:%S ",
-               &now);
+  if (local_date_header)
+  {
+    PRExplodedTime now;
+    PR_ExplodeTime(PR_Now(), PR_LocalTimeParameters, &now);
+    int gmtoffset = (now.tm_params.tp_gmt_offset + now.tm_params.tp_dst_offset) / 60;
 
-  buffer_tail += PL_strlen (buffer_tail);
-  PR_snprintf(buffer_tail, buffer + size - buffer_tail,
-        "%c%02d%02d" CRLF,
-        (gmtoffset >= 0 ? '+' : '-'),
-        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
-        ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
-  buffer_tail += PL_strlen (buffer_tail);
+    /* Use PR_FormatTimeUSEnglish() to format the date in US English format,
+       then figure out what our local GMT offset is, and append it (since
+       PR_FormatTimeUSEnglish() can't do that.) Generate four digit years as
+       per RFC 1123 (superceding RFC 822.)
+     */
+    PR_FormatTimeUSEnglish(buffer_tail, 100,
+                 "Date: %a, %d %b %Y %H:%M:%S ",
+                 &now);
+
+    buffer_tail += PL_strlen (buffer_tail);
+    PR_snprintf(buffer_tail, buffer + size - buffer_tail,
+          "%c%02d%02d" CRLF,
+          (gmtoffset >= 0 ? '+' : '-'),
+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) / 60),
+          ((gmtoffset >= 0 ? gmtoffset : -gmtoffset) % 60));
+    buffer_tail += PL_strlen (buffer_tail);
+  }
 
   if (pFrom && *pFrom)
   {
     ENCODE_AND_PUSH("From: ", true, pFrom, charset, usemime);
   }
 
   if (pReplyTo && *pReplyTo)
   {