Merge lp:~sergiusens/nuntium/uploads into lp:nuntium

Proposed by Sergio Schvezov
Status: Merged
Approved by: Manuel de la Peña
Approved revision: 49
Merged at revision: 46
Proposed branch: lp:~sergiusens/nuntium/uploads
Merge into: lp:nuntium
Prerequisite: lp:~sergiusens/nuntium/telepathy_switch
Diff against target: 730 lines (+64/-574)
5 files modified
debian/control (+2/-1)
mediator.go (+17/-16)
mms/download.go (+37/-4)
ofono/modem.go (+8/-1)
udm/udm.go (+0/-552)
To merge this branch: bzr merge lp:~sergiusens/nuntium/uploads
Reviewer Review Type Date Requested Status
Manuel de la Peña (community) Approve
Review via email: mp+225144@code.launchpad.net

Commit message

Upload support while moving udm to it's new package namespace

To post a comment you must log in.
Revision history for this message
Manuel de la Peña (mandel) :
review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/control'
2--- debian/control 2014-05-13 17:06:46 +0000
3+++ debian/control 2014-07-01 12:18:20 +0000
4@@ -10,6 +10,7 @@
5 golang-go-dbus-dev,
6 golang-go-xdg-dev,
7 golang-gocheck-dev,
8+ golang-udm-dev,
9 Standards-Version: 3.9.5
10 Homepage: https://launchpad.net/nuntium
11 Vcs-Browser: http://bazaar.launchpad.net/~phablet-team/nuntium/trunk/files
12@@ -17,7 +18,7 @@
13
14 Package: nuntium
15 Architecture: any
16-Depends: ofono, ubuntu-download-manager, ${misc:Depends}, ${shlibs:Depends}
17+Depends: ofono, ubuntu-download-manager, ubuntu-upload-manager, ${misc:Depends}, ${shlibs:Depends}
18 Built-Using: ${misc:Built-Using}
19 Recommends: telepathy-ofono
20 Conflicts: mmsd
21
22=== modified file 'mediator.go'
23--- mediator.go 2014-05-12 13:47:34 +0000
24+++ mediator.go 2014-07-01 12:18:20 +0000
25@@ -190,7 +190,9 @@
26 }
27 mediator.NewMRetrieveConf <- mRetrieveConf
28 if mediator.telepathyService != nil {
29- mediator.telepathyService.MessageAdded(mRetrieveConf)
30+ if err := mediator.telepathyService.MessageAdded(mRetrieveConf); err != nil {
31+ log.Println("Cannot notify telepathy-ofono about new message", err)
32+ }
33 } else {
34 log.Print("Not sending recently retrieved message")
35 }
36@@ -226,23 +228,22 @@
37 func (mediator *Mediator) sendMNotifyRespInd(mNotifyRespIndFile string) {
38 defer os.Remove(mNotifyRespIndFile)
39 if err := mediator.uploadFile(mNotifyRespIndFile); err != nil {
40- log.Printf("Cannot upload m-notifyresp.ind encoded file %s to message center", mNotifyRespIndFile)
41+ log.Printf("Cannot upload m-notifyresp.ind encoded file %s to message center: %s", mNotifyRespIndFile, err)
42 }
43 }
44
45 func (mediator *Mediator) uploadFile(filePath string) error {
46- // TODO Upload file part
47- /*
48- mmsContext, err := mediator.modem.ActivateMMSContext()
49- if err != nil {
50- log.Print("Cannot activate ofono context: ", err)
51- return
52- }
53- proxy, err := mmsContext.GetProxy()
54- if err != nil {
55- log.Print("Error retrieving proxy: ", err)
56- return
57- }
58- */
59- return nil
60+ mmsContext, err := mediator.modem.ActivateMMSContext()
61+ if err != nil {
62+ return err
63+ }
64+ proxy, err := mmsContext.GetProxy()
65+ if err != nil {
66+ return err
67+ }
68+ msc, err := mmsContext.GetMessageCenter()
69+ if err != nil {
70+ return err
71+ }
72+ return mms.Upload(filePath, msc, proxy.Host, int32(proxy.Port))
73 }
74
75=== modified file 'mms/download.go'
76--- mms/download.go 2014-04-30 14:24:26 +0000
77+++ mms/download.go 2014-07-01 12:18:20 +0000
78@@ -22,26 +22,27 @@
79 package mms
80
81 import (
82+ "errors"
83 "fmt"
84 "log"
85 "time"
86
87- "launchpad.net/nuntium/udm"
88+ "launchpad.net/udm"
89 )
90
91-func (pdu *MNotificationInd) DownloadContent(proxyHostname string, proxyPort int32) (string, error) {
92+func (pdu *MNotificationInd) DownloadContent(proxyHost string, proxyPort int32) (string, error) {
93 downloadManager, err := udm.NewDownloadManager()
94 if err != nil {
95 return "", err
96 }
97- download, err := downloadManager.CreateMmsDownload(pdu.ContentLocation, proxyHostname, proxyPort)
98+ download, err := downloadManager.CreateMmsDownload(pdu.ContentLocation, proxyHost, proxyPort)
99 if err != nil {
100 return "", err
101 }
102 f := download.Finished()
103 p := download.DownloadProgress()
104 e := download.Error()
105- log.Print("Starting download")
106+ log.Print("Starting download of ", pdu.ContentLocation, " with proxy ", proxyHost, ":", proxyPort)
107 download.Start()
108 for {
109 select {
110@@ -57,3 +58,35 @@
111 }
112 }
113 }
114+
115+func Upload(file, msc, proxyHost string, proxyPort int32) error {
116+ udm, err := udm.NewUploadManager()
117+ if err != nil {
118+ return err
119+ }
120+ upload, err := udm.CreateMmsUpload(msc, file, proxyHost, proxyPort)
121+ if err != nil {
122+ return err
123+ }
124+ f := upload.Finished()
125+ p := upload.UploadProgress()
126+ e := upload.Error()
127+ log.Print("Starting upload of ", file, " to ", msc, " with proxy ", proxyHost, ":", proxyPort)
128+ if err := upload.Start(); err != nil {
129+ return err
130+ }
131+
132+ for {
133+ select {
134+ case progress := <-p:
135+ log.Print("Progress:", progress.Total, progress.Received)
136+ case f := <-f:
137+ log.Print("File ", f, " uploaded")
138+ return nil
139+ case <-time.After(10 * time.Minute):
140+ return errors.New("upload timeout")
141+ case err := <-e:
142+ return err
143+ }
144+ }
145+}
146
147=== modified file 'ofono/modem.go'
148--- ofono/modem.go 2014-05-13 11:29:13 +0000
149+++ ofono/modem.go 2014-07-01 12:18:20 +0000
150@@ -244,6 +244,14 @@
151 return reflect.ValueOf(oContext.Properties["Active"].Value).Bool()
152 }
153
154+func (oContext OfonoContext) GetMessageCenter() (string, error) {
155+ if msc := reflect.ValueOf(oContext.Properties["MessageCenter"].Value).String(); msc != "" {
156+ return msc, nil
157+ } else {
158+ return "", errors.New("context setting for the Message Center value is empty")
159+ }
160+}
161+
162 func (oContext OfonoContext) GetProxy() (proxyInfo ProxyInfo, err error) {
163 proxy := reflect.ValueOf(oContext.Properties["MessageProxy"].Value).String()
164 if strings.HasPrefix(proxy, "http://") {
165@@ -254,7 +262,6 @@
166 if err != nil {
167 proxyInfo.Host = proxy
168 proxyInfo.Port = 80
169- fmt.Println("Setting proxy to:", proxyInfo)
170 return proxyInfo, nil
171 }
172 proxyInfo.Port, err = strconv.ParseUint(portString, 0, 64)
173
174=== removed directory 'udm'
175=== removed file 'udm/udm.go'
176--- udm/udm.go 2014-04-24 21:33:38 +0000
177+++ udm/udm.go 1970-01-01 00:00:00 +0000
178@@ -1,552 +0,0 @@
179-/*
180- * Copyright 2014 Canonical Ltd.
181- *
182- * Authors:
183- * Manuel de la Pena: manuel.delapena@canonical.com
184- *
185- * This file is part of ubuntu-download-manager.
186- *
187- * ubuntu-download-manager is free software; you can redistribute it and/or modify
188- * it under the terms of the GNU General Public License as published by
189- * the Free Software Foundation; version 3.
190- *
191- * ubuntu-download-manager is distributed in the hope that it will be useful,
192- * but WITHOUT ANY WARRANTY; without even the implied warranty of
193- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
194- * GNU General Public License for more details.
195- *
196- * You should have received a copy of the GNU General Public License
197- * along with this program. If not, see <http://www.gnu.org/licenses/>.
198- */
199-
200-// Package udm provides a go interface to work with the ubuntu download manager
201-package udm
202-
203-import (
204- "errors"
205- "runtime"
206-
207- "launchpad.net/go-dbus/v1"
208-)
209-
210-const (
211- DOWNLOAD_SERVICE = "com.canonical.applications.Downloader"
212- DOWNLOAD_INTERFACE = "com.canonical.applications.Download"
213- DOWNLOAD_MANAGER_INTERFACE = "com.canonical.applications.DownloadManager"
214-)
215-
216-type hashType string
217-
218-const (
219- MD5 hashType = "md5"
220- SHA1 hashType = "sha1"
221- SHA224 hashType = "sha224"
222- SHA256 hashType = "sha256"
223- SHA384 hashType = "sha384"
224- SHA512 hashType = "sha512"
225-)
226-
227-const (
228- LOCAL_PATH = "local-path"
229- OBJECT_PATH = "objectpath"
230- POST_DOWNLOAD_COMMAND = "post-download-command"
231-)
232-
233-// Progress provides how much progress has been performed in a download that was
234-// already started.
235-type Progress struct {
236- Received uint64
237- Total uint64
238-}
239-
240-// Download is the common interface of a download. It provides all the required
241-// methods to interact with a download created by udm.
242-type Download interface {
243- TotalSize() (uint64, error)
244- Progress() (uint64, error)
245- Metadata() (map[string]string, error)
246- SetThrottle(uint64) error
247- Throttle() (uint64, error)
248- AllowMobileDownload(bool) error
249- IsMobileDownload() (bool, error)
250- Start() error
251- Pause() error
252- Resume() error
253- Cancel() error
254- Started() chan bool
255- Paused() chan bool
256- DownloadProgress() chan Progress
257- Resumed() chan bool
258- Canceled() chan bool
259- Finished() chan string
260- Error() chan error
261-}
262-
263-// Manager is the single point of entry of the API. Allows to interact with the
264-// general setting of udm as well as to create downloads at will.
265-type Manager interface {
266- CreateDownload(string, string, string, map[string]interface{}, map[string]string) (Download, error)
267- CreateMmsDownload(string, string, int, string, string) (Download, error)
268-}
269-
270-// FileDownload represents a single file being downloaded by udm.
271-type FileDownload struct {
272- conn *dbus.Connection
273- proxy *dbus.ObjectProxy
274- path dbus.ObjectPath
275- started chan bool
276- started_w *dbus.SignalWatch
277- paused chan bool
278- paused_w *dbus.SignalWatch
279- resumed chan bool
280- resumed_w *dbus.SignalWatch
281- canceled chan bool
282- canceled_w *dbus.SignalWatch
283- finished chan string
284- finished_w *dbus.SignalWatch
285- errors chan error
286- error_w *dbus.SignalWatch
287- progress chan Progress
288- progress_w *dbus.SignalWatch
289-}
290-
291-func connectToSignal(conn *dbus.Connection, path dbus.ObjectPath, signal string) (*dbus.SignalWatch, error) {
292- w, err := conn.WatchSignal(&dbus.MatchRule{
293- Type: dbus.TypeSignal,
294- Sender: DOWNLOAD_SERVICE,
295- Interface: DOWNLOAD_INTERFACE,
296- Member: signal,
297- Path: path})
298- return w, err
299-}
300-
301-func (down *FileDownload) free() {
302- // cancel all watches so that goroutines are done and close the
303- // channels
304- down.started_w.Cancel()
305- down.paused_w.Cancel()
306- down.resumed_w.Cancel()
307- down.canceled_w.Cancel()
308- down.finished_w.Cancel()
309- down.error_w.Cancel()
310- down.progress_w.Cancel()
311-}
312-
313-func cleanDownloadData(down *FileDownload) {
314- down.free()
315-}
316-
317-func newFileDownload(conn *dbus.Connection, path dbus.ObjectPath) (*FileDownload, error) {
318- proxy := conn.Object(DOWNLOAD_SERVICE, path)
319- started_ch := make(chan bool)
320- started_w, err := connectToSignal(conn, path, "started")
321- if err != nil {
322- return nil, err
323- }
324-
325- paused_ch := make(chan bool)
326- paused_w, err := connectToSignal(conn, path, "paused")
327- if err != nil {
328- return nil, err
329- }
330-
331- resumed_ch := make(chan bool)
332- resumed_w, err := connectToSignal(conn, path, "resumed")
333- if err != nil {
334- return nil, err
335- }
336-
337- canceled_ch := make(chan bool)
338- canceled_w, err := connectToSignal(conn, path, "canceled")
339- if err != nil {
340- return nil, err
341- }
342-
343- finished_ch := make(chan string)
344- finished_w, err := connectToSignal(conn, path, "finished")
345- if err != nil {
346- return nil, err
347- }
348-
349- errors_ch := make(chan error)
350- errors_w, err := connectToSignal(conn, path, "error")
351- if err != nil {
352- return nil, err
353- }
354-
355- progress_ch := make(chan Progress)
356- progress_w, err := connectToSignal(conn, path, "progress")
357- if err != nil {
358- return nil, err
359- }
360-
361- d := FileDownload{conn, proxy, path, started_ch, started_w, paused_ch, paused_w, resumed_ch, resumed_w, canceled_ch, canceled_w, finished_ch, finished_w, errors_ch, errors_w, progress_ch, progress_w}
362-
363- // connect to the diff signals so that we have nice channels that do
364- // not expose dbus watchers
365- d.connectToStarted()
366- d.connectToPaused()
367- d.connectToResumed()
368- d.connectToCanceled()
369- d.connectToFinished()
370- d.connectToError()
371- d.connectToProgress()
372- runtime.SetFinalizer(&d, cleanDownloadData)
373- return &d, nil
374-}
375-
376-// TotalSize returns the total size of the file being downloaded.
377-func (down *FileDownload) TotalSize() (size uint64, err error) {
378- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "totalSize")
379- if err != nil || reply.Type == dbus.TypeError {
380- return 0, err
381- }
382- if err = reply.Args(&size); err != nil {
383- return 0, err
384- }
385- return size, nil
386-}
387-
388-// Process returns the process so far in downloading the file.
389-func (down *FileDownload) Progress() (progress uint64, err error) {
390- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "progress")
391- if err != nil || reply.Type == dbus.TypeError {
392- return 0, err
393- }
394- if err = reply.Args(&progress); err != nil {
395- return 0, err
396- }
397- return progress, nil
398-}
399-
400-// Metadata returns the metadata that was provided at creating time to the download.
401-func (down *FileDownload) Metadata() (metadata map[string]string, err error) {
402- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "metadata")
403- if err != nil || reply.Type == dbus.TypeError {
404- return nil, err
405- }
406- if err = reply.Args(&metadata); err != nil {
407- return nil, err
408- }
409- return metadata, nil
410-}
411-
412-// SetThrottle sets the network throttle to be used in the download.
413-func (down *FileDownload) SetThrottle(throttle uint64) (err error) {
414- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "setThrottle", throttle)
415- if err != nil || reply.Type == dbus.TypeError {
416- return err
417- }
418- return nil
419-}
420-
421-// Throttle returns the network throttle that is currently used in the download.
422-func (down *FileDownload) Throttle() (throttle uint64, err error) {
423- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "throttle")
424- if err != nil || reply.Type == dbus.TypeError {
425- return 0, err
426- }
427- if err = reply.Args(&throttle); err != nil {
428- return 0, err
429- }
430- return throttle, nil
431-}
432-
433-// AllowMobileDownload returns if the download is allow to use the mobile connect
434-// connection.
435-func (down *FileDownload) AllowMobileDownload(allowed bool) (err error) {
436- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "allowGSMDownload", allowed)
437- if err != nil || reply.Type == dbus.TypeError {
438- return err
439- }
440- return nil
441-}
442-
443-// IsMobileDownload returns if the download will be performed over the mobile data.
444-func (down *FileDownload) IsMobileDownload() (allowed bool, err error) {
445- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "isGSMDownloadAllowed", allowed)
446- if err != nil || reply.Type == dbus.TypeError {
447- return false, err
448- }
449- if err = reply.Args(&allowed); err != nil {
450- return false, err
451- }
452- return allowed, nil
453-}
454-
455-// Start tells udm that the download is ready to be peformed and that the client is
456-// ready to recieve signals. The following is a commong pattern to be used when
457-// creating downloads in udm.
458-//
459-// man, err := udm.NewDownloadManager()
460-// if err != nil {
461-// }
462-//
463-// // variables used to create the download
464-//
465-// url := "http://www.python.org/ftp/python/3.3.3/Python-3.3.3.tar.xz"
466-// hash := "8af44d33ea3a1528fc56b3a362924500"
467-// hashAlgo := MD5
468-// var metadata map[string]interface{}
469-// var headers map[string]string
470-//
471-// // create the download BUT do not start downloading just yet
472-// down, err := man.CreateDownload(url, hash, hashAlgo, metadata, headers)
473-//
474-// // connect routines to the download channels so that we can get the
475-// // information of the download the channel will not get any data until the
476-// // Start is called.
477-//
478-// started_signal := down.Started()
479-// go func() {
480-// <-started_signal
481-// fmt.Println("Download started")
482-// }()
483-// progress_signal := down.DownloadProgress()
484-// go func() {
485-// for progress := range p {
486-// fmt.Printf("Recieved %d out of %d\n", progress.Received, progress.Total)
487-// }
488-// }()
489-//
490-// finished_signal := down.Finished()
491-//
492-// // start download
493-// down.Start()
494-//
495-// // block until we are finished downloading
496-// <- finished_signal
497-func (down *FileDownload) Start() (err error) {
498- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "start")
499- if err != nil || reply.Type == dbus.TypeError {
500- return err
501- }
502- return nil
503-}
504-
505-// Pause pauses a download that was started and if not nothing is done.
506-func (down *FileDownload) Pause() (err error) {
507- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "pause")
508- if err != nil || reply.Type == dbus.TypeError {
509- return err
510- }
511- return nil
512-}
513-
514-// Resumes a download that was paused or does nothing otherwise.
515-func (down *FileDownload) Resume() (err error) {
516- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "resume")
517- if err != nil || reply.Type == dbus.TypeError {
518- return err
519- }
520- return nil
521-}
522-
523-// Cancel cancels a download that was in process and deletes any local files
524-// that were created.
525-func (down *FileDownload) Cancel() (err error) {
526- reply, err := down.proxy.Call(DOWNLOAD_INTERFACE, "cancel")
527- if err != nil || reply.Type == dbus.TypeError {
528- return err
529- }
530- return nil
531-}
532-
533-func (down *FileDownload) connectToStarted() {
534- go func() {
535- for msg := range down.started_w.C {
536- var started bool
537- msg.Args(&started)
538- down.started <- started
539- }
540- close(down.started)
541- }()
542-}
543-
544-// Started returns a channel that will be used to communicate the started signals.
545-func (down *FileDownload) Started() chan bool {
546- return down.started
547-}
548-
549-func (down *FileDownload) connectToPaused() {
550- go func() {
551- for msg := range down.paused_w.C {
552- var paused bool
553- msg.Args(&paused)
554- down.paused <- paused
555- }
556- close(down.paused)
557- }()
558-}
559-
560-// Paused returns a channel that will be used to communicate the paused signals.
561-func (down *FileDownload) Paused() chan bool {
562- return down.paused
563-}
564-
565-func (down *FileDownload) connectToProgress() {
566- go func() {
567- for msg := range down.progress_w.C {
568- var received uint64
569- var total uint64
570- msg.Args(&received, &total)
571- down.progress <- Progress{received, total}
572- }
573- close(down.progress)
574- }()
575-}
576-
577-// DownloadProgress returns a channel that will be used to communicate the progress
578-// signals.
579-func (down *FileDownload) DownloadProgress() chan Progress {
580- return down.progress
581-}
582-
583-func (down *FileDownload) connectToResumed() {
584- go func() {
585- for msg := range down.resumed_w.C {
586- var resumed bool
587- msg.Args(&resumed)
588- down.resumed <- resumed
589- }
590- close(down.resumed)
591- }()
592-}
593-
594-// Resumed returns a channel that will be used to communicate the paused signals.
595-func (down *FileDownload) Resumed() chan bool {
596- return down.resumed
597-}
598-
599-func (down *FileDownload) connectToCanceled() {
600- go func() {
601- for msg := range down.canceled_w.C {
602- var canceled bool
603- msg.Args(&canceled)
604- down.canceled <- canceled
605- }
606- close(down.canceled)
607- }()
608-}
609-
610-// Canceled returns a channel that will be used to communicate the canceled signals.
611-func (down *FileDownload) Canceled() chan bool {
612- return down.canceled
613-}
614-
615-func (down *FileDownload) connectToFinished() {
616- go func() {
617- for msg := range down.finished_w.C {
618- var path string
619- msg.Args(&path)
620- down.finished <- path
621- }
622- close(down.finished)
623- }()
624-}
625-
626-// Finished returns a channel that will ne used to communicate the finished signals.
627-func (down *FileDownload) Finished() chan string {
628- return down.finished
629-}
630-
631-func (down *FileDownload) connectToError() {
632- go func() {
633- for msg := range down.error_w.C {
634- var reason string
635- msg.Args(&reason)
636- down.errors <- errors.New(reason)
637- }
638- close(down.errors)
639- }()
640-}
641-
642-// Error returns the channel that will be used to communicate the error signals.
643-func (down *FileDownload) Error() chan error {
644- return down.errors
645-}
646-
647-type DownloadManager struct {
648- conn *dbus.Connection
649- proxy *dbus.ObjectProxy
650-}
651-
652-// NewDownloadManager creates a new manager that can be used to create download in the
653-// udm daemon.
654-func NewDownloadManager() (*DownloadManager, error) {
655- conn, err := dbus.Connect(dbus.SessionBus)
656- if err != nil {
657- return nil, err
658- }
659-
660- if err != nil {
661- return nil, err
662- }
663-
664- proxy := conn.Object(DOWNLOAD_SERVICE, "/")
665- d := DownloadManager{conn, proxy}
666- return &d, nil
667-}
668-
669-// CreateDownload creates a new download in the udm daemon that can be used to get
670-// a remote resource. Udm allows to pass a hash signature and method that will be
671-// check once the download has been complited.
672-//
673-// The download hash can be one of the the following constants:
674-//
675-// MD5
676-// SHA1
677-// SHA224
678-// SHA256
679-// SHA384
680-// SHA512
681-//
682-// The metadata attribute can be used to pass extra information to the udm daemon
683-// that will just be considered if the caller is not a apparmor confined application.
684-//
685-// LOCAL_PATH => allows to provide the local path for the download.
686-// OBJECT_PATH => allows to provide the object path to be used in the dbus daemon.
687-// POST_DOWNLOAD_COMMAND => allows to provide a command that will be executed on the
688-// download
689-//
690-// The headers attribute allows to provide extra headers to be used in the request used
691-// to perform the download.
692-func (man *DownloadManager) CreateDownload(url string, hash string, algo hashType, metadata map[string]interface{}, headers map[string]string) (down Download, err error) {
693- var t map[string]*dbus.Variant
694- for key, value := range metadata {
695- t[key] = &dbus.Variant{Value: value}
696- }
697- s := struct {
698- U string
699- H string
700- A string
701- M map[string]*dbus.Variant
702- HD map[string]string
703- }{url, hash, string(algo), t, headers}
704- var path dbus.ObjectPath
705- reply, err := man.proxy.Call(DOWNLOAD_MANAGER_INTERFACE, "createDownload", s)
706- if err != nil || reply.Type == dbus.TypeError {
707- return nil, err
708- }
709- if err = reply.Args(&path); err != nil {
710- return nil, err
711- }
712- down, err = newFileDownload(man.conn, path)
713- return down, err
714-}
715-
716-// CreateMmsDownload creates an mms download that will be performed right away. An
717-// mms download only uses mobile that and an apn proxy to download a multime media
718-// message.
719-func (man *DownloadManager) CreateMmsDownload(url string, hostname string, port int32) (down Download, err error) {
720- var path dbus.ObjectPath
721- reply, err := man.proxy.Call(DOWNLOAD_MANAGER_INTERFACE, "createMmsDownload", url, hostname, port)
722- if err != nil || reply.Type == dbus.TypeError {
723- return nil, err
724- }
725- if err = reply.Args(&path); err != nil {
726- return nil, err
727- }
728- down, err = newFileDownload(man.conn, path)
729- return down, err
730-}

Subscribers

People subscribed via source and target branches