This commit is contained in:
SuperSonic 2019-08-27 13:33:04 +08:00
parent 90bdeebd57
commit b0e825c63c
2 changed files with 23 additions and 9 deletions

View file

@ -22,7 +22,8 @@ class Yuuki_Data:
self.GroupType = { self.GroupType = {
"SEGroup":None, "SEGroup":None,
"Ext_Admin":[] "Ext_Admin":[],
"GroupTicket":{}
} }
self.LimitType = { self.LimitType = {

View file

@ -107,15 +107,14 @@ class Yuuki:
inList = False inList = False
return inList return inList
def changeGroupUrlStatus(self, group, stat, AnotherID=None): def changeGroupUrlStatus(self, group, status, userId=None):
if stat == True: if status == True:
us = False group.preventJoinByTicket = False
else: else:
us = True group.preventJoinByTicket = True
group.members, group.invitee = None, None group.members, group.invitee = None, None
group.preventJoinByTicket = us if userId != None:
if AnotherID != None: self.getClientByMid(userId).updateGroup(self.Seq, group)
self.getClientByMid(AnotherID).updateGroup(self.Seq, group)
else: else:
self.client.updateGroup(self.Seq, group) self.client.updateGroup(self.Seq, group)
@ -176,6 +175,18 @@ class Yuuki:
if AccountUserId == userId: if AccountUserId == userId:
return Accounts[count] return Accounts[count]
def getGroupTicket(self, GroupID, userId):
GroupTicket = ""
if "GroupTicket" in self.data.getGroup(GroupID):
if self.data.getGroup(GroupID)["GroupTicket"] != "":
GroupTicket = self.data.getGroup(GroupID)["GroupTicket"]
else:
self.data.updateData(self.data.getGroup(GroupID), "GroupTicket", self.data.GroupType["GroupTicket"])
if GroupTicket == "":
GroupTicket = self.getClientByMid(userId).reissueGroupTicket(GroupID)
self.data.updateData(self.data.getGroup(GroupID)["GroupTicket"], userId, GroupTicket)
return GroupTicket
def limitReset(self, reconnect=False): def limitReset(self, reconnect=False):
for userId in [self.MyMID] + self.Connect.helper_ids: for userId in [self.MyMID] + self.Connect.helper_ids:
if reconnect: if reconnect:
@ -301,6 +312,7 @@ class Yuuki:
self.sendText(GroupID, _("Helllo^^\nMy name is %s ><\nNice to meet you OwO") % self.YuukiConfigs["name"]) self.sendText(GroupID, _("Helllo^^\nMy name is %s ><\nNice to meet you OwO") % self.YuukiConfigs["name"])
self.sendText(GroupID, _("Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s") % self.sendText(GroupID, _("Type:\n\t%s/Help\nto get more information\n\nAdmin of the Group:\n%s") %
(self.YuukiConfigs["name"], self.sybGetGroupCreator(GroupInfo).displayName,)) (self.YuukiConfigs["name"], self.sybGetGroupCreator(GroupInfo).displayName,))
self.getGroupTicket(GroupID, self.MyMID)
# Log # Log
self.data.updateLog("JoinGroup", (self.data.getTime(), GroupInfo.name, GroupID, Inviter)) self.data.updateLog("JoinGroup", (self.data.getTime(), GroupInfo.name, GroupID, Inviter))
else: else:
@ -313,6 +325,7 @@ class Yuuki:
for userId in self.Connect.helper_ids: for userId in self.Connect.helper_ids:
if self.checkInInvitationList(ncMessage, userId): if self.checkInInvitationList(ncMessage, userId):
self.getClientByMid(userId).acceptGroupInvitation(self.Seq, ncMessage.param1) self.getClientByMid(userId).acceptGroupInvitation(self.Seq, ncMessage.param1)
self.getGroupTicket(ncMessage.param1, userId)
# Log # Log
self.data.updateLog("JoinGroup", (self.data.getTime(), ncMessage.param1, userId, ncMessage.param2)) self.data.updateLog("JoinGroup", (self.data.getTime(), ncMessage.param1, userId, ncMessage.param2))
self.Security(ncMessage) self.Security(ncMessage)
@ -514,7 +527,7 @@ class Yuuki:
self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, Another, ncMessage.type*10+2)) self.data.updateLog("KickEvent", (self.data.getTime(), GroupInfo.name, GroupID, Kicker, Action, Another, ncMessage.type*10+2))
if GroupInfo.preventJoinByTicket: if GroupInfo.preventJoinByTicket:
self.changeGroupUrlStatus(GroupInfo, True, Kicker) self.changeGroupUrlStatus(GroupInfo, True, Kicker)
GroupTicket = self.getClientByMid(Kicker).reissueGroupTicket(GroupID) GroupTicket = self.getGroupTicket(GroupID)
if GroupInfo.preventJoinByTicket: if GroupInfo.preventJoinByTicket:
self.changeGroupUrlStatus(GroupInfo, False, Kicker) self.changeGroupUrlStatus(GroupInfo, False, Kicker)
self.getClientByMid(Another).acceptGroupInvitationByTicket(self.Seq, GroupID, GroupTicket) self.getClientByMid(Another).acceptGroupInvitationByTicket(self.Seq, GroupID, GroupTicket)