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

            return(prpl.PurpleAccountIsConnected(account.Id));
        }
示例#2
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;
        }