linuxdcpp-team team mailing list archive
-
linuxdcpp-team team
-
Mailing list archive
-
Message #03818
[Branch ~linuxdcpp-team/linuxdcpp/trunk] Rev 418: lp#546227 possibility to queue magnet directly
------------------------------------------------------------
revno: 418
committer: Razzloss <razzloss@xxxxxxxxx>
branch nick: master
timestamp: Mon 2011-04-04 19:31:38 +0300
message:
lp#546227 possibility to queue magnet directly
modified:
Changelog.txt
data/linuxdcpp.1
glade/mainwindow.glade
linux/mainwindow.cc
linux/mainwindow.hh
linux/wulfor.cc
po/linuxdcpp.pot
--
lp:linuxdcpp
https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk
Your team LinuxDC++ Team is subscribed to branch lp:linuxdcpp.
To unsubscribe from this branch go to https://code.launchpad.net/~linuxdcpp-team/linuxdcpp/trunk/+edit-subscription
=== modified file 'Changelog.txt'
--- Changelog.txt 2011-03-18 11:15:56 +0000
+++ Changelog.txt 2011-04-04 16:31:38 +0000
@@ -66,6 +66,7 @@
[2011-02-02] lp#311482: Internationalization support. (Steven)
[2011-03-07] lp#329805: Use Desktop Environment's default download folder. (Steven)
[2011-03-15] lp#735124: Fix crash with previous if the default download folder isn't set. (Razzloss)
+[2011-04-04] lp#546227: Possibility to enqueue a magnet link directly. (thanks lagalopex)
*** 1.0.3 2009-02-01 ***
[2008-08-10] lp#256236: Fixed a crash on startup when using auto-open options.
=== modified file 'data/linuxdcpp.1'
--- data/linuxdcpp.1 2010-03-23 01:35:22 +0000
+++ data/linuxdcpp.1 2011-04-04 16:31:38 +0000
@@ -24,9 +24,12 @@
.B "-h, --help"
Show help options
.TP
-.BI "-m, --magnet=" URI
+.BI "-m, --search-magnet=" URI
Search for the given magnet link
.TP
+.BI "-a, --add--magnet=" URI
+If possible enqueue magnet directly. Magnet must contain a TTH, filename and a file size.
+.TP
.B "-r, --refresh"
Initiate filelist refresh
.TP
=== modified file 'glade/mainwindow.glade'
--- glade/mainwindow.glade 2011-03-05 20:57:50 +0000
+++ glade/mainwindow.glade 2011-04-04 16:31:38 +0000
@@ -861,6 +861,7 @@
Jakh Daven
Andrew Browne
DjSlash
+ lagalopex
</property>
<property name="artists">Johannes Sjölund</property>
<property name="translator_credits" translatable="yes" comments="Please do not translate. Launchpad will automatically replace this text with the names of the translators for the current language.">translator-credits</property>
=== modified file 'linux/mainwindow.cc'
--- linux/mainwindow.cc 2011-03-08 00:14:03 +0000
+++ linux/mainwindow.cc 2011-04-04 16:31:38 +0000
@@ -1300,6 +1300,14 @@
}
}
+void MainWindow::addDownload_client(string name, string tth, int64_t size)
+{
+ name = SETTING(DOWNLOAD_DIRECTORY) + name;
+ UserPtr dummyuser(new User(CID::generate()));
+ QueueManager::getInstance()->add(name, size, TTHValue(tth), dummyuser, "");
+ QueueManager::getInstance()->removeSource(name, dummyuser, QueueItem::Source::FLAG_REMOVED);
+}
+
void MainWindow::openOwnList_client(bool useSetting)
{
UserPtr user = ClientManager::getInstance()->getMe();
@@ -1389,10 +1397,28 @@
F0 *func = new F0((MainWindow *)data, &MainWindow::refreshFileList_client);
WulforManager::get()->dispatchClientFunc(func);
}
- else if (cmd == "magnet")
+ else if (cmd == "search-magnet")
{
mw->addMagnetSearch_gui(arg);
}
+ else if (cmd == "add-magnet")
+ {
+ string name;
+ int64_t size;
+ string tth;
+
+ if (WulforUtil::splitMagnet(arg, name, size, tth))
+ {
+ if (name == _("Unknown") || size == 0 || tth == _("Unknown"))
+ mw->addMagnetSearch_gui(arg);
+ else
+ {
+ typedef Func3<MainWindow, string, string, int64_t> F3;
+ F3 *func = new F3(mw, &MainWindow::addDownload_client, name, tth, size);
+ WulforManager::get()->dispatchClientFunc(func);
+ }
+ }
+ }
else if (cmd == "connect")
{
mw->showHub_gui(arg);
=== modified file 'linux/mainwindow.hh'
--- linux/mainwindow.hh 2011-02-08 06:21:39 +0000
+++ linux/mainwindow.hh 2011-04-04 16:31:38 +0000
@@ -144,6 +144,7 @@
void autoConnect_client();
void startSocket_client();
void refreshFileList_client();
+ void addDownload_client(std::string name, std::string tth, int64_t size);
// Client callbacks
virtual void on(dcpp::LogManagerListener::Message, time_t t, const std::string &m) throw();
=== modified file 'linux/wulfor.cc'
--- linux/wulfor.cc 2011-03-15 04:56:58 +0000
+++ linux/wulfor.cc 2011-04-04 16:31:38 +0000
@@ -35,7 +35,8 @@
#include <signal.h>
struct CommandlineArgs {
- std::vector<std::string> magnets;
+ std::vector<std::string> searchmagnets;
+ std::vector<std::string> addmagnets;
std::vector<std::string> urls;
bool show;
bool refresh;
@@ -67,19 +68,20 @@
if (WulforUtil::isHubURL(arg))
args->urls.push_back(arg);
else if (WulforUtil::isMagnet(arg))
- args->magnets.push_back(arg);
+ args->addmagnets.push_back(arg);
}
}
bool parseArguments(int *argc, char **argv[], CommandlineArgs* args)
{
- gchar **magnet = NULL, **address = NULL;
+ gchar **searchmagnet = NULL, **address = NULL, **addmagnet = NULL;
gboolean show = FALSE, refresh = FALSE, version = FALSE, existing = FALSE;
GOptionEntry entries[] = {
{ "connect", 'c', 0, G_OPTION_ARG_STRING_ARRAY, &address, N_("Connect to the given hub"), N_("URI") },
{ "existing", 'e', 0, G_OPTION_ARG_NONE, &existing, N_("Send commands to the existing instance (if applicable)"), NULL },
- { "magnet", 'm', 0, G_OPTION_ARG_STRING_ARRAY, &magnet, N_("Search for the given magnet link"), N_("URI") },
+ { "search-magnet", 'm', 0, G_OPTION_ARG_STRING_ARRAY, &searchmagnet, N_("Search for the given magnet link"), N_("URI") },
+ { "add-magnet", 'a', 0, G_OPTION_ARG_STRING_ARRAY, &addmagnet, N_("Try to add given magnet directly to download queue"), N_("URI") },
{ "refresh", 'r', 0, G_OPTION_ARG_NONE, &refresh, N_("Initiate filelist refresh"), NULL },
{ "show", 's', 0, G_OPTION_ARG_NONE, &show, N_("Show the running instance (default action)"), NULL },
{ "version", 'v', 0, G_OPTION_ARG_NONE, &version, N_("Show version information and exit"), NULL },
@@ -109,12 +111,19 @@
args->version = TRUE;
if (existing)
args->existing = TRUE;
- if (magnet)
- {
- int i = 0;
- for (gchar* it = magnet[0]; it != NULL; it = magnet[++i])
- args->magnets.push_back(std::string(it));
- g_strfreev(magnet);
+ if (searchmagnet)
+ {
+ int i = 0;
+ for (gchar* it = searchmagnet[0]; it != NULL; it = searchmagnet[++i])
+ args->searchmagnets.push_back(std::string(it));
+ g_strfreev(searchmagnet);
+ }
+ if (addmagnet)
+ {
+ int i = 0;
+ for (gchar* it = addmagnet[0]; it != NULL; it = addmagnet[++i])
+ args->addmagnets.push_back(std::string(it));
+ g_strfreev(addmagnet);
}
if (address)
{
@@ -138,10 +147,15 @@
int retval = 1;
if (args.refresh)
retval = WulforUtil::writeIPCCommand("refresh");
- for (std::vector<std::string>::const_iterator it = args.magnets.begin();
- retval > 0 && it != args.magnets.end(); ++it)
- {
- retval = WulforUtil::writeIPCCommand(std::string("magnet ") + *it);
+ for (std::vector<std::string>::const_iterator it = args.searchmagnets.begin();
+ retval > 0 && it != args.searchmagnets.end(); ++it)
+ {
+ retval = WulforUtil::writeIPCCommand(std::string("search-magnet ") + *it);
+ }
+ for (std::vector<std::string>::const_iterator it = args.addmagnets.begin();
+ retval > 0 && it != args.addmagnets.end(); ++it)
+ {
+ retval = WulforUtil::writeIPCCommand(std::string("add-magnet ") + *it);
}
for (std::vector<std::string>::const_iterator it = args.urls.begin();
retval > 0 && it != args.urls.end(); ++it)
=== modified file 'po/linuxdcpp.pot'
--- po/linuxdcpp.pot 2011-03-28 05:34:08 +0000
+++ po/linuxdcpp.pot 2011-04-04 16:31:38 +0000
@@ -8,7 +8,7 @@
"#-#-#-#-# glade.pot #-#-#-#-#\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://translations.launchpad.net/linuxdcpp\n"
-"POT-Creation-Date: 2011-03-07 18:26-0600\n"
+"POT-Creation-Date: 2011-04-04 19:30+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -19,7 +19,7 @@
"#-#-#-#-# linux.pot #-#-#-#-#\n"
"Project-Id-Version: \n"
"Report-Msgid-Bugs-To: https://translations.launchpad.net/linuxdcpp\n"
-"POT-Creation-Date: 2011-03-28 00:31-0500\n"
+"POT-Creation-Date: 2011-04-04 19:30+0300\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@xxxxxx>\n"
@@ -468,7 +468,7 @@
msgid "Leave unchecked for default value"
msgstr ""
-#: glade/mainwindow.glade:9 linux/wulfor.cc:229
+#: glade/mainwindow.glade:9 linux/wulfor.cc:243
msgid "LinuxDC++"
msgstr ""
@@ -476,7 +476,7 @@
msgid "Logging"
msgstr ""
-#: glade/mainwindow.glade:1040
+#: glade/mainwindow.glade:1041
msgid "Magnet Properties"
msgstr ""
@@ -680,7 +680,7 @@
msgid "Select a Folder"
msgstr ""
-#: glade/mainwindow.glade:884
+#: glade/mainwindow.glade:885
msgid "Select filelist to browse"
msgstr ""
@@ -766,7 +766,7 @@
msgid "Use SOCKS5 server to resolve _hostnames"
msgstr ""
-#: glade/mainwindow.glade:933
+#: glade/mainwindow.glade:934
msgid "User Command Argument"
msgstr ""
@@ -909,7 +909,7 @@
msgid "_Encoding:"
msgstr ""
-#: glade/mainwindow.glade:1173
+#: glade/mainwindow.glade:1174
msgid "_Exact size:"
msgstr ""
@@ -925,7 +925,7 @@
msgid "_File list transfers"
msgstr ""
-#: glade/mainwindow.glade:1072
+#: glade/mainwindow.glade:1073
msgid "_Filename"
msgstr ""
@@ -986,7 +986,7 @@
msgid "_Lowest"
msgstr ""
-#: glade/mainwindow.glade:1059
+#: glade/mainwindow.glade:1060
msgid "_Magnet:"
msgstr ""
@@ -1160,11 +1160,11 @@
msgid "_Share hidden files"
msgstr ""
-#: glade/mainwindow.glade:1020
+#: glade/mainwindow.glade:1021
msgid "_Show Interface"
msgstr ""
-#: glade/mainwindow.glade:1087
+#: glade/mainwindow.glade:1088
msgid "_Size:"
msgstr ""
@@ -1176,7 +1176,7 @@
msgid "_TCP:"
msgstr ""
-#: glade/mainwindow.glade:1102
+#: glade/mainwindow.glade:1103
msgid "_TTH:"
msgstr ""
@@ -1235,7 +1235,7 @@
msgstr ""
#. Please do not translate. Launchpad will automatically replace this text with the names of the translators for the current language.
-#: glade/mainwindow.glade:866
+#: glade/mainwindow.glade:867
msgid "translator-credits"
msgstr ""
@@ -1312,7 +1312,7 @@
msgstr[1] ""
#. TRANSLATORS: Application version printed on the command line.
-#: linux/wulfor.cc:50
+#: linux/wulfor.cc:51
#, boost-format
msgid "%1% version: %2%"
msgstr ""
@@ -1496,7 +1496,7 @@
msgid "Connect failed: %1%"
msgstr ""
-#: linux/wulfor.cc:80
+#: linux/wulfor.cc:81
msgid "Connect to the given hub"
msgstr ""
@@ -1522,7 +1522,7 @@
msgstr ""
#. TRANSLATORS: DC++ core library version printed on the command line.
-#: linux/wulfor.cc:53
+#: linux/wulfor.cc:54
#, boost-format
msgid "DC++ library version: %1%"
msgstr ""
@@ -1571,7 +1571,7 @@
msgid "Download failed: %1%"
msgstr ""
-#: linux/mainwindow.cc:1431 linux/publichubs.cc:446 linux/transfers.cc:930
+#: linux/mainwindow.cc:1457 linux/publichubs.cc:446 linux/transfers.cc:930
#: linux/transfers.cc:1031
msgid "Download finished"
msgstr ""
@@ -1636,7 +1636,7 @@
msgid "Exact Size"
msgstr ""
-#: linux/wulfor.cc:195
+#: linux/wulfor.cc:209
#, boost-format
msgid "Failed to communicate with existing instance: %1%"
msgstr ""
@@ -1671,7 +1671,7 @@
"adjusted or any application using the port is closed."
msgstr ""
-#: linux/wulfor.cc:95
+#: linux/wulfor.cc:97
msgid "File-sharing client for the Direct Connect network"
msgstr ""
@@ -1711,13 +1711,13 @@
msgstr ""
#. TRANSLATORS: GLib version in major.minor.micro format printed on the command line.
-#: linux/wulfor.cc:59
+#: linux/wulfor.cc:60
#, boost-format
msgid "GLib version: %1%.%2%.%3%"
msgstr ""
#. TRANSLATORS: GTK+ version in major.minor.micro format printed on the command line.
-#: linux/wulfor.cc:56
+#: linux/wulfor.cc:57
#, boost-format
msgid "GTK+ version: %1%.%2%.%3%"
msgstr ""
@@ -1786,7 +1786,7 @@
msgid "Ignored private message from hub"
msgstr ""
-#: linux/wulfor.cc:83
+#: linux/wulfor.cc:85
msgid "Initiate filelist refresh"
msgstr ""
@@ -1879,7 +1879,7 @@
msgid "No matches"
msgstr ""
-#: linux/wulfor.cc:217
+#: linux/wulfor.cc:231
msgid "No running instance found"
msgstr ""
@@ -1923,7 +1923,7 @@
msgid "Open new private messages from other users in the background"
msgstr ""
-#: linux/wulfor.cc:99
+#: linux/wulfor.cc:101
#, boost-format
msgid "Option parsing failed: %1%"
msgstr ""
@@ -1979,7 +1979,7 @@
msgid "SJIS (Japanese)"
msgstr ""
-#: linux/wulfor.cc:82
+#: linux/wulfor.cc:83
msgid "Search for the given magnet link"
msgstr ""
@@ -2004,7 +2004,7 @@
"or any application using the port is closed."
msgstr ""
-#: linux/wulfor.cc:81
+#: linux/wulfor.cc:82
msgid "Send commands to the existing instance (if applicable)"
msgstr ""
@@ -2033,7 +2033,7 @@
msgid "Show status icon"
msgstr ""
-#: linux/wulfor.cc:84
+#: linux/wulfor.cc:86
msgid "Show the running instance (default action)"
msgstr ""
@@ -2041,7 +2041,7 @@
msgid "Show timestamps in chat by default"
msgstr ""
-#: linux/wulfor.cc:85
+#: linux/wulfor.cc:87
msgid "Show version information and exit"
msgstr ""
@@ -2140,11 +2140,15 @@
msgid "Total share size: %1%"
msgstr ""
+#: linux/wulfor.cc:84
+msgid "Try to add given magnet directly to download queue"
+msgstr ""
+
#: linux/search.cc:87 linux/sharebrowser.cc:72
msgid "Type"
msgstr ""
-#: linux/wulfor.cc:80 linux/wulfor.cc:82
+#: linux/wulfor.cc:81 linux/wulfor.cc:83 linux/wulfor.cc:84
msgid "URI"
msgstr ""
@@ -2153,7 +2157,7 @@
msgid "UTF-8 (Unicode)"
msgstr ""
-#: linux/wulfor.cc:203
+#: linux/wulfor.cc:217
msgid ""
"Unable to communicate with existing instance and only one instance is "
"allowed per profile."
@@ -2180,6 +2184,10 @@
msgid "Unable to open UDP port"
msgstr ""
+#: linux/mainwindow.cc:1412
+msgid "Unknown"
+msgstr ""
+
#: linux/WulforUtil.cc:251 linux/WulforUtil.cc:253
msgctxt "Magnet"
msgid "Unknown"
@@ -2284,7 +2292,7 @@
msgid "[T]"
msgstr ""
-#: linux/wulfor.cc:91
+#: linux/wulfor.cc:93
msgid "[URI...]"
msgstr ""