/** ChatIM constructor. * @param core the main application * @param r_add the recipient address */ public BrunetChatIM(User u, Buddy bud, BrunetChatMain bcm) { _user = u; _recipient_buddy = bud; _bcm = bcm; string fname = "BrunetChat.glade"; string root = "windowBrunetChatIM"; Glade.XML gxml = new Glade.XML (fname, root, null); //Glade.XML gxml = new Glade.XML (null,fname, root, null); gxml.Autoconnect(this); _text_buf_display = textviewDisplay.Buffer; _text_buf_input = textviewInput.Buffer; _text_buf_recipient = textviewRecipient.Buffer; _text_buf_recipient.Text = _recipient_buddy.Alias; Gdk.Color red_color = new Gdk.Color (0xff, 0, 0); Gdk.Color blue_color = new Gdk.Color (0, 0, 0xff); TextTag sendercolor = new TextTag("Sender Color"); sendercolor.ForegroundGdk = blue_color; TextTag recipientcolor = new TextTag("Recipient Color"); recipientcolor.ForegroundGdk = red_color; _text_buf_display.TagTable.Add(sendercolor); _text_buf_display.TagTable.Add(recipientcolor); }
public int Add(Buddy bud){ if( !Contains(bud) ) { _add_to_buddy[ bud.Sender.ToUri() ] = bud; _email_to_buddy[ bud.Email ] = bud; return buddyArrayList.Add(bud); } return 0; }
public bool Contains(Buddy b) { if( b.Sender == null ) { return false; } return _add_to_buddy.ContainsKey(b.Sender.ToUri()); }
/** * Creates a new chat session or raises an existing one in response to a * new message. * @param recipient Buddy the message is from */ public BrunetChatIM OpenChatSession(Buddy recipient) { bool doeswindowexist = _message_sinks.Contains( recipient ); BrunetChatIM sink = null; if ( !doeswindowexist ) { sink = new BrunetChatIM(CurrentUser, recipient, this); _message_sinks.Add(recipient , sink ); } else { sink = (BrunetChatIM)_message_sinks[recipient]; ///\todo raise window /// } return sink; }
/** * Close a chat session once we are done with it. * @param dest the destination address to close the chat session with */ public void CloseChatSession(Buddy b) { _message_sinks.Remove(b); }