...
 
Commits (633)
*.pyc
*.pyo
# use glob syntax.
syntax: glob
*.pyc
*.pyo
*.db
## [Unreleased]
### Added
- Sending confirmation message that anti spam check was passed. It can be disabled in plugin gui config.
## [0.4.3] - 2016-12-02
### Added
- Filtering 'normal' type messages
### Changed
- User from private conference conversation permanently stored in file
### Fixed
- Messages that was sent before correct answer was marked as received
- Chat between the two antispam plugins
## [0.4.2] - 2016-11-28
### Added
- Anti spam question functionality
- This CHANGELOG
- README with some explanation of functionality
### Changed
- homepage in manifest.ini
\ No newline at end of file
# Anti_spam Plugin for Gajim
This Plugin allows you to dissociate itself from the spam.
## Installation
Use special plugin, that manages automatic download and installation of others plugins, it is called Plugin Installer.
## Options
### Block pubsub
Block incoming messages from pubsub
### Message size limit
Block incoming messages that have size more than configured. Default value -1 mean that any sized messages are coming.
### Anti spam question
Block incoming messages from users not in your roster. In response, the Plugin sends a question that you configured. After correct answer(also configurable) you will receive all new messages from user.
**Attention!** All messages before correct answer will be lost.
Also you can enable this function, in Plugin config, for conference private messages. In some servers, the question in conference private does not reach your interlocutor. This can lead to the fact that you will not receive any messages from him, and he will not know it.
\ No newline at end of file
......@@ -25,7 +25,8 @@ Block some incoming messages
'''
import gtk
from common import ged
import nbxmpp
from common import gajim, ged
from plugins import GajimPlugin
from plugins.helpers import log, log_calls
......@@ -35,7 +36,6 @@ class AntiSpamPlugin(GajimPlugin):
@log_calls('AntiSpamPlugin')
def init(self):
self.description = _('Allows to block some kind of incoming messages')
self.config_dialog = AntiSpamPluginConfigDialog(self)
self.gui_extension_points = {
......@@ -45,9 +45,13 @@ class AntiSpamPlugin(GajimPlugin):
'atom-entry-received': (ged.POSTCORE,
self._nec_atom_entry_received),
'message-received': (ged.PRECORE,
self._nec_message_received_received),
'decrypted-message-received': (ged.PRECORE,
self._nec_decrypted_message_received_received),
'subscribe-presence-received': (ged.POSTCORE,
self._nec_subscribe_presence_received),
'message-outgoing': (ged.OUT_PRECORE,
self._nec_message_outgoing)
}
self.config_default_values = {
......@@ -55,8 +59,18 @@ class AntiSpamPlugin(GajimPlugin):
'disable_xhtml_muc': (False, ''),
'disable_xhtml_pm': (False, ''),
'block_subscription_requests': (False, ''),
'msgtxt_limit': (-1, ''),
'msgtxt_question': ('Please answer: 12 x 12 =', ''),
'msgtxt_answer': ('', ''),
'antispam_for_conference': (False, ''),
'conference_white_list': ([], ''), # conference private chat jid's
}
# List of outgoing jid's
# Needs to avoid chat of two anti spam plugins
# Contain all jid's where are you initiate a chat
self.outgoing_jids = []
@log_calls('AntiSpamPlugin')
def _nec_atom_entry_received(self, obj):
if self.config['block_pubsub_messages']:
......@@ -64,7 +78,7 @@ class AntiSpamPlugin(GajimPlugin):
return True
@log_calls('AntiSpamPlugin')
def _nec_decrypted_message_received_received(self, obj):
def _nec_message_received_received(self, obj):
if self.config['disable_xhtml_muc'] and obj.mtype == 'groupchat':
self.remove_xhtml(obj)
if self.config['disable_xhtml_pm'] and obj.gc_control and \
......@@ -72,6 +86,17 @@ class AntiSpamPlugin(GajimPlugin):
self.remove_xhtml(obj)
return False
@log_calls('AntiSpamPlugin')
def _nec_decrypted_message_received_received(self, obj):
if not obj.msgtxt:
return False
if self._nec_decrypted_message_received_question(obj):
return True
limit = self.config['msgtxt_limit']
if limit > -1 and len(obj.msgtxt) > limit:
return True
return False
@log_calls('AntiSpamPlugin')
def _nec_subscribe_presence_received(self, obj):
if self.config['block_subscription_requests'] and \
......@@ -79,6 +104,82 @@ class AntiSpamPlugin(GajimPlugin):
log.info('discarding subscription request from %s' % obj.jid)
return True
@log_calls('AntiSpamPlugin')
def _nec_decrypted_message_received_question(self, obj):
if obj.mtype != 'chat' and obj.mtype != 'normal':
return False
tjid = obj.jid if obj.mtype == 'normal' else obj.fjid
if tjid in self.outgoing_jids:
return False
answer = self.config['msgtxt_answer']
if len(answer) == 0:
return False
block_conference = self.config['antispam_for_conference']
is_conference = gajim.contacts.is_gc_contact(obj.conn.name, obj.fjid)
if not block_conference and is_conference:
return False
jid = obj.jid if not is_conference else obj.fjid
# If we receive conference privat message or direct message from unknown user than
# anti spam question will send in background mode, without any notification for us
# There are two methods to see who wrote you and not passed filter:
# 1. Using XML console
# 2. Running Gajim with log info messages and see logs (probably gajim.log file)
if is_conference or not gajim.contacts.get_contacts(obj.conn.name, jid):
if not self.contain_answer(obj.msgtxt, answer):
if is_conference and jid in self.config['conference_white_list']:
return False
self.send_question(obj, jid)
return True
else:
if is_conference and jid not in self.config['conference_white_list']:
self.config['conference_white_list'].append(jid)
# Need to save because 'append' method does not implement __setitem__ method
self.config.save()
return False
@log_calls('AntiSpamPlugin')
def _nec_message_outgoing(self, obj):
if obj.type_ != 'chat' and obj.type_ != 'normal':
return
if isinstance(obj.jid, list):
for i in obj.jid:
if i not in self.outgoing_jids:
self.outgoing_jids.append(i)
else:
if obj.jid not in self.outgoing_jids:
self.outgoing_jids.append(obj.jid)
def send_question(self, obj, jid):
if obj.mtype != 'chat' and obj.mtype != 'normal':
log.info('Anti_spam wrong message type: %s', obj.mtype)
return
# only for 'chat' messages
if obj.receipt_request_tag and obj.mtype == 'chat':
receipt = nbxmpp.Message(to=obj.fjid, typ='chat')
receipt.setTag('received', namespace='urn:xmpp:receipts', attrs={'id': obj.id_})
if obj.thread_id:
receipt.setThread(obj.thread_id)
gajim.connections[obj.conn.name].connection.send(receipt, now=True)
question = self.config['msgtxt_question']
log.info('Anti_spam enabled for %s, question: %s', jid, question)
message = _('Antispam enabled. Please answer the question. The message must only ' + \
'contain the answer. (Messages sent before the correct answer, will be lost): ') \
+ question
if obj.mtype == 'chat':
stanza = nbxmpp.Message(to=jid, body=message, typ=obj.mtype)
else: # for 'normal' type
stanza = nbxmpp.Message(to=jid, body=message, subject='Antispam enabled', typ=obj.mtype)
gajim.connections[obj.conn.name].connection.send(stanza, now=True)
def contain_answer(self, msg, answer):
return answer in msg.split('\n')
def remove_xhtml(self, obj):
html_node = obj.stanza.getTag('html')
if html_node:
......@@ -110,6 +211,14 @@ class AntiSpamPluginConfigDialog(GajimPluginConfigDialog):
widget.set_active(self.plugin.config['disable_xhtml_pm'])
widget = self.xml.get_object('block_subscription_requests_checkbutton')
widget.set_active(self.plugin.config['block_subscription_requests'])
widget = self.xml.get_object('message_size_limit_entry')
widget.set_text(str(self.plugin.config['msgtxt_limit']))
widget = self.xml.get_object('antispam_question')
widget.set_text(str(self.plugin.config['msgtxt_question']))
widget = self.xml.get_object('antispam_answer')
widget.set_text(str(self.plugin.config['msgtxt_answer']))
widget = self.xml.get_object('antispam_for_conference')
widget.set_active(self.plugin.config['antispam_for_conference'])
def on_block_pubsub_messages_checkbutton_toggled(self, button):
self.plugin.config['block_pubsub_messages'] = button.get_active()
......@@ -122,3 +231,25 @@ class AntiSpamPluginConfigDialog(GajimPluginConfigDialog):
def on_block_subscription_requests_checkbutton_toggled(self, button):
self.plugin.config['block_subscription_requests'] = button.get_active()
def on_message_size_limit_entry_changed(self, entry):
try:
self.plugin.config['msgtxt_limit'] = int(entry.get_text())
except Exception:
pass
def on_message_question_entry_changed(self, entry):
try:
self.plugin.config['msgtxt_question'] = entry.get_text()
except Exception:
pass
def on_message_answer_entry_changed(self, entry):
try:
self.plugin.config['msgtxt_answer'] = entry.get_text()
except Exception:
pass
def on_antispam_for_conference_checkbutton_toggled(self, button):
self.plugin.config['antispam_for_conference'] = button.get_active()
\ No newline at end of file
This diff is collapsed.
[info]
name: Anti Spam
short_name: anti_spam
version: 0.3
version: 0.4.3
description: Block some incoming messages.
authors = Yann Leboulanger <asterix@lagaule.org>
Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/AntiSpamPlugin
Ilya Kanyukov <ilya.kanukov@gmail.com>
homepage = https://dev.gajim.org/gajim/gajim-plugins/wikis/AntiSpamPlugin
max_gajim_version: 0.16.9
from plugin import AppindicatorIntegrationPlugin
[info]
name: Appindicator integration
short_name: appindicator_integration
version: 0.1.8
description: This plugin integrates Gajim with the appindicator. You must have python-appindicator (and Gajim obviously) installed to enable this plugin.<br/>
Rewriten from Ubuntu Ayatana Integration plugin
homepage: http://trac-plugins.gajim.org/wiki/AppindicatorSupportPlugin
authors: Denis Borenko <borenko@rambler.ru>
max_gajim_version: 0.16.9
# -*- coding: utf-8 -*-
"""
Appindicator integration plugin.
Rewriten from Ubuntu Ayatana Integration plugin
2013 Denis Borenko <borenko@rambler.ru>
:license: GPLv3
"""
# Python
import os
import time
import gobject
# GTK
import gtkgui_helpers
import gtk
ERRORMSG = ''
try:
import appindicator
except:
ERRORMSG = 'python-appindicator is missing!<br/>Please install it.'
if os.name == 'nt':
ERRORMSG = 'This is a Plugin for Linux'
# Gajim
from common import gajim, ged
from plugins import GajimPlugin
from plugins.plugin import GajimPluginException
from plugins.helpers import log_calls
class AppindicatorIntegrationPlugin(GajimPlugin):
@log_calls("AppindicatorIntegrationPlugin")
def init(self):
if ERRORMSG:
self.activatable = False
self.available_text += _(ERRORMSG)
return
else:
self.config_dialog = None
self.events_handlers = {'our-show': (ged.GUI2,
self.set_indicator_icon)}
self.windowstate = None
@log_calls("AppindicatorIntegrationPlugin")
def activate(self):
self.events = {}
self.attention_icon = "mail-unread"
self.online_icon = "user-available"
self.offline_icon = "user-offline"
self.connected = 0
self.connect_menu_item = gtk.MenuItem('Connect')
self.connect_menu_item.connect("activate", self.connect)
self.show_gajim_menu_item = gtk.MenuItem('Show/hide roster')
self.show_gajim_menu_item.connect("activate", self.roster_raise)
self.show_gajim_menu_item.show()
self.event_separator = gtk.SeparatorMenuItem()
self.menuEventInsertIndex = 3
itemExitSeparator = gtk.SeparatorMenuItem()
itemExitSeparator.show()
itemExit = gtk.MenuItem('Exit')
itemExit.connect("activate", self.on_exit_menuitem_activate)
itemExit.show()
self.menu = gtk.Menu()
self.menu.append(self.connect_menu_item)
self.menu.append(self.show_gajim_menu_item)
self.menu.append(self.event_separator)
self.menu.append(itemExitSeparator)
self.menu.append(itemExit)
self.menu.show()
self.indicator = appindicator.Indicator("Gajim", self.offline_icon,
appindicator.CATEGORY_APPLICATION_STATUS)
self.indicator.set_attention_icon(self.attention_icon)
self.indicator.set_status(appindicator.STATUS_ACTIVE)
self.indicator.set_menu(self.menu)
self.set_indicator_icon()
gajim.events.event_added_subscribe(self.on_event_added)
gajim.events.event_removed_subscribe(self.on_event_removed)
self.roster = gajim.interface.roster.window
self.handlerid = self.roster.connect('window-state-event',
self.window_state_event_cb)
def connect(self, widget, data=None):
for account in gajim.connections:
if gajim.config.get_per('accounts', account,
'sync_with_global_status'):
gajim.connections[account].change_status('online',
'online')
def window_state_event_cb(self, win, event):
if event.new_window_state & gtk.gdk.WINDOW_STATE_ICONIFIED:
self.windowstate = 'iconified'
elif event.new_window_state & gtk.gdk.WINDOW_STATE_WITHDRAWN:
self.windowstate = 'hidden'
def set_indicator_icon(self, obj=''):
is_connected = 0
for account in gajim.connections:
if not gajim.config.get_per('accounts', account,
'sync_with_global_status'):
continue
if gajim.account_is_connected(account):
is_connected = 1
break
if self.connected != is_connected:
self.connected = is_connected
if self.connected == 1:
self.indicator.set_icon(self.online_icon)
self.connect_menu_item.hide()
else:
self.indicator.set_icon(self.offline_icon)
self.connect_menu_item.show()
@log_calls("AppindicatorPlugin")
def deactivate(self):
gajim.events.event_added_unsubscribe(self.on_event_added)
gajim.events.event_removed_unsubscribe(self.on_event_removed)
if hasattr(self, 'indicator'):
self.indicator.set_status(appindicator.STATUS_PASSIVE)
del self.indicator
self.roster.disconnect(self.handlerid)
def roster_raise(self, widget, data=None):
win = gajim.interface.roster.window
if win.get_property("visible") and self.windowstate != 'iconified':
gobject.idle_add(win.hide)
else:
win.present()
self.windowstate = 'shown'
win.window.focus(gtk.get_current_event_time())
def on_exit_menuitem_activate(self, widget, data=None):
gajim.interface.roster.on_quit_request()
def event_raise(self, widget, event):
gajim.interface.handle_event(event.account, event.jid, event.type_)
win = gajim.interface.roster.window
if not win.is_active():
win.present()
def on_event_added(self, event):
account = event.account
jid = event.jid
when = time.localtime()
contact = ""
key = (account, jid)
if event.type_ == "chat" or \
event.type_ == "printed_chat" or \
event.type_ == "normal" or \
event.type_ == "printed_normal" or \
event.type_ == "file-request" or \
event.type_ == "jingle-incoming":
contact = gajim.contacts.get_contact_from_full_jid(account, jid)
if contact:
contact = contact.get_shown_name()
else:
contact = jid
elif event.type_ == "pm" or event.type_ == "printed_pm":
contact = gajim.get_nick_from_jid(gajim.get_room_from_fjid(jid)) + \
"/" + gajim.get_room_and_nick_from_fjid(jid)[1]
elif event.type_ == "printed_marked_gc_msg":
contact = gajim.get_nick_from_jid(gajim.get_room_from_fjid(jid))
else:
return
#print account, jid, when, contact
event.time = when
if key not in self.events:
icon = None
if gajim.config.get("show_avatars_in_roster"):
pixbuf = gtkgui_helpers.get_avatar_pixbuf_from_cache(jid)
if pixbuf not in (None, "ask"):
icon = gtk.Image()
icon.set_from_pixbuf(pixbuf)
item = gtk.ImageMenuItem(contact + " (1)")
if icon:
item.set_image(icon)
item.set_always_show_image(True)
item.connect("activate", self.event_raise, event)
item.show()
self.menu.insert(item, self.menuEventInsertIndex)
self.event_separator.show()
self.events[key] = {}
self.events[key]['item'] = item
self.events[key]['contact'] = contact
self.events[key]['events'] = [event]
else:
self.events[key]['events'].append(event)
item = self.events[key]['item']
item.set_label(self.events[key]['contact'] +
" (" + str(len(self.events[key]['events'])) + ")")
self.indicator.set_status(appindicator.STATUS_ATTENTION)
def on_event_removed(self, events):
for event in events:
key = (event.account, event.jid)
if key in self.events and event in self.events[key]['events']:
self.events[key]['events'].remove(event)
if len(self.events[key]['events']) == 0: # remove indicator
self.menu.remove(self.events[key]['item'])
del self.events[key]
else:
self.events[key]['item'].connect("activate",
self.event_raise, self.events[key]['events'][-1])
if len(self.events) == 0:
self.event_separator.hide()
self.indicator.set_status(appindicator.STATUS_ACTIVE)
[info]
name: Banner Tweaks
short_name: banner_tweaks
version: 0.1.1
version: 0.1.2
description: Allows user to tweak chat window banner appearance (eg. make it compact).
authors = Mateusz Biliński <mateusz@bilinski.it>
homepage = http://trac-plugins.gajim.org/wiki/BannerTweaksPlugin
max_gajim_version: 0.16.9
......@@ -45,10 +45,6 @@ class BannerTweaksPlugin(GajimPlugin):
@log_calls('BannerTweaksPlugin')
def init(self):
self.description = _('Allows user to tweak chat window banner '
'appearance (eg. make it compact).\n'
'Based on patch by pb in ticket #4133:\n'
'http://trac.gajim.org/attachment/ticket/4133.')
self.config_dialog = BannerTweaksPluginConfigDialog(self)
self.gui_extension_points = {
......
from plugin import BirthDayPlugin
[info]
name: Birthday reminder
short_name: birthday_reminder
version: 0.0.3
description: Birthday reminder plugin. Reminder before 5,3,1 and birthday days.
authors: Evgeniy Popov <evgeniypopov@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/BirthdayReminderPlugin
import os
import glob
import datetime
from xml.dom.minidom import *
import gobject
from plugins import GajimPlugin
from plugins.helpers import log_calls
from notify import popup
from common import configpaths
from common import gajim
from common import ged
class BirthDayPlugin(GajimPlugin):
@log_calls('BirthDayPlugin')
def init(self):
self.config_dialog = None
self.events_handlers = {
'roster-received': (ged.GUI2, self.roster_received)}
configpath = configpaths.ConfigPaths()
cache_path = configpath.cache_root
self.vcard_path = os.path.join(cache_path, 'vcards') + os.sep
self.timeout_id = 0
self.showed_accounts = []
def check_birthdays(self, account=None):
def show_popup(account, jid):
contact_instances = gajim.contacts.get_contacts(account, jid)
contact = gajim.contacts.get_highest_prio_contact_from_contacts(
contact_instances)
if contact:
nick = gobject.markup_escape_text(contact.get_shown_name())
try:
image = os.path.dirname(__file__) + os.sep + \
'birthday_reminder_large.png'
except:
image = None
popup('Send message', contact.jid, account, msg_type='', \
path_to_image=image, title=title, text=text + ' ' + nick)
accounts = gajim.contacts.get_accounts()
vcards = []
date_dict = {}
for jid in glob.glob(self.vcard_path + '*@*'):
if os.path.isfile(jid):
vcards.append(jid)
for xmldoc in vcards:
try:
xml = parse(xmldoc)
except:
pass
else:
name = xml.getElementsByTagName('BDAY')
for node in name:
try:
data = node.childNodes[0].nodeValue
date_dict[xmldoc[len(self.vcard_path):][:-1]] = data
except:
pass
today = datetime.date.today()
for key, value in date_dict.iteritems():
try:
convert_date = datetime.datetime.strptime(value, "%Y-%m-%d")
user_bday = datetime.date(today.year, convert_date.month,
convert_date.day)
except:
continue
if user_bday < today:
user_bday = user_bday.replace(year=today.year+1)
time_to_bday = abs(user_bday - today)
title = "BirthDay Reminder"
text = None
if time_to_bday.days > 5:
continue
if time_to_bday.days == 5:
text = "5 days before BDay"
elif time_to_bday.days == 3:
text = "3 days before BDay"
elif time_to_bday.days == 1:
text = "Tomorrow BDay"
elif time_to_bday.days == 0:
text = "Today BDay"
if not text:
continue
if account:
show_popup(account,key)
else:
for acct in accounts:
show_popup(account, key)
return True
@log_calls('BirthDayPlugin')
def activate(self):
#self.check_birthdays()
self.timeout_id = gobject.timeout_add_seconds(24*3600,
self.check_birthdays)
@log_calls('BirthDayPlugin')
def deactivate(self):
if self.timeout_id > 0:
gobject.source_remove(self.timeout_id)
@log_calls('BirthDayPlugin')
def roster_received(self, obj):
if obj.conn.name not in self.showed_accounts:
self.check_birthdays(obj.conn.name)
self.showed_accounts.append(obj.conn.name)
......@@ -31,10 +31,6 @@ class ChatstatePlugin(GajimPlugin):
@log_calls('ChatstatePlugin')
def init(self):
self.description = _('Chat State Notifications in roster.'
'Font color of the contact varies depending on the chat state.\n'
'The plugin does not work if you use custom font color for contacts in roster.\n'
'http://trac.gajim.org/ticket/3628.\nhttp://xmpp.org/extensions/xep-0085.html')
self.config_dialog = None # ChatstatePluginConfigDialog(self)
self.events_handlers = {'chatstate-received':
(ged.GUI2, self.chatstate_received), }
......
[info]
name: Chatstate in roster
short_name: chatstate
version: 0.5.1
description: Chat State Notifications in roster.
Font color of the contact varies depending on the chat state.
version: 0.5.2
description: Chat State Notifications in roster.<br/>
Font color of the contact varies depending on the chat state.<br/>
The plugin does not work if you use custom font color for contacts in roster.
authors = Denis Fomin <fominde@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/ChatstatePlugin
max_gajim_version: 0.16.9
......@@ -13,8 +13,6 @@ class ClickableNicknames(GajimPlugin):
@log_calls('ClickableNicknamesPlugin')
def init(self):
self.description = _('Clickable nicknames '
'in the conversation textview.')
self.config_dialog = None # ClickableNicknamesPluginConfigDialog(self)
self.gui_extension_points = {
'chat_control_base': (self.connect_with_chat_control,
......@@ -122,12 +120,21 @@ class Base(object):
if nick.startswith('* '):
nick = nick.lstrip('* ').split(' ')[0]
nick = nick.lstrip(gajim.config.get('before_nickname'))
nick = nick.lstrip(u'\u200E').rstrip(u'\u200E')
nick = nick.lstrip(u'\u200F').rstrip(u'\u200F')
nicks = gajim.contacts.get_nick_list(self.chat_control.account,
self.chat_control.room_jid)
if nick not in nicks:
return
nick = nick + gajim.config.get('gc_refer_to_nick_char') + ' '
return
message_buffer = self.chat_control.msg_textview.get_buffer()
if message_buffer.get_char_count() < 1:
nick = nick + gajim.config.get('gc_refer_to_nick_char')
else:
start, end = message_buffer.get_bounds()
if message_buffer.get_text(start, end, True)[-1] != ' ':
nick = ' ' + nick
nick += ' '
message_buffer.insert_at_cursor(nick)
self.chat_control.msg_textview.grab_focus()
......
[info]
name: Clickable Nicknames
short_name: clickable_nicknames
version: 0.2.1
version: 0.3.2
description: Clickable nicknames in the conversation textview.
authors: Denis Fomin <fominde@gmail.com>
authors: Andrey Musikhin <melomansegfault@gmail.com>
Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/ClickableNicknamesPlugin
max_gajim_version: 0.16.9
This diff is collapsed.
......@@ -6,6 +6,7 @@
<child>
<object class="GtkVBox" id="vbox1">
<property name="visible">True</property>
<property name="border_width">9</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkCheckButton" id="show_in_roster">
......
clients_icons/icons/jappix.png

1.05 KB | W: | H:

clients_icons/icons/jappix.png

1.29 KB | W: | H:

clients_icons/icons/jappix.png
clients_icons/icons/jappix.png
clients_icons/icons/jappix.png
clients_icons/icons/jappix.png
  • 2-up
  • Swipe
  • Onion skin
[info]
name: Clients icons
short_name: clients_icons
version: 3.1
description: Shows the client icons in the roster
and in groupchats.
For icons in tooltip support, you need to install Gajim r14117 or above.
authors = Denis Fomin <fominde@gmail.com>
version: 5.8
description: Shows the client icons in the roster and in groupchats.
authors: Denis Fomin <fominde@gmail.com>
Artem Klyop <art.klyop@gmail.com>
homepage = http://trac-plugins.gajim.org/wiki/ClientsIconsPlugin
homepage = https://dev.gajim.org/gajim/gajim-plugins/wikis/ClientsIconsPlugin
max_gajim_version: 0.16.9
from .colored_traceback import ColoredTracebackPlugin
# -*- coding: utf-8 -*-
##
from common import gajim
from plugins import GajimPlugin
from plugins.helpers import log_calls
import sys
import os
import traceback
import threading
from cStringIO import StringIO
have_pygments = True
try:
from pygments import highlight
from pygments.lexers import PythonConsoleLexer
from pygments.formatters import TerminalFormatter
test = PythonConsoleLexer.name
except ImportError:
have_pygments = False
import catcher
class ColoredTracebackPlugin(GajimPlugin):
@log_calls('ColoredTracebackPlugin')
def init(self):
self.config_dialog = None # ColoredTracebackPluginConfigDialog(self)
if not have_pygments:
self.available_text = _('Pygments are not available. '
'Install python-pygments.')
self.activatable = False
self._excepthook_save = None
@log_calls('ColoredTracebackPlugin')
def activate(self):
# gdb/kdm etc if we use startx this is not True
if os.name == 'nt' or sys.stderr.isatty():
self._exception_in_progress = threading.Lock()
self._excepthook_save = sys.excepthook
sys.excepthook = self._info
@log_calls('ColoredTracebackPlugin')
def deactivate(self):
if self._excepthook_save:
sys.excepthook = self._excepthook_save
def _info(self, type_, value, tb):
if not self._exception_in_progress.acquire(False):
# Exceptions have piled up, so we use the default exception
# handler for such exceptions
self._excepthook_save(type_, value, tb)
return
trace = StringIO()
traceback.print_exception(type_, value, tb, None, trace)
print highlight(trace.getvalue(), PythonConsoleLexer(),
TerminalFormatter())
self._exception_in_progress.release()
[info]
name: Colored traceback
short_name: colored_traceback
#version: 0.0.0
description: colored text for traceback in console
authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/
max_gajim_version: 0.16.9
from .emoticons_pack import EmoticonsPackPlugin
This diff is collapsed.
[MacThemes2]
icon: Smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Mac Themes 2 Smilies <br/>
<img src="preview.image"/>
</body>
authors: David Lanham
homepage: https://trac.gajim.org/wiki/MacThemes2
[Citters Emoticons from Psi]
icon: smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Citters Emoticons from Psi<br/>
<img src="preview.image"/>
</body>
converter: churchyard (JID: churchyard@njs.netlab.cz)
homepage: https://trac.gajim.org/wiki/cittersemoticons
[EmotiPonies]
icon: pinkiesmile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
EmotiPonies <br/>
<img src="preview.image"/>
</body>
authors: midori-no-ink (Copyright (c) Hasbro, Inc.)
homepage: https://trac.gajim.org/wiki/EmotiPonies
[Google Talk Emoticons]
icon: equal_smile.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Google Talk Emoticons<br/>
<img src="preview.image"/>
</body>
converter: Chris Cook
homepage: https://trac.gajim.org/wiki/gtalkemoticons
[ICQ6 Emoticons]
icon: Smiley1.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
ICQ6 Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/ICQ6-emotions
[Kolobok Animated Emoticons]
icon: ab.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Kolobok Animated Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/kolobok-animated-emoticons
[Pidgin Emoticons]
icon: smile.png
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Pidgin Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/PidginEmoticons
[Psynova qip's theme]
icon: ab.gif
authors: zOrg
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Psynova qip's theme<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/psynovaemoticons
[Yahoo Emoticons]
icon: equal_smile.gif
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Yahoo Emoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/YahooEmoticons
[Nekomoticons]
icon: s01.jpg
authors: somik (http://somik.deviantart.com/)
converter: Dotterian (http://dotterian.ru/)
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Nekomoticons<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/Nekomoticons
[Trollicons]
icon: Happy-EverythingWentBetterThanExpected.png
authors: Sagar Pandya
Chris Li
Jonathan E. Chen
converter: Matthieu L.
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Trollicons (Rage Icons for Gajim)<br/>
<img src="preview.image"/>
</body>
homepage: https://github.com/sagargp/trollicons/blob/master/readme.md#downloads
[Twemoji]
icon: 1f600.svg
authors: Twitter, Inc. and other contributors
converter: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/Twemoji
[Twemoji resized]
icon: 1f600.png
authors: Twitter, Inc. and other contributors
converter: Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>, Thilo Molitor <thilo@eightysoft.de>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
Twemoji (Twitter Emoji for Gajim)<br/>
The size of this Emojis is 24px and thus a bit more usable than those of the Twemoji packet (having a size of 48px)<br/>
Also the sorting is more intuitive (displaying all important emojis at the top of the emoticons dropdown).<br />
<img src="preview.image"/>
</body>
homepage: https://trac.gajim.org/wiki/TwemojiResized
[Noto]
icon: 1f600.png
authors: Google Inc. and other contributors
converter: Tommaso Sardelli <lacapannadelloziotom@gmail.com>, Thilo Molitor <thilo@eightysoft.de>
description: <body xmlns='http://www.w3.org/1999/xhtml'>
<h1>Noto Emoji for Gajim</h1>
<br/>
<p>The size of this Emojis is 24px in order to fit well with text size.</p>
<br/>
<img src="preview.image"/>
</body>
homepage: https://github.com/googlei18n/noto-emoji
This diff is collapsed.
[info]
name: Emoticons pack
short_name: emoticons_pack
version: 0.1.5
description: Install, update and view detailed legend of emoticons
authors: Denis Fomin <fominde@gmail.com>
homepage: http://trac-plugins.gajim.org/wiki/
min_gajim_version: 0.16
max_gajim_version: 0.16.9
import sqlite3
from common import gajim
import sys
import os
'''
TODO:
1-) Modify the database class to use models instead of method arguments
2-) Normalize the database. Don't save dirs and files in the same table
'''
class FilesharingDatabase:
def __init__(self, plugin):
self.plugin = plugin
path_l = os.path.split(plugin.config.FILE_PATH)
def __init__(self, FILE_PATH=None):
if not FILE_PATH:
return
path_l = os.path.split(FILE_PATH)
path = os.path.join(path_l[0], 'shared_files.db')
db_exist = os.path.exists(path)
self.conn = sqlite3.connect(path)
......@@ -31,13 +38,13 @@ class FilesharingDatabase:
self.conn.commit()
c.close()
def get_toplevel_files(self, account, requester):
def get_toplevel_dirs(self, account, requester):
c = self.conn.cursor()
data = (account, requester)
c.execute("SELECT relative_path, hash_sha1, size, description, " +
"mod_date, is_dir FROM (files JOIN permissions ON" +
" files.fid=permissions.fid) WHERE account=? AND requester=?" +
" AND relative_path NOT LIKE '%/%'", data)
" AND is_dir=1 AND relative_path NOT LIKE '%/%'", data)
result = c.fetchall()
c.close()
return result
......@@ -88,16 +95,15 @@ class FilesharingDatabase:
else:
data = (account, requester, name)
sql = "SELECT relative_path, hash_sha1, size, description, " + \
"mod_date, file_path FROM (files JOIN permissions ON" + \
"mod_date, file_path, is_dir FROM (files JOIN permissions ON" + \
" files.fid=permissions.fid) WHERE account=? AND requester=?" +\
" AND relative_path=?"
c.execute(sql, data)
result = c.fetchall()
c.close()
if result == []:
return None
else:
if result != []:
return result[0]
return result
def get_files_name(self, account, requester):
result = self.get_files(account, requester)
......@@ -115,7 +121,8 @@ class FilesharingDatabase:
>>> _delete_file(1)
"""
self._check_duplicate(account, requester, file_)
requester = gajim.get_jid_without_resource(requester)
if requester.find('/') != -1:
raise Exception('The requester must be given without a resource attached')
c = self.conn.cursor()
c.execute("INSERT INTO files (file_path, " +
"relative_path, hash_sha1, size, description, mod_date, " +
......@@ -138,7 +145,7 @@ class FilesharingDatabase:
data = (account, requester, file_[2])
c.execute("SELECT * FROM (files JOIN permissions ON" +
" files.fid=permissions.fid) WHERE account=? AND requester=?" +
" AND hash_sha1=?)", data)
" AND hash_sha1=?", data)
result.extend(c.fetchall())
if len(result) > 0:
raise Exception('Duplicated entry')
......
......@@ -14,7 +14,7 @@ from fileshare_window import FileShareWindow
import fshare_protocol
from common import ged
from common import caps_cache
from common import xmpp
from common import nbxmpp
from plugins.gui import GajimPluginConfigDialog
......@@ -26,17 +26,15 @@ class FileSharePlugin(GajimPlugin):
@log_calls('FileSharePlugin')
def init(self):
self.activated = False
self.description = _('This plugin allows you to share folders'
' with a peer using jingle file transfer.')
self.config_dialog = FileSharePluginConfigDialog(self)
home_path = os.path.expanduser('~/')
self.config_default_values = {'incoming_dir': (home_path, '')}
self.database = database.FilesharingDatabase(self)
self.database = database.FilesharingDatabase(self.config.FILE_PATH)
# Create one protocol handler per account
accounts = gajim.contacts.get_accounts()
for account in gajim.contacts.get_accounts():
FileSharePlugin.prohandler[account] = \
fshare_protocol.Protocol(account, self)
fshare_protocol.ProtocolDispatcher(account, self)
self.events_handlers = {
'raw-iq-received': (ged.CORE, self._nec_raw_iq)
}
......@@ -81,12 +79,13 @@ class FileSharePlugin(GajimPlugin):
gajim.connections[a].status)
def _nec_raw_iq(self, obj):
if obj.stanza.getTag('match',
if obj.stanza.getTag('query',
namespace=fshare_protocol.NS_FILE_SHARING) and self.activated:
account = obj.conn.name
pro = FileSharePlugin.prohandler[account]
pro.handler(obj.stanza)
raise xmpp.NodeProcessed
peerjid = obj.stanza.getFrom()
pro.handler(obj.stanza, str(peerjid))
raise nbxmpp.NodeProcessed
def __get_contact_menu(self, contact, account):
raise NotImplementedError
......@@ -176,7 +175,7 @@ class FileSharePluginConfigDialog(GajimPluginConfigDialog):
def on_run(self):
widget = self.xml.get_object('dl_folder')
widget.set_text(str(self.plugin.config['incoming_dir']))
def on_hide(self, widget):
widget = self.xml.get_object('dl_folder')
self.plugin.config['incoming_dir'] = widget.get_text()
This diff is collapsed.
[info]
name: File Sharing
short_name: fshare
#version: 0.1
#version: 0.1.1
description: This plugin allows you to share folders with your peers using jingle file transfer.
authors: Jefry Lagrange <jefry.reyes@gmail.com>
homepage: www.google.com
homepage: www.gajim.org
max_gajim_version: 0.16.9
#/usr/bin/python
import unittest
from mock import Mock
import sys, os
sys.path.append(os.path.abspath(sys.path[0]) + '/../')
import fshare_protocol
import nbxmpp