Tags: patch

I attach a patch that I think fix this bug. It is set to private by default
in the conf.

Set it to 0 in the conf if you think it would be better not to set it by
default and make the user use -P from the command line instead

Cheers
From 9e7a97560fdc677a498c8a4c01ed6ca12064cd94 Mon Sep 17 00:00:00 2001
From: Alberto Fuentes <paj...@gmail.com>
Date: Thu, 15 Oct 2015 21:54:51 +0200
Subject: [PATCH] -P hidden pastes added to paste.debian.net

---
 README                           |  2 ++
 pastebin.d/paste.debian.net.conf |  2 ++
 pastebinit                       | 12 +++++++++---
 pastebinit.xml                   |  3 +++
 4 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/README b/README
index 24aceca..399316a 100644
--- a/README
+++ b/README
@@ -75,6 +75,8 @@ A number of reserved keywords can be used, but are optional:
 	jabberid -	contains the jabberid for the poster
 			as set at the command line.
 
+  private -   make the paste private if possible
+
 Two additional special parameters are available for use:
 
 	page -		used to specify a page from which to
diff --git a/pastebin.d/paste.debian.net.conf b/pastebin.d/paste.debian.net.conf
index 187d925..a876d72 100644
--- a/pastebin.d/paste.debian.net.conf
+++ b/pastebin.d/paste.debian.net.conf
@@ -8,8 +8,10 @@ content = code
 format = lang
 remember = remember
 expire = expire
+private = private
 
 [defaults]
 lang = -1
 remember = 0
 expire = 604800
+private = 1
diff --git a/pastebinit b/pastebinit
index 29704a0..4ab945f 100755
--- a/pastebinit
+++ b/pastebinit
@@ -135,7 +135,7 @@ try:
     #Return the parameters depending of the pastebin used
     def getParameters(website, pastebind, content, user, jabberid, version,
                       format, parentpid, permatag, title, username,
-                      password):
+                      password, private):
         "Return the parameters array for the selected pastebin"
         params = {}
         for paste_name, paste_config in pastebind.items():
@@ -165,6 +165,8 @@ try:
                                                           parentpid)
                     elif param == 'permatag':
                         params[paramname] = permatag
+                    elif param == 'private':
+                        params[paramname] = private
                     elif param == 'username':
                         params[paramname] = username
                     elif param == 'password':
@@ -217,6 +219,7 @@ try:
               file=fd)
         print(_("\t-r <parent posts ID:defaults to none>"), file=fd)
         print(_("\t-t <title of paste:default is blank>"), file=fd)
+        print(_("\t-P Private. Makes your paste hidden if possible"), file=fd)
         print(_("\t-u <username> -p <password>"), file=fd)
         print(_("\t-v Print the version number"), file=fd)
 
@@ -232,6 +235,7 @@ try:
     filenames = []
     content = ""
     parentpid = ""
+    private = 0
 
     #Example configuration file string
     configexample = """\
@@ -280,7 +284,7 @@ try:
     # Get options
     try:
         optlist, arglist = getopt.getopt(sys.argv[1:],
-                                         'hvli:f:b:a:r:j:t:m:u:p:')
+                                         'hvlPi:f:b:a:r:j:t:m:u:p:')
     except KeyboardInterrupt:
         print(_("KeyboardInterrupt caught."), file=sys.stderr)
         sys.exit(1)
@@ -318,6 +322,8 @@ try:
             title = opt[1]
         elif opt[0] == "-m":
             permatag = opt[1]
+        elif opt[0] == "-P":
+            private = 1
         elif opt[0] == "-u":
             username = opt[1]
         elif opt[0] == "-p":
@@ -360,7 +366,7 @@ try:
         # Get the parameter array
         website, params = getParameters(website, pastebind, content, user,
                                         jabberid, version, format, parentpid,
-                                        permatag, title, username, password)
+                                        permatag, title, username, password, private)
 
         if not website.endswith("/"):
             website += "/"
diff --git a/pastebinit.xml b/pastebinit.xml
index a6380fe..5f0a0aa 100644
--- a/pastebinit.xml
+++ b/pastebinit.xml
@@ -91,6 +91,9 @@
           <term><option>-t <arg>title of paste</arg></option> (default: none)</term>
         </varlistentry>
         <varlistentry>
+          <term><option>-P <arg>private</arg></option> (default: 1)</term>
+        </varlistentry>
+        <varlistentry>
           <term><option>-u <arg>username</arg></option> (default: none)</term>
         </varlistentry>
         <varlistentry>
-- 
2.6.1

Reply via email to