Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
D
domotikad
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
domotika
domotikad
Commits
861fa1ce
Commit
861fa1ce
authored
8 years ago
by
Franco (nextime) Lanza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added missing file
parent
2be17ba8
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
101 additions
and
1 deletion
+101
-1
ikapserver.py
domotika/ikapserver.py
+1
-1
messengerlinks.py
domotika/singleton/messengerlinks.py
+100
-0
No files found.
domotika/ikapserver.py
View file @
861fa1ce
...
...
@@ -29,7 +29,7 @@ import sys
from
socket
import
SOL_SOCKET
,
SO_BROADCAST
,
AF_INET
,
SOCK_DGRAM
,
socket
import
IN
import
struct
from
nexlibs.
dm
crypt
import
AES256
from
nexlibs.
nex
crypt
import
AES256
from
nexlibs
import
nexcrypt
as
dmcrypt
import
logging
from
dmlib
import
constants
as
C
...
...
This diff is collapsed.
Click to expand it.
domotika/singleton/messengerlinks.py
0 → 100644
View file @
861fa1ce
###########################################################################
# Copyright (c) 2011-2014 Unixmedia S.r.l. <info@unixmedia.it>
# Copyright (c) 2011-2014 Franco (nextime) Lanza <franco@unixmedia.it>
#
# Domotika System Controller Daemon "domotikad" [http://trac.unixmedia.it]
#
# This file is part of domotikad.
#
# domotikad is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
##############################################################################
from
nexlibs.singleton
import
Singleton
from
twisted.internet
import
reactor
EXPIRETIME
=
300
class
MessengerLinksSingleton
(
Singleton
):
links
=
{}
expires
=
{}
def
__init__
(
self
,
*
args
,
**
kwargs
):
Singleton
.
__init__
(
self
)
def
del_expire
(
self
,
linkid
):
if
linkid
in
self
.
expires
.
keys
():
try
:
self
.
expires
[
linkid
]
.
cancel
()
except
:
pass
del
self
.
expires
[
linkid
]
def
add_expire
(
self
,
linkid
):
self
.
del_expire
(
linkid
)
self
.
expires
[
linkid
]
=
reactor
.
callLater
(
EXPIRETIME
,
self
.
del_link
,
linkid
)
def
add_link
(
self
,
linkid
,
usr
):
self
.
links
[
linkid
]
=
usr
;
self
.
add_expire
(
linkid
)
def
del_link
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
del
self
.
links
[
linkid
]
def
get_link
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
return
self
.
links
[
linkid
]
return
False
def
linkid_exists
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
return
True
return
False
def
MessengerLinkRegistry
():
return
MessengerLinksSingleton
.
getInstance
()
class
MessengerPSIDSingleton
(
Singleton
):
links
=
{}
def
__init__
(
self
,
*
args
,
**
kwargs
):
Singleton
.
__init__
(
self
)
def
add_link
(
self
,
linkid
,
usr
):
self
.
links
[
linkid
]
=
usr
;
def
del_link
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
del
self
.
links
[
linkid
]
def
get_link
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
return
self
.
links
[
linkid
]
return
False
def
linkid_exists
(
self
,
linkid
):
if
linkid
in
self
.
links
.
keys
():
return
True
return
False
def
MessengerPSIDRegistry
():
return
MessengerPSIDSingleton
.
getInstance
()
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment