Exemple #1
0
  /** 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);
    
  }
Exemple #2
0
 public int Add(User bud){
   return userArrayList.Add(bud);
 }
Exemple #3
0
 public void Prepend(User bud){
   userArrayList.Insert(0,bud);
 }
Exemple #4
0
  /** Constructor. 
   * @param a_user The local user who will being chatting
   * @param chat_config Serializable meta-data 
   */
  public BrunetChatMain(User a_user, ChatConfigSerialization chat_config)
  {
    string fname = "BrunetChat.glade";
    string root = "windowBrunetChatMain";
    Glade.XML gxml = new Glade.XML (fname, root, null);
    //Glade.XML gxml = new Glade.XML (null,fname, root, null);
    gxml.Autoconnect(this);
    
    _current_user = a_user;
    //We make the node in the "chatrealm" so it won't interfere with
    //testing of any other Brunet nodes.
    _brunet_node = new StructuredNode(a_user.Address, "chatrealm");

    _chat_config = chat_config;
    _chat_config.BuddyListFilename = "Buddylist.xml";
    _chat_config.RemoteTAsFilename = "RemoteTransportAddresses.xml";
    _chat_config.LocalTcpPortFilename = "LocalTcpPort.xml";
    
    _chat_config.DeserializeLocalTcpPort();
    _brunet_node.AddEdgeListener( 
        new TcpEdgeListener(_chat_config.LocalTcpPort.TcpPort) );
    
    treeviewBuddies = (TreeView)gxml["treeviewBuddies"];
    _store = new ListStore(typeof(string),typeof(string),typeof(string));
    treeviewBuddies.Model = _store;

    //Here is the first column
    _buddy_col = new TreeViewColumn ();
    CellRenderer buddyrenderer = new CellRendererText ();
    _buddy_col.Title = "Buddy";
    _buddy_col.PackStart (buddyrenderer, true);
    _buddy_col.AddAttribute (buddyrenderer, "text", 0);
    treeviewBuddies.AppendColumn (_buddy_col);
    
    //Here is the second column
    _email_col = new TreeViewColumn ();
    CellRenderer emailrenderer = new CellRendererText ();
    _email_col.Title = "Email";
    _email_col.PackStart (emailrenderer, true);
    _email_col.AddAttribute (emailrenderer, "text", 1);
    treeviewBuddies.AppendColumn (_email_col);
    
    //Here is the third column
    _status_col = new TreeViewColumn ();
    CellRenderer statusrenderer = new CellRendererText ();
    _status_col.Title = "Status";
    _status_col.PackStart (statusrenderer, true);
    _status_col.AddAttribute (statusrenderer, "text", 2);
    treeviewBuddies.AppendColumn (_status_col);
   
    _message_sinks = new Hashtable();
    
    _chat_config.DeserializeBuddyList();
    this.Buddies.Node = _brunet_node;
    this.Buddies.User = CurrentUser;
    //Handle the chat events locally
    this.Buddies.ChatEvent += this.IncomingChatHandler;
    foreach (Buddy bud in Buddies){
      if( bud.Sender != null ) {
        bud.Node = _brunet_node;
        bud.User = CurrentUser;
        bud.StatusChanged += this.BuddyChangeHandler;
        _store.AppendValues(bud.Alias, bud.Email, bud.Status);
      }
    }
    
    _chat_config.DeserializeRemoteTAs();
    string[] tas = _chat_config.RemoteTAs.TAs;
    foreach (string ta in tas)
    {
      _brunet_node.RemoteTAs.Add(TransportAddressFactory.CreateInstance(ta) );
      //Console.WriteLine(ta);
    }
    _brunet_node.ConnectionTable.ConnectionEvent += this.OnConnectionChange;
    _brunet_node.ConnectionTable.DisconnectionEvent += this.OnConnectionChange;
    _brunet_node.Connect();
  }