Need a little help understanding the api.

Added by jon chris over 7 years ago

Hello newb here.
Im trying to make a plugin for Adiirc, but I cannot fathom how to get messages.
I tried to read some of the Encryption plugin but that was waaay over my head.
I saw there it was private void OnRawData(object sender, RawDataArgs e) that was used to get the outgoing message but it looked very complicated just to parse a normal privmsg.

Is there an easier way to get messages? I dont need raw data just messages.
and also I saw mentions of a msgMyProtocol//new protocol stuff, is this related to adircapi.dll?

Replies (1)

RE: Need a little help understanding the api. - Added by Per Amundsen over 7 years ago

Yeah OnRawData is a little low level, if you only want to capture, say channel messages, you can use the OnMessage event


public void Initialize()
  myHost.OnMessage += myHost_OnMessage;

private void myHost_OnMessage(IServer server, IChannel channel, IUser user, string text, out EatData Return)
  MessageBox.Show(user.Nick + " wrote " + text + " on channel " + channel.Name);
  Return = EatData.EatNone; // Dont eat this

For private messages you can use OnPrivateMessage

Hope this clears things up, if not let me know.