//Copyright (c) 2007 Joshua R. Rodgers //Permission is hereby granted, free of charge, to any person obtaining a copy //of this software and associated documentation files (the "Software"), to deal //in the Software without restriction, including without limitation the rights //to use, copy, modify, merge, publish, distribute, sublicense, and/or sell //copies of the Software, and to permit persons to whom the Software is //furnished to do so, subject to the following conditions: //The above copyright notice and this permission notice shall be included in //all copies or substantial portions of the Software. //THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR //IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, //FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE //AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER //LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, //OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN //THE SOFTWARE. using System; using System.Collections.Generic; using System.Text; using System.Runtime.InteropServices; using Bone.CallbackArgs; namespace Bone { static class CallbackHandler { public static void Callback_Login(IntPtr bhnd, int error) { BoneCallbackLoginArgs e = new BoneCallbackLoginArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.Handle.Raise_Callback_Login(e); } public static void Callback_ChannelAttributes(IntPtr bhnd, string channel, byte channeltype, string owner, string channelpassword) { BoneCallbackChannelAttributesArgs e = new BoneCallbackChannelAttributesArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Channel = channel; e.ChannelType = channeltype; e.Owner = owner; e.ChannelPassword = channelpassword; e.Handle.Raise_Callback_ChannelAttributes(e); } public static void Callback_Disconnect(IntPtr bhnd) { BoneCallbackDisconnectArgs e = new BoneCallbackDisconnectArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Handle.Raise_Callback_Disconnect(e); } public static void Callback_Text(IntPtr bhnd, string origin, string message) { BoneCallbackTextArgs e = new BoneCallbackTextArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Origin = origin; e.Message = message; e.Handle.Raise_Callback_Text(e); } public static void Callback_IsOnline(IntPtr bhnd, string name, int onlinestatus) { BoneCallbackIsOnlineArgs e = new BoneCallbackIsOnlineArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.User = name; e.OnlineStatus = onlinestatus; e.Handle.Raise_Callback_IsOnline(e); } public static void Callback_Welcome(IntPtr bhnd, string message) { BoneCallbackWelcomeArgs e = new BoneCallbackWelcomeArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Message = message; e.Handle.Raise_Callback_Welcome(e); } public static void Callback_Ping(IntPtr bhnd, string user, int delay) { BoneCallbackPingArgs e = new BoneCallbackPingArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.User = user; e.Delay = delay; e.Handle.Raise_Callback_Ping(e); } public static void Callback_SendText(IntPtr bhnd, int error, string target) { BoneCallbackSendTextArgs e = new BoneCallbackSendTextArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.Target = target; e.Handle.Raise_Callback_SendText(e); } public static void Callback_ChannelSub(IntPtr bhnd, string channel, int error) { BoneCallbackChannelSubscribeArgs e = new BoneCallbackChannelSubscribeArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Channel = channel; e.Error = error; e.Handle.Raise_Callback_ChannelSubscribe(e); } public static void Callback_ChannelAddUser(IntPtr bhnd, string channel, string user) { BoneCallbackChannelAddUserArgs e = new BoneCallbackChannelAddUserArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Channel = channel; e.User = user; e.Handle.Raise_Callback_ChannelAddUser(e); } public static void Callback_ChannelDelUser(IntPtr bhnd, string channel, string user) { BoneCallbackChannelDeleteUserArgs e = new BoneCallbackChannelDeleteUserArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Channel = channel; e.User = user; e.Handle.Raise_Callback_ChannelDeleteUser(e); } public static void Callback_BadContact(IntPtr bhnd, string contact) { BoneCallbackBadContactArgs e = new BoneCallbackBadContactArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Contact = contact; e.Handle.Raise_Callback_BadContact(e); } public static void Callback_ContactIsOnline(IntPtr bhnd, string contact, int onlinestatus) { BoneCallbackContactIsOnlineArgs e = new BoneCallbackContactIsOnlineArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Contact = contact; e.OnlineStatus = onlinestatus; e.Handle.Raise_Callback_ContactIsOnline(e); } public static void Callback_ChannelText(IntPtr bhnd, string origin, string channel, string message) { BoneCallbackChannelTextArgs e = new BoneCallbackChannelTextArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Origin = origin; e.Channel = channel; e.Message = message; e.Handle.Raise_Callback_ChannelText(e); } public static void Callback_DelayedText(IntPtr bhnd, string origin, int sendtime, string message) { BoneCallbackDelayedTextArgs e = new BoneCallbackDelayedTextArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Origin = origin; e.SendTime = sendtime; e.Message = message; e.Handle.Raise_Callback_DelayedText(e); } public static void CallBack_Broadcast(IntPtr bhnd, string origin, string message) { BoneCallbackBroadcastArgs e = new BoneCallbackBroadcastArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Origin = origin; e.Message = message; e.Handle.Raise_Callback_Broadcast(e); } public static void Callback_CreateUser(IntPtr bhnd, int error) { BoneCallbackCreateUserArgs e = new BoneCallbackCreateUserArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.Handle.Raise_Callback_CreateUser(e); } public static void Callback_ReqPassword(IntPtr bhnd, int error) { BoneCallbackRequestPasswordArgs e = new BoneCallbackRequestPasswordArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.Handle.Raise_Callback_RequestPassword(e); } public static void Callback_InviteUser(IntPtr bhnd, string user, int error) { BoneCallbackInviteUserArgs e = new BoneCallbackInviteUserArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Handle.Raise_Callback_InviteUser(e); e.User = user; } public static void Callback_ReqUserProfile(IntPtr bhnd, int error, string user, string password, string email, int usertype, int creation, int lastlogin, int selfcreated, int isdisabled) { BoneCallbackRequestUserProfileArgs e = new BoneCallbackRequestUserProfileArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.User = user; e.Password = password; e.Email = email; e.UserType = usertype; e.Creation = creation; e.LastLogin = lastlogin; e.IsDisabled = isdisabled; e.SelfCreated = selfcreated; e.Handle.Raise_Callback_RequestUserProfile(e); } public static void Callback_ModifyUserProfile(IntPtr bhnd, int error, string user) { BoneCallbackModifyUserProfileArgs e = new BoneCallbackModifyUserProfileArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.User = user; e.Handle.Raise_Callback_ModifyUserProfile(e); } public static void Callback_ChangeEmail(IntPtr bhnd, int error) { BoneCallbackChangeEmailArgs e = new BoneCallbackChangeEmailArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Error = error; e.Handle.Raise_Callback_ChangeEmail(e); } public static void Callback_ChannelList(IntPtr bhnd, string channel, byte type, int usercount) { BoneCallbackChannelListArgs e = new BoneCallbackChannelListArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.Channel = channel; e.Type = type; e.UserCount = usercount; e.Handle.Raise_Callback_ChannelList(e); } public static void Callback_InviteNotify(IntPtr bhnd, string user, string channel) { BoneCallbackInviteNotifyArgs e = new BoneCallbackInviteNotifyArgs(); e.Handle = Utility.handleDictionary[bhnd]; e.User = user; e.Channel = channel; e.Handle.Raise_Callback_InviteNotify(e); } } }