mirror of
https://gitlab.com/allianceauth/allianceauth.git
synced 2026-02-07 15:46:20 +01:00
Cleanup the threading, its a method in openfiremanager now to spawn a threaded broadcast.
Also added date to the broadcast.
This commit is contained in:
@@ -10,11 +10,18 @@ from openfire import UserService
|
||||
|
||||
from authentication.managers import AuthServicesInfoManager
|
||||
|
||||
import threading
|
||||
|
||||
|
||||
class OpenfireManager:
|
||||
def __init__(self):
|
||||
pass
|
||||
|
||||
@staticmethod
|
||||
def send_broadcast_threaded(group_name, broadcast_message):
|
||||
broadcast_thread = XmppThread(1, "XMPP Broadcast Thread", 1, group_name, broadcast_message)
|
||||
broadcast_thread.start()
|
||||
|
||||
@staticmethod
|
||||
def __add_address_to_username(username):
|
||||
address = urlparse(settings.OPENFIRE_ADDRESS).netloc.split(":")[0]
|
||||
@@ -118,4 +125,17 @@ class OpenfireManager:
|
||||
client.send(message)
|
||||
client.Process(1)
|
||||
|
||||
client.disconnect()
|
||||
client.disconnect()
|
||||
|
||||
class XmppThread (threading.Thread):
|
||||
def __init__(self, threadID, name, counter, group, message,):
|
||||
threading.Thread.__init__(self)
|
||||
self.threadID = threadID
|
||||
self.name = name
|
||||
self.counter = counter
|
||||
self.group = group
|
||||
self.message = message
|
||||
def run(self):
|
||||
print "Starting " + self.name
|
||||
OpenfireManager.send_broadcast_message(self.group, self.message)
|
||||
print "Exiting " + self.name
|
||||
Reference in New Issue
Block a user