Use absolute imports on all plugins
This is necessary because Gajim is with 0.16.11 a python package
This commit is contained in:
@@ -29,10 +29,10 @@ if os.name == 'nt':
|
||||
import nbxmpp
|
||||
from gi.repository import Gtk, GLib
|
||||
|
||||
from common import gajim
|
||||
from common import ged
|
||||
from plugins import GajimPlugin
|
||||
from dialogs import FileChooserDialog, ErrorDialog
|
||||
from gajim.common import app
|
||||
from gajim.common import ged
|
||||
from gajim.plugins import GajimPlugin
|
||||
from gajim.dialogs import FileChooserDialog, ErrorDialog
|
||||
|
||||
log = logging.getLogger('gajim.plugin_system.httpupload')
|
||||
|
||||
@@ -73,7 +73,7 @@ class HTTPUploadPlugin(GajimPlugin):
|
||||
|
||||
def handle_agent_info_received(self, event):
|
||||
if (NS_HTTPUPLOAD in event.features and
|
||||
gajim.jid_is_transport(event.jid)):
|
||||
app.jid_is_transport(event.jid)):
|
||||
account = event.conn.name
|
||||
interface = self.get_interface(account)
|
||||
interface.enabled = True
|
||||
@@ -102,7 +102,7 @@ class HTTPUploadPlugin(GajimPlugin):
|
||||
|
||||
def update_chat_control(self, chat_control):
|
||||
account = chat_control.account
|
||||
if gajim.connections[account].connection is None:
|
||||
if app.connections[account].connection is None:
|
||||
self.get_interface(account).update_button_states(False)
|
||||
|
||||
def get_interface(self, account):
|
||||
@@ -223,7 +223,7 @@ class Base(object):
|
||||
def encrypt_file(self, file):
|
||||
GLib.idle_add(file.progress.label.set_text, _('Encrypting file...'))
|
||||
encryption = file.control.encryption
|
||||
plugin = gajim.plugin_manager.encryption_plugins[encryption]
|
||||
plugin = app.plugin_manager.encryption_plugins[encryption]
|
||||
if hasattr(plugin, 'encrypt_file'):
|
||||
plugin.encrypt_file(file, self.account, self.request_slot)
|
||||
else:
|
||||
@@ -237,7 +237,7 @@ class Base(object):
|
||||
GLib.idle_add(file.progress.label.set_text,
|
||||
_('Requesting HTTP Upload Slot...'))
|
||||
iq = nbxmpp.Iq(typ='get', to=self.component)
|
||||
id_ = gajim.get_an_id()
|
||||
id_ = app.get_an_id()
|
||||
iq.setID(id_)
|
||||
request = iq.setTag(name="request", namespace=NS_HTTPUPLOAD)
|
||||
request.addChild('filename', payload=os.path.basename(file.path))
|
||||
@@ -246,7 +246,7 @@ class Base(object):
|
||||
|
||||
log.info("Sending request for slot")
|
||||
IQ_CALLBACK[id_] = lambda stanza: self.received_slot(stanza, file)
|
||||
gajim.connections[self.account].connection.send(iq)
|
||||
app.connections[self.account].connection.send(iq)
|
||||
|
||||
def received_slot(self, stanza, file):
|
||||
log.info("Received slot")
|
||||
@@ -301,9 +301,10 @@ class Base(object):
|
||||
GLib.idle_add(file.progress.label.set_text,
|
||||
_('Uploading file via HTTP...'))
|
||||
try:
|
||||
headers = {'User-Agent': 'Gajim %s' % gajim.version,
|
||||
headers = {'User-Agent': 'Gajim %s' % app.version,
|
||||
'Content-Type': file.mime,
|
||||
'Content-Length': file.size}
|
||||
|
||||
request = Request(
|
||||
file.put, data=file.stream, headers=headers, method='PUT')
|
||||
log.info("Opening Urllib upload request...")
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
[info]
|
||||
name: HttpUpload
|
||||
short_name: httpupload
|
||||
version: 0.6.4
|
||||
version: 0.6.5
|
||||
description: This plugin is designed to send a file to a contact or muc by using httpupload.<br/>
|
||||
Your server must support <a href="http://xmpp.org/extensions/xep-0363.html">XEP-0363: HTTP Upload</a>.<br/>
|
||||
authors: Thilo Molitor <thilo@eightysoft.de>
|
||||
Philipp Hörist <philipp@hoerist.com>
|
||||
Linus Heckemann <linus@sphalerite.org>
|
||||
homepage: https://dev.gajim.org/gajim/gajim-plugins/wikis/HttpUploadPlugin
|
||||
min_gajim_version: 0.16.10
|
||||
min_gajim_version: 0.16.11
|
||||
|
||||
Reference in New Issue
Block a user