Esempio n. 1
0
        public override IEnumerable <Item> Perform(IEnumerable <Item> items, IEnumerable <Item> modItems)
        {
            Item   item    = items.First();
            Item   moditem = modItems.First();
            string name    = null;

            if (item is ContactItem && moditem is IFileItem)
            {
                // Just grab the first protocol we see.
                ContactItem contact = item as ContactItem;
                foreach (string detail in contact.Details)
                {
                    if (detail.StartsWith("prpl-"))
                    {
                        name = contact[detail];
                        // If this buddy is online, break, else keep looking.
                        if (Pidgin.BuddyIsOnline(name))
                        {
                            break;
                        }
                    }
                }
            }

            if (name != null)
            {
                new Thread((ThreadStart) delegate {
                    IFileItem file = moditem as IFileItem;
                    WoofServer ws  = new WoofServer(name);
                    ws.ServeFile(file.Path);
                    return;
                }).Start();
            }

            return(null);
        }
Esempio n. 2
0
        public override IEnumerable<Item> Perform(IEnumerable<Item> items, IEnumerable<Item> modItems)
        {
            Item item = items.First ();
            Item moditem = modItems.First ();
            string name = null;

            if (item is ContactItem && moditem is IFileItem) {
                // Just grab the first protocol we see.
                ContactItem contact = item as ContactItem;
                foreach (string detail in contact.Details) {
                    if (detail.StartsWith ("prpl-")) {
                        name = contact[detail];
                        // If this buddy is online, break, else keep looking.
                        if (Pidgin.BuddyIsOnline (name)) break;
                    }
                }
            }

            if (name != null) {
                new Thread ((ThreadStart) delegate {
                        IFileItem file = moditem as IFileItem;
                        WoofServer ws = new WoofServer (name);
                        ws.ServeFile(file.Path);
                        return;
                        }).Start ();
            }

            return null;
        }