Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
G
gajim-plugins
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Evert Mouw
gajim-plugins
Commits
8b3cd59c
Commit
8b3cd59c
authored
11 years ago
by
Evgeniy Popov
Browse files
Options
Downloads
Patches
Plain Diff
BirthdayReminderPlugin. Initial commit
parent
16f257c5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
birthday_reminder/__init.py__
+1
-0
1 addition, 0 deletions
birthday_reminder/__init.py__
birthday_reminder/manifest.ini
+7
-0
7 additions, 0 deletions
birthday_reminder/manifest.ini
birthday_reminder/plugin.py
+79
-0
79 additions, 0 deletions
birthday_reminder/plugin.py
with
87 additions
and
0 deletions
birthday_reminder/__init.py__
0 → 100644
+
1
−
0
View file @
8b3cd59c
from plugin import BirthDayPlugin
This diff is collapsed.
Click to expand it.
birthday_reminder/manifest.ini
0 → 100644
+
7
−
0
View file @
8b3cd59c
[info]
name:
Birthday
reminder
short_name:
BDay
version:
0.0.1
description:
Birthday
reminder
plugin
authors:
Evgeniy
Popov
<evgeniypopov@gmail.com>
homepage:
https://bitbucket.org/axce1/bday
This diff is collapsed.
Click to expand it.
birthday_reminder/plugin.py
0 → 100644
+
79
−
0
View file @
8b3cd59c
import
os
import
glob
import
datetime
from
xml.dom.minidom
import
*
from
plugins
import
GajimPlugin
from
plugins.helpers
import
log_calls
from
notify
import
popup
from
common
import
configpaths
class
BirthDayPlugin
(
GajimPlugin
):
@log_calls
(
'
BirthDayPlugin
'
)
def
init
(
self
):
self
.
config_dialog
=
None
self
.
description
=
(
'
Birthday reminder plugin
'
)
configpath
=
configpaths
.
ConfigPaths
()
cache_path
=
configpath
.
cache_root
self
.
vcard_path
=
os
.
path
.
join
(
cache_path
,
'
vcards
'
)
+
os
.
sep
@log_calls
(
'
BirthDayPlugin
'
)
def
activate
(
self
):
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
):]]
=
data
except
:
pass
today
=
datetime
.
date
.
today
()
for
key
,
value
in
date_dict
.
iteritems
():
convert_date
=
datetime
.
datetime
.
strptime
(
value
,
"
%Y-%m-%d
"
)
user_bday
=
datetime
.
date
(
today
.
year
,
convert_date
.
month
,
convert_date
.
day
)
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 %s
"
%
key
elif
time_to_bday
.
days
==
3
:
text
=
"
3 days before BDay %s
"
%
key
elif
time_to_bday
.
days
==
1
:
text
=
"
Tommorrow BDay %s
"
%
key
elif
time_to_bday
.
days
==
0
:
text
=
"
Today BDay %s
"
%
key
if
text
:
popup
(
''
,
key
,
key
,
title
=
title
,
text
=
text
)
@log_calls
(
'
BirthDayPlugin
'
)
def
deactivate
(
self
):
pass
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment