Commit 30cce49d authored by Martin's avatar Martin

Imported upstream master from 2017-09-19 plus andre/setuptools

parent ddc0bdf1
......@@ -8,11 +8,11 @@ syntax: glob
*.pyo
*~
autom4te.cache
data/defs.py
data/org.gajim.Gajim.appdata.xml
data/org.gajim.Gajim.desktop
libtool
po/.intltool-merge-cache
po/gajim.pot
po/POTFILES
po/stamp-it
stamp-h1
......@@ -25,3 +25,5 @@ syntax: regexp
^config\.*
^config\/
^scripts\/gajim.*
!MANIFEST.in
......@@ -9,8 +9,7 @@ stages:
run-test:
stage: test
script:
- ./autogen.sh
- make test_nogui
- python3 setup.py test_nogui
run-pylint:
stage: test
......@@ -20,8 +19,8 @@ run-pylint:
run-build:
stage: build
script:
- ./autogen.sh
- make dist
- python3 setup.py sdist
- cd dist
- export FN="gajim-default-"$(date +%F)".tar"
- mv gajim-*.tar.gz $FN.gz
- mkdir tmp_add_plugins
......@@ -30,11 +29,11 @@ run-build:
- tar xzf $FN.gz
- rm $FN.gz
- export GF=$(find . -maxdepth 1 -type d -name 'gajim-*')
- cd $GF/plugins/
- cd $GF/gajim/plugins/
- curl -O https://ftp.gajim.org/plugins_1/plugin_installer.zip
- unzip plugin_installer.zip
- rm plugin_installer.zip
- cd ../..
- cd ../../..
- tar czf ../$FN.gz gajim-*
- cd ..
- rm -rf tmp_add_plugins
......
include COPYING
recursive-include po *.po
recursive-include data *.1 *.in
recursive-include test *.py
recursive-exclude * *.pyc
SUBDIRS = gajim data po icons plugins
ACLOCAL_AMFLAGS = -I m4
bin_SCRIPTS = scripts/gajim scripts/gajim-history-manager scripts/gajim-remote
EXTRA_DIST = \
autogen.sh \
intltool-extract.in \
intltool-merge.in \
intltool-update.in \
win \
scripts/gajim.in \
scripts/gajim-history-manager.in \
scripts/gajim-remote.in
DISTCLEANFILES = \
intltool-extract \
intltool-merge \
intltool-update \
scripts/gajim \
scripts/gajim-remote \
scripts/gajim-history-manager
MAINTAINERCLEANFILES = \
configure \
Makefile.in \
intltool-extract.in \
intltool-update.in \
intltool-merge.in \
ltmain.sh \
missing \
mkinstalldirs \
install-sh \
compile \
depcomp \
config.guess \
config.log \
config.sub \
config.status \
aclocal.m4 \
libtool \
po/POTFILES.in \
m4/intltool.m4
MAINTAINERCLEANDIRS = \
autom4te.cache \
build \
dist
test:
${PYTHON} test/runtests.py
.PHONY: test
test_nogui:
${PYTHON} test/runtests.py -n
.PHONY: test_nogui
doc:
epydoc --config=doc/epydoc.conf
.PHONY: doc
#!/usr/bin/env bash
AM_ARGS="--add-missing --gnu --copy -Wno-portability"
CONF_ARGS=""
echo "[encoding: UTF-8]" > po/POTFILES.in \
&& for p in `ls gajim/data/gui/*.ui`; do echo "[type: gettext/glade]$p" >> \
po/POTFILES.in; done \
&& ls -1 data/org.gajim.Gajim.appdata.xml.in data/org.gajim.Gajim.desktop.in.in data/gajim-remote.desktop.in.in \
gajim/*.py gajim/common/*.py gajim/command_system/*.py gajim/command_system/implementation/*.py gajim/common/zeroconf/*.py gajim/plugins/*.py | grep -v ipython_view.py >> \
po/POTFILES.in \
&& echo -e "data/org.gajim.Gajim.desktop.in\ndata/gajim-remote.desktop.in\ngajim/ipython_view.py" > po/POTFILES.skip || exit 1
if [ $(find plugins/ -name '*.py' | wc -l) -gt 0 ];then
ls -1 plugins/*/*.py plugins/*/*.ui >> po/POTFILES.skip
fi
if test -z `which pkg-config 2>/dev/null`;then
echo "***Error: pkg-config not found***"
echo "See README.html for build requirements."
exit 1
fi
which glibtoolize >/dev/null 2>&1 && LIBTOOLIZE="glibtoolize" || LIBTOOLIZE="libtoolize"
mkdir -p config
if [ "$NO_AUTOTOOLS_RUN" ]; then
exit 0
fi
intltoolize --force --automake \
&& aclocal -I ./m4 \
&& $LIBTOOLIZE --copy --force --automake \
&& autoheader \
&& autoconf \
&& automake ${AM_ARGS} \
&& ./configure ${CONF_ARGS} $@
AC_INIT([Gajim - A Jabber Instant Messager],
m4_esyscmd_s([python -c "import os;os.chdir('gajim');from common import defs; print(defs.version)"]),[https://dev.gajim.org/gajim/gajim],[gajim])
AC_PREREQ([2.59])
AC_CONFIG_HEADER(config.h)
AC_CONFIG_AUX_DIR(config)
AC_CONFIG_MACRO_DIR([m4])
AM_INIT_AUTOMAKE([1.9 tar-pax])
AM_MAINTAINER_MODE
IT_PROG_INTLTOOL([0.35.0])
PKG_PROG_PKG_CONFIG([0.19])
AM_DISABLE_STATIC
AC_ENABLE_SHARED(yes)
AC_ENABLE_STATIC(no)
AC_ISC_POSIX
AC_PROG_CC
AC_PROG_INSTALL
AC_PROG_MAKE_SET
AC_PROG_LIBTOOL
AC_C_CONST
AC_CHECK_HEADERS([libintl.h])
AC_PATH_X
GETTEXT_PACKAGE=gajim
AC_SUBST([GETTEXT_PACKAGE])
AC_DEFINE_UNQUOTED([GETTEXT_PACKAGE],["$GETTEXT_PACKAGE"], [Gettext package])
AM_GLIB_GNU_GETTEXT
AM_NLS
ACLOCAL_AMFLAGS="\${ACLOCAL_FLAGS}"
AC_SUBST(ACLOCAL_AMFLAGS)
AM_PATH_PYTHON([3.5])
AC_SUBST([gajim_srcdir], [\${pkgpythondir}])
AC_SUBST([gajim_pluginsdir], [\${datadir}/\${PACKAGE}/plugins])
AS_AC_EXPAND(PY_SITEDIR, "${pythondir}")
AS_AC_EXPAND(GAJIM_SRCDIR, "${gajim_srcdir}")
AS_AC_EXPAND(PKGDATADIR, "${datadir}/${PACKAGE}")
AS_AC_EXPAND(DOCDIR, "${docdir}")
AS_AC_EXPAND(LOCALEDIR, "${localedir}")
AS_AC_EXPAND(GAJIM_PLUGINSDIR, "${gajim_pluginsdir}")
AC_SUBST(VERSION)
AC_SUBST(PACKAGE)
AC_CONFIG_FILES([
Makefile
data/Makefile
gajim/data/Makefile
gajim/data/gui/Makefile
gajim/data/emoticons/Makefile
data/pixmaps/Makefile
gajim/data/iconsets/Makefile
gajim/data/moods/Makefile
gajim/data/activities/Makefile
icons/Makefile
data/org.gajim.Gajim.appdata.xml
data/org.gajim.Gajim.desktop.in
data/gajim-remote.desktop.in
data/defs.py
gajim/Makefile
scripts/gajim
scripts/gajim-history-manager
scripts/gajim-remote
po/Makefile.in
plugins/Makefile
])
AC_OUTPUT
echo "
*****************************
Installation:
Prefix ........... ${prefix}
Python modules ... ${GAJIM_SRCDIR}
Plugins .. ....... ${GAJIM_PLUGINSDIR}
Documentation .... ${DOCDIR}
Others ........... ${PKGDATADIR}
*****************************"
SUBDIRS = pixmaps
@INTLTOOL_DESKTOP_RULE@
appstreamdir = $(datadir)/metainfo/
appstream_in_files = org.gajim.Gajim.appdata.xml.in
appstream_DATA = $(appstream_in_files:.xml.in=.xml)
@INTLTOOL_XML_RULE@
desktopdir = $(datadir)/applications
desktop_in_files = org.gajim.Gajim.desktop.in.in gajim-remote.desktop.in.in
desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop)
installdefsdir = $(gajim_srcdir)/common
installdefs_DATA = defs.py
man_MANS = gajim.1 gajim-remote.1 gajim-history-manager.1
EXTRA_DIST = $(appstream_in_files) \
$(desktop_in_files) \
$(man_MANS) \
defs.py.in
DISTCLEANFILES = $(desktop_DATA) \
$(installdefs_DATA)
CLEANFILES = $(appstream_DATA) \
org.gajim.Gajim.desktop \
gajim-remote.desktop
MAINTAINERCLEANFILES = Makefile.in
# this file is automatically generate by configure
# do not edit it!
docdir = "@DOCDIR@"
basedir = "@PKGDATADIR@"
version = "@VERSION@"
localedir = "@LOCALEDIR@"
[Desktop Entry]
Categories=Network;InstantMessaging;RemoteAccess;ConsoleOnly;
_Name=Open URI using Gajim
_Keywords=chat;messaging;im;jabber;xmpp;bonjour;voip;
Version=1.0
Exec=gajim-remote handle_uri %u
TryExec=gajim-remote
StartupNotify=false
Terminal=false
Type=Application
MimeType=x-scheme-handler/xmpp;
NoDisplay=true
pixmapsdir = $(pkgdatadir)/data/pixmaps
nobase_dist_pixmaps_DATA = \
$(srcdir)/gajim.ico
MAINTAINERCLEANFILES = Makefile.in
SUBDIRS = data
INCLUDES = \
$(PYTHON_INCLUDES)
export MACOSX_DEPLOYMENT_TARGET=10.4
gajimsrcdir = $(gajim_srcdir)
nobase_dist_gajimsrc_PYTHON = \
$(srcdir)/*.py \
$(srcdir)/common/*.py \
$(srcdir)/common/protocol/*.py \
$(srcdir)/common/zeroconf/*.py \
$(srcdir)/command_system/*.py \
$(srcdir)/command_system/implementation/*.py \
$(srcdir)/plugins/*.py
dist-hook:
rm -f $(distdir)/ipython_view.py
MAINTAINERCLEANFILES = Makefile.in
import subprocess
__version__ = "0.16.11"
try:
node = subprocess.Popen('git rev-parse --short=12 HEAD', shell=True,
stdout=subprocess.PIPE).communicate()[0]
if node:
__version__ += '-' + node.decode('utf-8').strip()
except Exception:
pass
......@@ -298,7 +298,8 @@ class StandardGroupChatCommands(CommandContainer):
@doc(_("Invite a user to a room for a reason"))
def invite(self, jid, reason):
self.connection.send_invite(self.room_jid, jid, reason)
return _("Invited %s to %s") % (jid, self.room_jid)
return _("Invited %(jid)s to %(room_jid)s") % {'jid': jid,
'room_jid': self.room_jid}
@command(raw=True, empty=True)
@doc(_("Join a group chat given by a jid, optionally using given nickname"))
......
......@@ -88,8 +88,6 @@ else:
os_info = None # used to cache os information
gmail_domains = ['gmail.com', 'googlemail.com']
transport_type = {} # list the type of transport
last_message_time = {} # list of time of the latest incomming message
......
......@@ -250,7 +250,7 @@ def check_and_possibly_move_config():
continue
if not os.path.exists(src):
continue
print(_('moving %s to %s') % (src, dst))
print(_('moving %(src)s to %(dst)s') % {'src': src, 'dst': dst})
shutil.move(src, dst)
app.logger.init_vars()
app.logger.attach_cache_database()
......
......@@ -33,10 +33,11 @@
import re
from gajim.common import defs
from gi.repository import GLib
from enum import IntEnum, unique
import gajim
@unique
class Option(IntEnum):
TYPE = 0
......@@ -178,9 +179,6 @@ class Config:
'time_stamp': [ opt_str, '[%X] ', _('This option let you customize timestamp that is printed in conversation. For exemple "[%H:%M] " will show "[hour:minute] ". See python doc on strftime for full documentation: http://docs.python.org/lib/module-time.html') ],
'before_nickname': [ opt_str, '', _('Characters that are printed before the nickname in conversations') ],
'after_nickname': [ opt_str, ':', _('Characters that are printed after the nickname in conversations') ],
'notify_on_new_gmail_email': [ opt_bool, True ],
'notify_on_new_gmail_email_extra': [ opt_bool, False ],
'notify_on_new_gmail_email_command': [ opt_str, '', _('Specify the command to run when new mail arrives, e.g.: /usr/bin/getmail -q') ],
'use_gpg_agent': [ opt_bool, False ],
'change_roster_title': [ opt_bool, True, _('Add * and [n] in roster title?')],
'restore_lines': [opt_int, 10, _('How many history messages should be restored when a chat tab/window is reopened?')],
......@@ -192,9 +190,9 @@ class Config:
'send_on_ctrl_enter': [opt_bool, False, _('Send message on Ctrl+Enter and with Enter make new line (Mirabilis ICQ Client default behaviour).')],
'last_roster_visible': [opt_bool, True],
'key_up_lines': [opt_int, 25, _('How many lines to store for Ctrl+KeyUP.')],
'version': [ opt_str, defs.version ], # which version created the config
'version': [ opt_str, gajim.__version__ ], # which version created the config
'search_engine': [opt_str, 'https://www.google.com/search?&q=%s&sourceid=gajim'],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %s in it where %s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
'dictionary_url': [opt_str, 'WIKTIONARY', _("Either custom url with %%s in it where %%s is the word/phrase or 'WIKTIONARY' which means use wiktionary.")],
'always_english_wikipedia': [opt_bool, False],
'always_english_wiktionary': [opt_bool, True],
'remote_control': [opt_bool, False, _('If checked, Gajim can be controlled remotely using gajim-remote.'), True],
......@@ -538,7 +536,6 @@ class Config:
'message_sent': [ False, 'sent.wav' ],
'muc_message_highlight': [ True, 'gc_message1.wav', _('Sound to play when a group chat message contains one of the words in muc_highlight_words, or when a group chat message contains your nickname.')],
'muc_message_received': [ False, 'gc_message2.wav', _('Sound to play when any MUC message arrives.') ],
'gmail_received': [ False, 'message1.wav' ],
}
themes_default = {
......
......@@ -25,7 +25,6 @@
import os
import sys
import tempfile
from gajim.common import defs
from enum import Enum, unique
@unique
......@@ -102,8 +101,7 @@ class ConfigPaths:
basedir = pkg_resources.resource_filename("gajim", ".")
self.add('DATA', None, os.path.join(basedir, 'data'))
self.add('GUI', None, os.path.join(basedir, 'data', 'gui'))
basedir = os.environ.get('GAJIM_BASEDIR', defs.basedir)
self.add('ICONS', None, os.path.join(basedir, 'icons'))
self.add('ICONS', None, os.path.join(basedir, 'data', 'icons'))
self.add('HOME', None, os.path.expanduser('~'))
self.add('PLUGINS_BASE', None, os.path.join(basedir, 'plugins'))
......@@ -144,8 +142,7 @@ class ConfigPaths:
d = {'LOG_DB': 'logs.db', 'MY_CACERTS': 'cacerts.pem',
'MY_EMOTS': 'emoticons', 'MY_ICONSETS': 'iconsets',
'MY_MOOD_ICONSETS': 'moods', 'MY_ACTIVITY_ICONSETS': 'activities',
'PLUGINS_USER': 'plugins',
'RNG_SEED': 'rng_seed'}
'PLUGINS_USER': 'plugins'}
for name in d:
d[name] += profile
self.add(name, Type.DATA, windowsify(d[name]))
......
......@@ -1083,7 +1083,8 @@ class Connection(CommonConnection, ConnectionHandlers):
self._hosts = [ {'host': h, 'port': p, 'ssl_port': ssl_p, 'prio': 10,
'weight': 10} ]
self._hostname = hostname
if use_srv:
if use_srv and self._proxy is None:
# add request for srv query to the resolve, on result '_on_resolve'
# will be called
app.resolver.resolve('_xmpp-client._tcp.' + helpers.idn_to_ascii(
......@@ -1823,9 +1824,10 @@ class Connection(CommonConnection, ConnectionHandlers):
self.sm.resuming = False # back to previous state
# Discover Stun server(s)
hostname = app.config.get_per('accounts', self.name, 'hostname')
app.resolver.resolve('_stun._udp.' + helpers.idn_to_ascii(hostname),
self._on_stun_resolved)
if self._proxy is None:
hostname = app.config.get_per('accounts', self.name, 'hostname')
app.resolver.resolve('_stun._udp.' + helpers.idn_to_ascii(hostname),
self._on_stun_resolved)
def _on_stun_resolved(self, host, result_array):
if len(result_array) != 0:
......@@ -1913,9 +1915,6 @@ class Connection(CommonConnection, ConnectionHandlers):
get_action(self.name + '-archive').set_enabled(True)
if obj.fjid == hostname:
if nbxmpp.NS_GMAILNOTIFY in obj.features:
app.gmail_domains.append(obj.fjid)
self.request_gmail_notifications()
if nbxmpp.NS_SECLABEL in obj.features:
self.seclabel_supported = True
for identity in obj.identities:
......@@ -2076,8 +2075,9 @@ class Connection(CommonConnection, ConnectionHandlers):
return
if type_ == 'message':
if len(contacts) == 1:
msg = _('Sent contact: "%s" (%s)') % (contacts[0].get_full_jid(),
contacts[0].get_shown_name())
msg = _('Sent contact: "%(jid)s" (%(name)s)') % {
'jid': contacts[0].get_full_jid(),
'name': contacts[0].get_shown_name()}
else:
msg = _('Sent contacts:')
for contact in contacts:
......
......@@ -1358,7 +1358,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
client_caps_factory=capscache.create_suitable_client_caps)
ConnectionJingle.__init__(self)
ConnectionHandlersBase.__init__(self)
self.gmail_url = None
# keep the latest subscribed event for each jid to prevent loop when we
# acknowledge presences
......@@ -1377,9 +1376,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
self.privacy_default_list = None
self.gmail_last_tid = None
self.gmail_last_time = None
app.nec.register_incoming_event(PrivateStorageBookmarksReceivedEvent)
app.nec.register_incoming_event(BookmarksReceivedEvent)
app.nec.register_incoming_event(
......@@ -1417,8 +1413,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
self._nec_roster_received)
app.ged.register_event_handler('iq-error-received', ged.CORE,
self._nec_iq_error_received)
app.ged.register_event_handler('gmail-new-mail-received', ged.CORE,
self._nec_gmail_new_mail_received)
app.ged.register_event_handler('ping-received', ged.CORE,
self._nec_ping_received)
app.ged.register_event_handler('subscribe-presence-received',
......@@ -1463,8 +1457,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
self._nec_roster_received)
app.ged.remove_event_handler('iq-error-received', ged.CORE,
self._nec_iq_error_received)
app.ged.remove_event_handler('gmail-new-mail-received', ged.CORE,
self._nec_gmail_new_mail_received)
app.ged.remove_event_handler('ping-received', ged.CORE,
self._nec_ping_received)
app.ged.remove_event_handler('subscribe-presence-received',
......@@ -1721,44 +1713,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
app.nec.push_incoming_event(TimeResultReceivedEvent(None, conn=self,
stanza=iq_obj))
def _gMailNewMailCB(self, con, iq_obj):
"""
Called when we get notified of new mail messages in gmail account
"""
log.debug('gMailNewMailCB')
app.nec.push_incoming_event(GmailNewMailReceivedEvent(None, conn=self,
stanza=iq_obj))
raise nbxmpp.NodeProcessed
def _nec_gmail_new_mail_received(self, obj):
if obj.conn.name != self.name:
return
if not self.connection or self.connected < 2:
return
# we'll now ask the server for the exact number of new messages
jid = app.get_jid_from_account(self.name)
log.debug('Got notification of new gmail e-mail on %s. Asking the '
'server for more info.' % jid)
iq = nbxmpp.Iq(typ='get')
query = iq.setTag('query')
query.setNamespace(nbxmpp.NS_GMAILNOTIFY)
# we want only be notified about newer mails
if self.gmail_last_tid:
query.setAttr('newer-than-tid', self.gmail_last_tid)
if self.gmail_last_time:
query.setAttr('newer-than-time', self.gmail_last_time)
self.connection.send(iq)
def _gMailQueryCB(self, con, iq_obj):
"""
Called when we receive results from Querying the server for mail messages
in gmail account
"""
log.debug('gMailQueryCB')
app.nec.push_incoming_event(GMailQueryReceivedEvent(None, conn=self,
stanza=iq_obj))
raise nbxmpp.NodeProcessed
def _rosterItemExchangeCB(self, con, msg):
"""
XEP-0144 Roster Item Echange
......@@ -2123,28 +2077,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
# hashes of already received messages
self.received_message_hashes = []
def request_gmail_notifications(self):
if not self.connection or self.connected < 2:
return
# It's a gmail account,
# inform the server that we want e-mail notifications
our_jid = helpers.parse_jid(app.get_jid_from_account(self.name))
log.debug(('%s is a gmail account. Setting option '
'to get e-mail notifications on the server.') % (our_jid))
iq = nbxmpp.Iq(typ='set', to=our_jid)
iq.setAttr('id', 'MailNotify')
query = iq.setTag('usersetting')
query.setNamespace(nbxmpp.NS_GTALKSETTING)
query = query.setTag('mailnotifications')
query.setAttr('value', 'true')
self.connection.send(iq)
# Ask how many messages there are now
iq = nbxmpp.Iq(typ='get')
iq.setID(self.connection.getAnID())
query = iq.setTag('query')
query.setNamespace(nbxmpp.NS_GMAILNOTIFY)
self.connection.send(iq)
def _SearchCB(self, con, iq_obj):
log.debug('SearchCB')
app.nec.push_incoming_event(SearchFormReceivedEvent(None,
......@@ -2260,10 +2192,6 @@ ConnectionHandlersBase, ConnectionJingle, ConnectionIBBytestream):
con.RegisterHandler('iq', self._HttpAuthCB, 'get', nbxmpp.NS_HTTP_AUTH)
con.RegisterHandler('iq', self._CommandExecuteCB, 'set',
nbxmpp.NS_COMMANDS)
con.RegisterHandler('iq', self._gMailNewMailCB, 'set',
nbxmpp.NS_GMAILNOTIFY)
con.RegisterHandler('iq', self._gMailQueryCB, 'result',
nbxmpp.NS_GMAILNOTIFY)
con.RegisterHandler('iq', self._DiscoverInfoGetCB, 'get',
nbxmpp.NS_DISCO_INFO)
con.RegisterHandler('iq', self._DiscoverItemsGetCB, 'get',
......
......@@ -232,61 +232,6 @@ class TimeResultReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.time_info = t.astimezone(contact_tz()).strftime('%c')
return True
class GMailQueryReceivedEvent(nec.NetworkIncomingEvent):
name = 'gmail-notify'
base_network_events = []
def generate(self):
if not self.stanza.getTag('mailbox'):
return
mb = self.stanza.getTag('mailbox')
if not mb.getAttr('url'):
return
self.conn.gmail_url = mb.getAttr('url')
if mb.getNamespace() != nbxmpp.NS_GMAILNOTIFY:
return
self.newmsgs = mb.getAttr('total-matched')
if not self.newmsgs:
return
if self.newmsgs == '0':
return
# there are new messages
self.gmail_messages_list = []
if mb.getTag('mail-thread-info'):
gmail_messages = mb.getTags('mail-thread-info')
for gmessage in gmail_messages:
unread_senders = []
for sender in gmessage.getTag('senders').getTags('sender'):
if sender.getAttr('unread') != '1':
continue
if sender.getAttr('name'):
unread_senders.append(sender.getAttr('name') + \
'< ' + sender.getAttr('address') + '>')
else:
unread_senders.append(sender.getAttr('address'))
if not unread_senders:
continue
gmail_subject = gmessage.getTag('subject').getData()
gmail_snippet = gmessage.getTag('snippet').getData()
tid = int(gmessage.getAttr('tid'))
if not self.conn.gmail_last_tid or \
tid > self.conn.gmail_last_tid:
self.conn.gmail_last_tid = tid
self.gmail_messages_list.append({
'From': unread_senders,
'Subject': gmail_subject,
'Snippet': gmail_snippet,
'url': gmessage.getAttr('url'),
'participation': gmessage.getAttr('participation'),
'messages': gmessage.getAttr('messages'),
'date': gmessage.getAttr('date')})
self.conn.gmail_last_time = int(mb.getAttr('result-time'))
self.jid = app.get_jid_from_account(self.name)
log.debug('You have %s new gmail e-mails on %s.', self.newmsgs, self.jid)
return True
class RosterItemExchangeEvent(nec.NetworkIncomingEvent, HelperEvent):
name = 'roster-item-exchange-received'
base_network_events = []
......@@ -671,18 +616,6 @@ class IqErrorReceivedEvent(nec.NetworkIncomingEvent, HelperEvent):
self.errcode = self.stanza.getErrorCode()
return True
class GmailNewMailReceivedEvent(nec.NetworkIncomingEvent):
name = 'gmail-new-mail-received'
base_network_events = []
def generate(self):
if not self.stanza.getTag('new-mail'):
return
if self.stanza.getTag('new-mail').getNamespace() != \
nbxmpp.NS_GMAILNOTIFY:
return
return True
class PingReceivedEvent(nec.NetworkIncomingEvent):
name = 'ping-received'