Example #1
0
 def received(self, source, mc, mmp, psyc):
     context = 'status'
     if mmp._query("_source") != None:
         context = mmp._query("_source").lower()
     else:
         context = source.lower()
         
     if mc == "_internal_message_private_window_popup":
         # open a new tab
         self.Show(True)
         self.addQuery('test')
     
     elif mc == "_message_echo_private":
         self.Show(True)
         text = ''
         text += 'Du>'
         if context not in self.querys:
             self.addQuery(context)
         text += ' ' + parsetext(mmp, psyc)
         self.query_inst[context].append_text(text + '\n')
         
     elif mc =='_message_private':
         self.Show(True)
         text = ''
         text += 'Anderer_Nick>'
         if context not in self.querys:
             self.addQuery(context)
         text += ' ' + parsetext(mmp, psyc)
         self.query_inst[context].append_text(text + '\n')
Example #2
0
File: Gui.py Project: elmom/pypsyc
    def update(self, mc, mmp, psyc):
        context = mmp._query("_context")
        if mc.startswith("_notice_place_enter"):
                ## if _source == ME eigentlich...
                if not self.rooms.has_key(context):
                    self.add_room(context)
                self.rooms[context].append(parsetext(mmp, psyc))
                
#	elif mc == "_status_place_topic":
#		self.topics[context] = parsetext(mmp, psyc)
	elif mc == '_message_public':
            self.rooms[context].append(psyc._query("_nick") + ": " +
                                      parsetext(mmp, psyc))
Example #3
0
 def received(self, source, mc, mmp, psyc):
     print "<<<", source, "[", self.packagename, "]"
     print "mmp:", mmp.packetstate
     print "psyc:", psyc.packetstate
     print "mc:", mc
     print "text:", parsetext(mmp, psyc)
     print "----"
Example #4
0
 def received(self, source, mc, mmp, psyc):
     print >> self.view, "devel handler:"
     print >> self.view, "source=>", source
     print >> self.view, "target=>", mmp.get_target()
     print >> self.view, "mmp   =>", mmp.get_state()
     print >> self.view, "psyc  =>", psyc.get_state()
     print >> self.view, "mc    =>", mc
     print >> self.view, "text  =>", parsetext(mmp, psyc)
     print >> self.view, "----\n"
Example #5
0
File: Gui.py Project: elmom/pypsyc
	def received(self, source, mc, mmp, psyc):
		if mc == "_message_private":
			source = mmp.get_source()
			if not self.windows.has_key(source):
				self.makewindow(source)
			self.append_text(self.windows[source]["displayfield"],
					 get_user(source)+":"+parsetext(mmp, psyc))
		elif mc == "_internal_message_private_window_popup":
			target = mmp._query("_target")
			print "target:", target
			if not self.windows.has_key(target):
				self.makewindow(target)
Example #6
0
File: Gui.py Project: elmom/pypsyc
	def received(self, source, mc, mmp, psyc):	
		## evil
		try:
			context = mmp._query("_context").lower()
##			print context
			if mc.startswith("_notice_place_enter"):
				## if _source == ME eigentlich...
				if not self.placebuttons.has_key(context):
					self.add_room(context)
				if not self.buffers.has_key(context):
					self.buffers[context] = ""
				self.buffers[context] += parsetext(mmp, psyc) + '\n'
				if self.model.get_context() == context:
					self.append_text(parsetext(mmp, psyc))
			elif mc.startswith("_notice_place_leave"):
				self.buffers[context] += parsetext(mmp, psyc) + '\n'
				if self.model.get_context() == context:
					self.append_text(parsetext(mmp, psyc))
			elif mc == '_message_public':
				text = psyc._query("_nick")
				if psyc._query("_action") != "":
					text += " " + psyc._query("_action")
				text += ": " + parsetext(mmp, psyc) 				
				if self.model.get_context() == context:
					self.append_text(text)
				self.buffers[context] += text	+ '\n'				
			elif mc == "_status_place_topic":
				self.topics[mmp.get_source().lower()] = parsetext(mmp, psyc)
		## evil
		except KeyError:
			print "KeyError:", context
Example #7
0
    def received(self, source, mc, mmp, psyc):
        context = 'status'
        if mmp._query("_context") != None:
            context = mmp._query("_context").lower()
        else:
            context = source.lower()
        #if psyc._query('_nick_place') != None:
        #    context =  'psyc://ve.symlynx.com/@' + psyc._query('_nick_place').lower()
            #context = source.lower()
        if mc.startswith('_notice_place_leave'):
            if context not in self.tabs:
                self.addTab(context)
            text = parsetext(mmp, psyc)
            self.tab_inst[context].append_text(text + '\n')
            if self.members.has_key(context):
                nick = psyc._query('_nick')
                self.members[context].remove(nick)
        
        if mc.startswith('_notice_place_enter'):
            self.Show(true)
            if context not in self.tabs:
                self.addTab(context)
            text = parsetext(mmp, psyc)
            self.tab_inst[context].append_text(text + '\n')
            if self.members.has_key(context):
                nick = psyc._query('_nick')
                if nick not in self.members[context]:
                    self.members[context].append(nick)
            
        elif mc == '_message_public_question':
            text = ''
            text += str(psyc._query("_nick"))
            if context not in self.tabs:
                self.addTab(context)
            text += ' fragt ' + parsetext(mmp, psyc)
            self.tab_inst[context].append_text(text + '\n')
        
        elif mc.startswith('_status_place_topic') or mc.startswith('_notice_place_topic'):
            topic = psyc._query('_topic')
            context = source.lower()
            if context not in self.tabs:
                self.addTab(context)
            self.tab_inst[context].set_topic(topic)

        elif mc == '_message_public':
            text = ''
            text += str(psyc._query("_nick"))
            if context not in self.tabs:
                self.addTab(context)
            if psyc._query("_action"):
                ptext = parsetext(mmp, psyc)
                if ptext == '':
                    text += " " + psyc._query("_action")
                else:
                    text += " " + psyc._query("_action") + '> ' + ptext
            else:
                text += "> " + parsetext(mmp, psyc)
            #text = text.encode('iso-8859-1')
            self.tab_inst[context].append_text(text + '\n')
            #print '!!' + context + ': ' + text
            
        elif mc == '_status_place_members':
            text = parsetext(mmp, psyc)
            if context not in self.tabs:
                self.addTab(context)
            members = split(psyc._query('_members'), ', ')
            self.members[context] = members
            self.tab_inst[context].append_text(text + '\n')
        
        else:
            # everything we don't know goes into the status tab
            # hopefully parsetext doesn't crash with' bogus' pakets
            text = source.lower() + ' >>> '
            text += parsetext(mmp, psyc)
            self.tab_inst['status'].append_text(text + '\n')