本文整理汇总了Python中Server.Server.getLinkedServer方法的典型用法代码示例。如果您正苦于以下问题:Python Server.getLinkedServer方法的具体用法?Python Server.getLinkedServer怎么用?Python Server.getLinkedServer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Server.Server
的用法示例。
在下文中一共展示了Server.getLinkedServer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getModes
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import getLinkedServer [as 别名]
def getModes(self, modes, params=[]):
modedir="+"
r=[]
param_idx=0
svr=Server.getLinkedServer()
for modechar in modes:
if(modechar in ("+", "-")):
modedir=modechar
continue
#if this line makes it crash again, it's Unreal's fault -- svr.chanmodes contains *all* of the modes that it specified in PROTOCTL!
#which, btw, does not include q, a, o, h, or v - no wonder >.>
#print svr.chanmodes
#print svr
if(modechar in ("q", "a", "o", "h", "v")):
#r[modeID]=params[param_idx]
r.append([modedir, modechar, params[param_idx]])
param_idx+=1
elif(svr.chanmodes[modechar]=="boolean"):
#r[modeID]=True
r.append([modedir, modechar, True])
elif(modedir=="+" or svr.chanmodes[modechar]=="paramrequired"):
#r[modeID]=params[param_idx]
r.append([modedir, modechar, params[param_idx]])
params_idx+=1
return r
示例2: introduce
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import getLinkedServer [as 别名]
def introduce(self):
svr=Server.getLinkedServer()
msg=None
if(svr.protoctl["NICKv2"]):
if(svr.protoctl["CLK"]): #NICKv2 and CLK
if(svr.protoctl["NICKIP"]): #NICKv2 and CLK and NICKIP
msg=IRCMessage(None, None, "nick", self.nick, self.hopcount, self.timestamp, self.username, self.hostname, self.server, self.servicestamp, self.usermodes, self.virtualhost, self.cloakedhost, self.nickipaddr, self.realname)
else: #NICKv2 and CLK
msg=IRCMessage(None, None, "nick", self.nick, self.hopcount, self.timestamp, self.username, self.hostname, self.server, self.servicestamp, self.usermodes, self.virtualhost, self.cloakedhost, self.realname)
else: #NICKv2 but not CLK
if(svr.protoctl["NICKIP"]): #NICKv2 and NICKIP
msg=IRCMessage(None, None, "nick", self.nick, self.hopcount, self.timestamp, self.username, self.hostname, self.server, self.servicestamp, self.usermodes, self.virtualhost, self.nickipaddr, self.realname)
else: #nickv2, no clk, no nickip
msg=IRCMessage(None, None, "nick", self.nick, self.hopcount, self.timestamp, self.username, self.hostname, self.server, self.servicestamp, self.usermodes, self.virtualhost, self.realname)
else: #normal
msg=IRCMessage(None, None, "nick", self.nick, self.hopcount, self.timestamp, self.username, self.hostname, self.server, self.servicestamp, self.realname)
Network.sendMsg(msg)
示例3: setModes
# 需要导入模块: from Server import Server [as 别名]
# 或者: from Server.Server import getLinkedServer [as 别名]
def setModes(self, modes, params=[], merge=False):
server=Server.getLinkedServer()
#for mode, param in Channel.getModes(modes, params):
#modedir, modechar=[c for c in mode]
for modedir, modechar, param in Channel.getModes(modes, params):
if(modedir=="+"):
if(modechar in ("q", "a", "o", "h", "v")):
if(not param.lower() in self.memberstatus):
self.memberstatus[param.lower()]=[]
if(modechar in self.memberstatus[param.lower()]): continue
self.memberstatus[param.lower()].append(modechar)
elif(server.chanmodes[modechar]=="boolean"):
dontset=False
if(merge):
if(modechar=="p" and self.modes.has_key("s")):
dontset=True
elif(modechar=="s" and self.modes.has_key("p")):
del self.modes["p"]
elif(modechar=="S" and self.modes.has_key("c")):
dontset=True
elif(modechar=="c" and self.modes.has_key("S")):
del self.modes["S"]
if(dontset): continue
self.modes[modechar]=True
elif(server.chanmodes[modechar] in ("param", "paramrequired")):
dontset=False
if(merge):
if(modechar in ("l", "k", "L", "F")):
if(self.modes.has_key(modechar) and self.modes[modechar]>param): dontset=True
elif(modechar=="j"):
if(self.modes.has_key("j")):
old_limit, old_time=self.modes["j"].split(":")
new_limit, new_time=param.split(":")
if(old_time==new_time):
if(old_limit>new_limit): dontset=True
elif(old_time>new_time): dontset=True
if(dontset): continue
self.modes[modechar]=param
elif(server.chanmodes[modechar]=="list"):
if(modechar=="b"):
mlist=self.banlist
elif(modechar=="E"):
mlist=self.exemptlist
elif(modechar=="I"):
mlist=self.invexlist
else:
continue
if(param.lower() in mlist): continue
mlist.append(param.lower())
elif(modedir=="-"):
if(modechar in ("q", "a", "o", "h", "v")):
if(not param.lower() in self.memberstatus): continue
if(modechar in self.memberstatus[param.lower()]):
self.memberstatus[param.lower()].remove(modechar)
elif(server.chanmodes[modechar] in ("param", "boolean", "paramrequired")):
if(self.modes.has_key(modechar)): del self.modes[modechar]
elif(server.chanmodes[modechar]=="list"):
if(modechar=="b"):
mlist=self.banlist
elif(modechar=="E"):
mlist=self.exemptlist
elif(modechar=="I"):
mlist=self.invexlist
else:
continue
if(not param.lower() in mlist): continue
mlist.remove(param.lower())