Esempio n. 1
0
        public bool Init(string id)
        {
            if (!inited)
            {
                /* This isn't necessary now that we get the received-im-msg signal */
                //core_uiops.ui_init = new UI_Init(ui_init);
                //UiOps = core_uiops;

                PurpleEventLoop.Init();

                int ret = purple_core_init(id);

                PurpleConnection.Init();
                PurpleConversation.Init();

                if (ret == 1)
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            return(true);
        }
Esempio n. 2
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 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;
        }
Esempio n. 4
0
        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;
        }
Esempio n. 5
0
        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);
        }
Esempio n. 7
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);
            }
        }
        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);
            }
        }
        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);
              }
        }