Menu

How to get list of users on channel and more

Help
2004-12-23
2013-04-11
  • Nobody/Anonymous

    Sorry for stupid question.

    I don't know how to get list of users on channel and how to get messages of another users.... I think, messages should be in some queue, but I can't find anyone....Could somebody help?

     
    • Mirco Bauer

      Mirco Bauer - 2004-12-24

      The example bot should show you how todo that, also read the article at:
      http://www.developerland.net/Web/General/245.aspx

      if you use ActiveChannelSync then you can use:
      Channel chan = irc.GetChannel"#foo");
      foreach(ChannelUser cuser in chan.Users) [
      Console.WriteLine(cuser.Nick);
      }

      all messages are handled via events so just stick to the right event and there you go, e.g. (those always work, no channel sync required):
      irc.OnChannelMessage += new IrcEventHandler(MyChannelMessages);

      void MyChannelMessages(object sender, IrcEventArgs e) {
      Console.WriteLine(e.Data.Nick+" said: "+e.Data.Message);
      }

       
    • Nobody/Anonymous

      Hi Mirco,

      When I try you code i've an exception in the foreach:

      'System.InvalidCastException': Specified cast is not valid.

      Merry Chrismas :)

      John

       
      • Mirco Bauer

        Mirco Bauer - 2004-12-24

        don't expect copy/paste working code from me, the problem is simple, chan.Users is a hashtable and you want to loop through the values so it must be chan.Users.Values, that's all.

         
    • Nobody/Anonymous

      Marvelous that works like a charm.
      You rocks man ! :-)

      Best Regards

      John

      PS: Will you post in future the source code of Gnosmirc ? It looks great :-)

       
      • Mirco Bauer

        Mirco Bauer - 2004-12-26

        In fact, Gnosmirc is like SmartIrc4net OpenSource, means the sourcecode is public available. Currently only via subversion though, releases I will do when it hits beta state, too many changes are going on in Gnosmirc.

        You can make a SVN checkout if you like:
        svn checkout svn://svn.qnetp.net/gnosmirc/Gnosmirc/trunk

        It's probably in a not working state because I am doing the core rewrite...

         

Log in to post a comment.

MongoDB Logo MongoDB