comparison sat_frontends/jp/cmd_file.py @ 3408:19bc03743aeb

jp (file/send): don't add main resource to bare jid anymore: bare jid sending is now managed by backend (at least for Jingle), so resource must not be added automatically anymore.
author Goffi <goffi@goffi.org>
date Thu, 12 Nov 2020 14:53:16 +0100
parents 7ebda4b54170
children 55f9a38864af
comparison
equal deleted inserted replaced
3407:2f0be2b7de68 3408:19bc03743aeb
93 93
94 @param pid(unicode): progress id 94 @param pid(unicode): progress id
95 @param file_(str): file path 95 @param file_(str): file path
96 """ 96 """
97 # FIXME: this show progress only for last progress_id 97 # FIXME: this show progress only for last progress_id
98 self.disp(_("File request sent to {jid}".format(jid=self.full_dest_jid)), 1) 98 self.disp(_("File request sent to {jid}".format(jid=self.args.jid)), 1)
99 try: 99 try:
100 await self.set_progress_id(data["progress"]) 100 await self.set_progress_id(data["progress"])
101 except KeyError: 101 except KeyError:
102 # TODO: if 'xmlui' key is present, manage xmlui message display 102 # TODO: if 'xmlui' key is present, manage xmlui message display
103 self.disp( 103 self.disp(
104 _("Can't send file to {jid}".format(jid=self.full_dest_jid)), error=True 104 _("Can't send file to {jid}".format(jid=self.args.jid)), error=True
105 ) 105 )
106 self.host.quit(2) 106 self.host.quit(2)
107 107
108 async def start(self): 108 async def start(self):
109 for file_ in self.args.files: 109 for file_ in self.args.files:
114 self.disp( 114 self.disp(
115 _(f"{file_!r} is a dir! Please send files inside or use compression") 115 _(f"{file_!r} is a dir! Please send files inside or use compression")
116 ) 116 )
117 self.host.quit(C.EXIT_BAD_ARG) 117 self.host.quit(C.EXIT_BAD_ARG)
118 118
119 self.full_dest_jid = await self.host.get_full_jid(self.args.jid)
120 extra = {} 119 extra = {}
121 if self.args.path: 120 if self.args.path:
122 extra["path"] = self.args.path 121 extra["path"] = self.args.path
123 if self.args.namespace: 122 if self.args.namespace:
124 extra["namespace"] = self.args.namespace 123 extra["namespace"] = self.args.namespace
140 bz2.close() 139 bz2.close()
141 self.disp(_("Done !"), 1) 140 self.disp(_("Done !"), 1)
142 141
143 try: 142 try:
144 send_data = await self.host.bridge.fileSend( 143 send_data = await self.host.bridge.fileSend(
145 self.full_dest_jid, 144 self.args.jid,
146 buf.name, 145 buf.name,
147 self.args.name or archive_name, 146 self.args.name or archive_name,
148 "", 147 "",
149 extra, 148 extra,
150 self.profile, 149 self.profile,
157 else: 156 else:
158 for file_ in self.args.files: 157 for file_ in self.args.files:
159 path = os.path.abspath(file_) 158 path = os.path.abspath(file_)
160 try: 159 try:
161 send_data = await self.host.bridge.fileSend( 160 send_data = await self.host.bridge.fileSend(
162 self.full_dest_jid, 161 self.args.jid,
163 path, 162 path,
164 self.args.name, 163 self.args.name,
165 "", 164 "",
166 extra, 165 extra,
167 self.profile, 166 self.profile,