Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • gajim/gajim-plugins
  • lovetox/gajim-plugins
  • ag/gajim-plugins
  • FlorianMuenchbach/gajim-plugins
  • rom1dep/gajim-plugins
  • pitchum/gajim-plugins
  • wurstsalat/gajim-plugins
  • Dicson/gajim-plugins
  • andre/gajim-plugins
  • link2xt/gajim-plugins
  • marmistrz/gajim-plugins
  • Jens/gajim-plugins
  • muelli/gajim-plugins
  • asterix/gajim-plugins
  • orhideous/gajim-plugins
  • ngvelprz/gajim-plugins
  • appleorange1/gajim-plugins
  • Martin/gajim-plugins
  • maltel/gajim-plugins
  • Seve/gajim-plugins
  • evert-mouw/gajim-plugins
  • Yuki/gajim-plugins
  • mxre/gajim-plugins
  • ValdikSS/gajim-plugins
  • SaltyBones/gajim-plugins
  • comradekingu/gajim-plugins
  • ritzmann/gajim-plugins
  • genofire/gajim-plugins
  • jjrh/gajim-plugins
  • yarmak/gajim-plugins
  • PapaTutuWawa/gajim-plugins
  • weblate/gajim-plugins
  • XutaxKamay/gajim-plugins
  • nekk/gajim-plugins
  • principis/gajim-plugins
  • cbix/gajim-plugins
  • bodqhrohro/gajim-plugins
  • airtower-luna/gajim-plugins
  • toms/gajim-plugins
  • mesonium/gajim-plugins
  • lissine/gajim-plugins
  • anviar/gajim-plugins
