]> Joshua Wise's Git repositories - dumload.git/commitdiff
Merge git://git.asmw.org/dumload
authorJoshua Wise <joshua@joshuawise.com>
Sun, 4 Mar 2012 10:52:23 +0000 (02:52 -0800)
committerJoshua Wise <joshua@joshuawise.com>
Sun, 4 Mar 2012 10:52:23 +0000 (02:52 -0800)
1  2 
src/com/joshuawise/dumload/Dumload.java
src/com/joshuawise/dumload/NotifSlave.java
src/com/joshuawise/dumload/Uploader.java

index 9cabe94cbab5a3075f5362c3f33117447e0e43f7,f3317c43f2e93d8c410b0e1574cbd7ec280f05a0..c625b3aee0f96a86f3dca6d33bb2fcda660d0c02
@@@ -1,37 -1,21 +1,37 @@@
 +/* Dumload.java
 + * Main front-end glue for Dumload.
 + *
 + * This program is free software: you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License, version 3, as
 + * published by the Free Software Foundation.
 + *
 + * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
  package com.joshuawise.dumload;
  
- import java.io.InputStream;
  import android.app.Activity;
- import android.app.Service;
  import android.content.Intent;
+ import android.content.SharedPreferences;
  import android.net.Uri;
  import android.os.Bundle;
- import android.os.IBinder;
+ import android.preference.PreferenceManager;
+ import android.util.Log;
+ import android.view.View;
+ import android.widget.Button;
  import android.widget.TextView;
  import android.widget.Toast;
- import android.widget.TextView;
- import android.widget.Button;
- import android.view.View;
- import android.util.Log;
  
  public class Dumload extends Activity {
+       
+       private SharedPreferences prefs;
+       
        /** Called when the activity is first created. */
        @Override
        public void onCreate(Bundle savedInstanceState) {
                super.onStart();
                final Dumload thisact = this;
                
+               prefs = PreferenceManager.getDefaultSharedPreferences(this);
+               
                Intent i = getIntent(); /* i *am* not an intent! */
                
                if (!i.getAction().equals(Intent.ACTION_SEND))
                {
-                       say("Unknown intent for dumload");
-                       this.finish();
+ //                    say("Unknown intent for dumload");
+ //                    this.finish();
+                       Intent pi = new Intent(this, Preferences.class);
+                       startActivity(pi);
                        return;
                }
                
@@@ -84,7 -72,7 +88,7 @@@
                
                
                ((TextView) findViewById(R.id.suckit)).setText("Where to?");
-               ((TextView) findViewById(R.id.entry)).setText("/var/www/" + uribase.substring(uribase.lastIndexOf("/") + 1) + ".jpg");
+               ((TextView) findViewById(R.id.entry)).setText(prefs.getString("defaultUploadPath", "/var/www/") + uribase.substring(uribase.lastIndexOf("/") + 1) + ".jpg");
                
        }
  }
index ce6bc6f2356a942f6aec58d90d6f8b43ce840e82,15d1ad182c2eef9102fc9dbe3f43caf6046b1448..197e62684a05fa7a26a06dfc1e65468a0d28e80e
@@@ -1,39 -1,18 +1,34 @@@
 +/* NotifSlave.java
 + * Notification interface glue for Dumload.
 + *
 + * This program is free software: you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License, version 3, as
 + * published by the Free Software Foundation.
 + *
 + * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
  package com.joshuawise.dumload;
  
- import java.io.InputStream;
  import android.app.Activity;
- import android.app.Service;
+ import android.app.AlertDialog;
+ import android.app.Dialog;
+ import android.content.DialogInterface;
  import android.content.Intent;
- import android.net.Uri;
  import android.os.Bundle;
- import android.os.IBinder;
- import android.widget.TextView;
- import android.widget.Button;
+ import android.os.Message;
+ import android.os.Messenger;
+ import android.util.Log;
  import android.view.View;
+ import android.widget.Button;
+ import android.widget.TextView;
  import android.widget.Toast;
- import android.util.Log;
- import android.os.Messenger;
- import android.os.Message;
- import android.app.AlertDialog;
- import android.app.Dialog;
- import android.content.DialogInterface;
  
  public class NotifSlave extends Activity {
        /** Called when the activity is first created. */
index 12f71e280bf08ab896d237d2b2e8ee179b7d4f1e,d81441afdeeacb34a207d409963f9db3ecead785..6aa3317fdcd6ea5e03571f67f3f43d943c2e7791
@@@ -1,46 -1,34 +1,50 @@@
 +/* Uploader.java
 + * Back-end upload logic for Dumload.
 + *
 + * This program is free software: you can redistribute it and/or modify it
 + * under the terms of the GNU General Public License, version 3, as
 + * published by the Free Software Foundation.
 + *
 + * This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.
 + */
 +
  package com.joshuawise.dumload;
  
  import java.io.InputStream;
  import java.io.OutputStream;
  
- import com.jcraft.jsch.*;
- import java.lang.Boolean;
- import android.app.Activity;
- import android.app.Service;
- import android.content.Intent;
+ import android.app.Notification;
+ import android.app.NotificationManager;
  import android.app.PendingIntent;
+ import android.app.Service;
  import android.content.Context;
+ import android.content.Intent;
+ import android.content.SharedPreferences;
  import android.net.Uri;
  import android.os.Bundle;
- import android.os.IBinder;
- import android.widget.TextView;
- import android.widget.Toast;
- import android.util.Log;
- import android.app.NotificationManager;
- import android.app.Notification;
  import android.os.Handler;
- import android.os.Messenger;
+ import android.os.IBinder;
  import android.os.Looper;
  import android.os.Message;
+ import android.os.Messenger;
  import android.os.SystemClock;
+ import android.preference.PreferenceManager;
+ import android.util.Log;
  import android.widget.RemoteViews;
+ import android.widget.Toast;
+ import com.jcraft.jsch.Channel;
+ import com.jcraft.jsch.ChannelExec;
+ import com.jcraft.jsch.JSch;
+ import com.jcraft.jsch.Session;
+ import com.jcraft.jsch.UIKeyboardInteractive;
+ import com.jcraft.jsch.UserInfo;
  
  public class Uploader extends Service implements Runnable, UserInfo, UIKeyboardInteractive {
        private Uri uri;
                mNotificationManager.notify(thenotifid, thenotif);
        }
        
-       @Override
        public void run()
        {
                Looper.prepare();
                                jsch.addIdentity(homedir + "/id_dsa");
                        } catch (java.lang.Exception e) {
                        }
-                       Session s = jsch.getSession("joshua", "nyus.joshuawise.com", 22);
+                       try {
+                               jsch.addIdentity(homedir + "/id_dsa_generated");
+                       } catch (java.lang.Exception e) {
+                       }
+                       SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
+                       String server = prefs.getString("server", "").trim();
+                       String userName = prefs.getString("userName", "").trim();
+                       Integer port = Integer.valueOf(prefs.getString("port", "22"));
+                       Log.d("dbg", userName + "@" + server + ":" + port);
+                       Session s = jsch.getSession(userName, server, port);
                        s.setUserInfo(this);
                        s.connect();
                        
                dest = i.getStringExtra("com.joshuawise.dumload.dest");
                homedir = getApplicationContext().getFilesDir().getAbsolutePath();
                int shits = 0;
+               int giggles = 1;
                
                super.onStart(i, startId);
                
This page took 0.037262 seconds and 4 git commands to generate.