Example #1
0
        public override bool SupportsItem(Item item)
        {
            Pidgin.IPurpleObject prpl    = Pidgin.GetPurpleObject();
            PidginAccountItem    account = item as PidginAccountItem;

            return(prpl.PurpleAccountIsConnected(account.Id));
        }
Example #2
0
        public override void UpdateItems()
        {
            Pidgin.IPurpleObject prpl;
            int [] rawStatuses;
            if (Pidgin.InstanceIsRunning)
            {
                try {
                    prpl = Pidgin.GetPurpleObject();
                    foreach (Item status in statuses.Where(i => i is PidginSavedStatusItem).ToArray())
                    {
                        statuses.Remove(status);
                    }
                    rawStatuses = prpl.PurpleSavedstatusesGetAll();
                    foreach (int status in rawStatuses)
                    {
                        if (!prpl.PurpleSavedstatusIsTransient(status))
                        {
                            int    id, statId;
                            string title, message;

                            title   = prpl.PurpleSavedstatusGetTitle(status);
                            id      = prpl.PurpleSavedstatusFind(title);
                            statId  = prpl.PurpleSavedstatusGetType(status);
                            message = prpl.PurpleSavedstatusGetMessage(status);

                            statuses.Add(new PidginSavedStatusItem(title, message, id, statId));
                        }
                    }
                } catch (Exception e) {
                    Log <PidginSavedStatusItemSource> .Error("Could not read saved statuses: {0}", e.Message);

                    Log <PidginSavedStatusItemSource> .Debug(e.StackTrace);
                }
            }
        }
Example #3
0
        public override bool SupportsItem(Item item)
        {
            Pidgin.IPurpleObject prpl;
            try {
                prpl = Pidgin.GetPurpleObject();
                if (!prpl.PurpleAccountIsConnected((item as PidginAccountItem).Id))
                {
                    return(true);
                }
            } catch { }

            return(false);
        }
Example #4
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            int    status;
            string message = "";

            try {
                Pidgin.IPurpleObject prpl = Pidgin.GetPurpleObject();

                if (items.First() is PidginSavedStatusItem)
                {
                    status = (items.First() as PidginSavedStatusItem).ID;
                    prpl.PurpleSavedstatusActivate(status);
                }
                else if (items.First() is PidginStatusTypeItem)
                {
                    status = (items.First() as PidginStatusTypeItem).Status;
                    if (modItems.Any())
                    {
                        message = (modItems.First() as ITextItem).Text;
                    }
                    Pidgin.PurpleSetAvailabilityStatus(status, message);
                }
                else if (items.First() is ITextItem)
                {
                    if (modItems.Any())
                    {
                        status = (modItems.First() as PidginStatusTypeItem).Status;
                    }
                    else
                    {
                        status = prpl.PurpleSavedstatusGetType(prpl.PurpleSavedstatusGetCurrent());
                    }
                    message = (items.First() as ITextItem).Text;
                    Pidgin.PurpleSetAvailabilityStatus(status, message);
                }
            } catch (Exception e) {
                Log <PidginSetStatusAction> .Error("Could not set Pidgin status: {0}", e.Message);

                Log <PidginSetStatusAction> .Debug(e.StackTrace);
            }

            yield break;
        }
Example #5
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            Pidgin.IPurpleObject prpl;
            PidginAccountItem    account = items.First() as PidginAccountItem;

            try {
                prpl = Pidgin.GetPurpleObject();
                try {
                    prpl.PurpleAccountSetEnabled(account.Id, gtkGaim, (int)0);
                }
                catch {
                    prpl.PurpleAccountSetEnabled(account.Id, gtkGaim, (uint)0);
                }
            } catch (Exception e) {
                Log <PidginDisableAccount> .Error("Could not disable Pidgin account: {0}", e.Message);

                Log <PidginDisableAccount> .Debug(e.StackTrace);
            }
            yield break;
        }
Example #6
0
        public override void UpdateItems()
        {
            Pidgin.IPurpleObject prpl;
            prpl = Pidgin.GetPurpleObject();
            string name, proto;

            if (Pidgin.InstanceIsRunning)
            {
                items.Clear();
                try {
                    foreach (int account in prpl.PurpleAccountsGetAll())
                    {
                        proto = prpl.PurpleAccountGetProtocolName(account);
                        name  = prpl.PurpleAccountGetUsername(account);
                        items.Add(new PidginAccountItem(name, proto, account));
                    }
                } catch (Exception e) {
                    Log <PidginAccountItemSource> .Error("Could not get Pidgin accounts: {0}", e.Message);

                    Log <PidginAccountItemSource> .Debug(e.StackTrace);
                }
            }
        }