Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -rupN orig2/daemon/daemon.c orig/daemon/daemon.c
- --- orig2/daemon/daemon.c 2014-10-13 22:24:47.619262656 +0300
- +++ orig/daemon/daemon.c 2014-10-13 22:24:59.835910372 +0300
- @@ -264,7 +264,16 @@ onFileAdded (tr_session * session, const
- {
- char * filename = tr_buildPath (dir, file, NULL);
- tr_ctor * ctor = tr_ctorNew (session);
- - int err = tr_ctorSetMetainfoFromFile (ctor, filename);
- + int err;
- + if (tr_str_has_suffix (file, ".torrent"))
- + err = tr_ctorSetMetainfoFromFile (ctor, filename);
- + else {
- + char * link;
- + size_t len;
- + link = (char*)tr_loadFile (filename,&len);
- + err = tr_ctorSetMetainfoFromMagnetLink (ctor, link);
- + tr_free(link);
- + }
- if (!err)
- {
- diff -rupN orig2/daemon/watch.c orig/daemon/watch.c
- --- orig2/daemon/watch.c 2014-10-13 22:24:47.619262656 +0300
- +++ orig/daemon/watch.c 2014-10-13 22:25:06.229233796 +0300
- @@ -85,7 +85,7 @@ watchdir_new_impl (dtr_watchdir * w)
- {
- const char * name = d->d_name;
- - if (!tr_str_has_suffix (name, ".torrent")) /* skip non-torrents */
- + if (!tr_str_has_suffix (name, ".torrent") && !tr_str_has_suffix (name, ".magnet") ) /* skip non-torrents */
- continue;
- tr_logAddInfo ("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir);
- @@ -135,7 +135,7 @@ watchdir_update_impl (dtr_watchdir * w)
- while (i < len) {
- struct inotify_event * event = (struct inotify_event *) &buf[i];
- const char * name = event->name;
- - if (tr_str_has_suffix (name, ".torrent"))
- + if (tr_str_has_suffix (name, ".torrent") || tr_str_has_suffix (name, ".magnet") )
- {
- tr_logAddInfo ("Found new .torrent file \"%s\" in watchdir \"%s\"", name, w->dir);
- w->callback (w->session, w->dir, name);
- @@ -216,7 +216,7 @@ watchdir_update_impl (dtr_watchdir * w)
- if (!name || *name=='.') /* skip dotfiles */
- continue;
- - if (!tr_str_has_suffix (name, ".torrent")) /* skip non-torrents */
- + if (!tr_str_has_suffix (name, ".torrent") && !tr_str_has_suffix (name, ".magnet") ) /* skip non-torrents */
- continue;
- len = strlen (name);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement