Beispiel #1
0
        private static void received_im_msg(IntPtr account, IntPtr sender,
                                            IntPtr message, IntPtr conv, PurpleMessageFlags flags)
        {
            if (OnReceivedIMMsg != null)
            {
                PurpleConversation pconv;
                PurpleAccount      pacct       = new PurpleAccount(account);
                string             sender_str  = Marshal.PtrToStringAuto(sender);
                string             message_str = Marshal.PtrToStringAuto(message);

                /*We don't really want to pass null pointers around, and libpurple
                 * checks to see if a new conversation was created after this event,
                 * so we're safe creating our own*/
                if (conv == IntPtr.Zero)
                {
                    pconv = new PurpleConversation(PurpleConversationType.IM,
                                                   pacct, sender_str);
                }
                else
                {
                    pconv = new PurpleConversation(conv);
                }

                OnReceivedIMMsg(pacct, sender_str,
                                message_str, pconv, flags);
            }
        }
        public static PurpleConvIM Find(PurpleAccount account, string who)
        {
            IntPtr ptr = purple_find_conversation_with_account(
                PurpleConversationType.IM, who, account.handle);

            PurpleConversation conv;

            if (ptr == IntPtr.Zero)
            {
                conv = new PurpleConversation(PurpleConversationType.IM,
                                              account, who);
            }
            else
            {
                conv = new PurpleConversation(ptr);
            }

            return(conv.IM);
        }
        public static PurpleConvChat Find(PurpleAccount account, string name)
        {
            IntPtr ptr = purple_find_conversation_with_account(
                PurpleConversationType.Chat, name, account.handle);

            PurpleConversation conv;

            if (ptr == IntPtr.Zero)
            {
                conv = new PurpleConversation(PurpleConversationType.Chat,
                                              account, name);
            }
            else
            {
                conv = new PurpleConversation(ptr);
            }

            return(conv.Chat);
        }
Beispiel #4
0
        private static void received_chat_msg(IntPtr account, IntPtr sender,
                                              IntPtr message, IntPtr conv, PurpleMessageFlags flags)
        {
            if (OnReceivedChatMsg != null)
            {
                PurpleConversation pconv;
                PurpleAccount      pacct       = new PurpleAccount(account);
                string             sender_str  = Marshal.PtrToStringAuto(sender);
                string             message_str = Marshal.PtrToStringAuto(message);

                if (conv == IntPtr.Zero)
                {
                    pconv = new PurpleConversation(PurpleConversationType.Chat,
                                                   pacct, sender_str);
                }
                else
                {
                    pconv = new PurpleConversation(conv);
                }

                OnReceivedChatMsg(pacct, sender_str, message_str, pconv, flags);
            }
        }
Beispiel #5
0
 public PurpleConversation(PurpleConversationType type,
                           PurpleAccount account, string name)
 {
     handle = purple_conversation_new(type, account.handle, name);
 }
 public void Activate(PurpleAccount acct)
 {
     purple_savedstatus_activate_for_account(handle, acct.handle);
 }