42 results
Show changes
Commits on Source (508)
Showing
with 789 additions and 28 deletions
*.pyc
*.pyo
# use glob syntax.
syntax: glob
*.pyc
*.pyo
*.db
## Welcome to the Gajim Plugins Wiki
Here are some plugins that are written for <a href="https://gajim.org">Gajim</a> by the community. Report problems about those plugins here.
## How to install
There are several ways to install a plugin:
- You can browse / download / enable / configure plugins in Gajim, Edit menu -> Plugins.
- You can clone the repository directly from [here](https://dev.gajim.org/gajim/gajim-plugins) and copy it to
**Linux:** ~/.local/share/gajim/plugins/
**Windows:** C:\Users\USERNAME\AppData\Roaming\Gajim\Plugins
## Share / Improve Plugins
You have written a new plugin or want to improve an already existing one?
First, Thanks for that! Here is how to do that:
- Register an account [here](https://dev.gajim.org/users/sign_in)
- Tell us about your plans at gajim@gajim.conference.org (we need to set your permission on Gitlab)
- Fork the Gajim-Plugins [repository](https://dev.gajim.org/gajim/gajim-plugins)
- When you are finished make a pull request against the main repository
**Before you put in any work, please contact us on gajim@conference.gajim.org**
**Dont use dev.gajim.org for any projects that are not directly for the benefit of Gajim**
## Plugins list
* [AntiSpamPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/AntiSpamPlugin) Block some incoming messages
* [AppindicatorSupportPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/AppindicatorSupportPlugin) Plugin that add indicator applet support to gajim
* [BannerTweaksPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/BannerTweaksPlugin) Ability to configure the banner in chat windows
* [BirthdayReminderPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/BirthdayReminderPlugin) Birthday reminder
* [ChatstatePlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ChatstatePlugin) Chat State Notifications in roster.
* [ClickableNicknamesPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ClickableNicknamesPlugin) Click the left mouse button on a nickname in a groupchat conversation to insert the nickname in the input field.
* [ClientsIconsPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ClientsIconsPlugin) Shows the clients icons in the roster and in groupchats.
* [EmoticonPackPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/EmoticonPackPlugin) A pack of emoticon themes
* [FileSharing](https://dev.gajim.org/gajim/gajim-plugins/wikis/FileSharing) Allows you to share folders with your peers using jingle file transfer.
* [FlashingKeyboardPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/FlashingKeyboardPlugin) Make keyboard flash when we get a new message.
* [GnomeSessionManagerPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/GnomeSessionManagerPlugin) set and react on GNOME SessionManager presence settings.
* [GoogleTranslationPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/GoogleTranslationPlugin) Automatically translate incoming messages.
* [HamsterIntegration](https://dev.gajim.org/gajim/gajim-plugins/wikis/HamsterIntegration) Integration with project hamster.
* [HttpUploadPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/HttpUploadPlugin) Share files with offline users, multi client users and even in MUCs with [XEP-0363](http://xmpp.org/extensions/xep-0363.html)
* [ImagePlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ImagePlugin) This plugin is designed to send a small(0 - 40 kb) graphic image to your contact.
* [JuickPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/JuickPlugin) More comfortable use of juick.com (microblogging service).
* [LatexPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/LatexPlugin) Render latex expressions.
* [LengthNotifierPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/LengthNotifierPlugin) Be notified when message length reaches a limit.
* [MessageBoxSizePlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/MessageBoxSizePlugin) Allows you to adjust the height of the new message input field.
* [MprisSupportPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/MprisSupportPlugin) MPRIS2 support.
* [NowListenPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/NowListenPlugin) Copy tune info to conversation input box.
* [OffTheRecordPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/OffTheRecordPlugin) Provides protocol independent encryption (see https://otr.cypherpunks.ca for more information).
* [OfflineBookmarksPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/OfflineBookmarksPlugin) Save bookmarks offline inside the plugin configuration file.
* [PluginInstallerPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/PluginInstallerPlugin) install new plugins in one click.
* [PluginsTranslationsPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/PluginsTranslationsPlugin) This plugin contains translations files for Gajim plugins.
* [QuickRepliesPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/QuickRepliesPlugin) Plugin for quick replies.
* [RegexFilterPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/RegexFilterPlugin) Regex filtering of incoming messages.
* [RosterTweaksPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/RosterTweaksPlugin) Allows user to tweak roster window appearance.
* [ServerStatusIconsPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ServerStatusIconsPlugin) Replace standard Gajim status icons with server specific for known XMPP server accounts.
* [SetLocationPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/SetLocationPlugin) Allows you to manually specify your geographical location.
* [SnarlNotifications](https://dev.gajim.org/gajim/gajim-plugins/wikis/SnarlNotifications) Shows events notification using [Snarl](http://snarl.fullphat.net/) under Microsoft Windows.
* [SyntaxHighlightPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/syntaxhighlightplugin) Highlights Code in the Chat Window for many languages.
* [TictactoePlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/TictactoePlugin) Play Tic tac toe with your contacts.
* [TriggersPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/TriggersPlugin) Configure Gajim's behaviour when receiving some events.
* [ThemeSwitcherPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/ThemeSwitcherPlugin) Change the active GTK+ theme.
* [UbuntuIntegrationPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/UbuntuIntegrationPlugin) The plugin integrates Gajim with the Ubuntu Messaging Menu and the Me Menu.
* [UrlImagePreviewPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/UrlImagePreviewPlugin) Url image preview in chatbox.
* [UrlShortenerPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/UrlShortenerPlugin) Allows users to shorten a long URL.
* [WhiteboardPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/WhiteboardPlugin) Ability to share a whiteboard with a contact
* [WicdSupportPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/WicdSupportPlugin) Support for autodetection of network status for Wicd Network Manager.
* [WrongLayoutPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/WrongLayoutPlugin) Press alt+r to convert chars typed in wrong layout( Rus<>Eng).
* [OmemoGajimPlugin](https://dev.gajim.org/gajim/gajim-plugins/wikis/OmemoGajimPlugin) Experimental plugin for the OMEMO Multi-End Message and Object Encryption.
\ No newline at end of file
## [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
......@@ -3,11 +3,12 @@
<requires lib="gtk+" version="2.16"/>
<!-- interface-naming-policy toplevel-contextual -->
<object class="GtkWindow" id="window1">
<property name="can_focus">False</property>
<child>
<object class="GtkVBox" id="anti_spam_config_vbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="border_width">9</property>
<property name="orientation">vertical</property>
<property name="spacing">4</property>
<child>
<object class="GtkCheckButton" id="block_pubsub_messages_checkbutton">
......@@ -16,11 +17,13 @@
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, Gajim will block incoming messages from pubsub.</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_block_pubsub_messages_checkbutton_toggled"/>
<signal name="toggled" handler="on_block_pubsub_messages_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
......@@ -31,11 +34,13 @@
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, Gajim will remove XHTML from incoming multi-user chat messages</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_disable_xhtml_muc_checkbutton_toggled"/>
<signal name="toggled" handler="on_disable_xhtml_muc_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
......@@ -46,11 +51,13 @@
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, Gajim will remove XHTML from incoming private messages</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_disable_xhtml_pm_checkbutton_toggled"/>
<signal name="toggled" handler="on_disable_xhtml_pm_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
......@@ -61,15 +68,159 @@
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, Gajim will block incoming subscription requests</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_block_subscription_requests_checkbutton_toggled"/>
<signal name="toggled" handler="on_block_subscription_requests_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="box1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label1">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Message size limit:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="message_size_limit_entry">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_message_size_limit_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">4</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator1">
<property name="visible">True</property>
<property name="can_focus">False</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">5</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_question">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Anti spam question (Leave an empty answer field to disable this function):</property>
<property name="wrap">True</property>
<attributes>
<attribute name="style" value="italic"/>
</attributes>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">6</property>
<property name="padding">3</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="questionbox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="spacing">6</property>
<child>
<object class="GtkLabel" id="label2">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Question:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="antispam_question">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_message_question_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Answer:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="antispam_answer">
<property name="visible">True</property>
<property name="can_focus">True</property>
<signal name="changed" handler="on_message_answer_entry_changed" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">7</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="antispam_for_conference">
<property name="label" translatable="yes">Enable for conferences</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">If checked, anti spam question will send for conference private messages</property>
<property name="xalign">0.5</property>
<property name="draw_indicator">True</property>
<signal name="toggled" handler="on_antispam_for_conference_checkbutton_toggled" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">8</property>
</packing>
</child>
</object>
</child>
</object>
</interface>
[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.6
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 = "tray-message"
self.online_icon = "tray-online"
self.offline_icon = "tray-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)
else:
file_path = gtkgui_helpers.get_path_to_generic_or_avatar(jid)
if os.path.isfile(file_path):
fd = fopen(file_path, 'rb')
data = fd.read()
icon = gtk.Image()
icon.set_from_pixbuf(gtkgui_helpers.get_pixbuf_from_data(data))
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
birthday_reminder/birthday_reminder.png

813 B

birthday_reminder/birthday_reminder_large.png

6.83 KiB

[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