Exemplo n.º 1
0
        private void submit_content_Click(object sender, EventArgs e)
        {
            message.Message new_message = new message.Message("content", Global.client.client_name + ": " + this.content_input.Text, Global.client.room_code);

            Global.client.send_message(new_message);

            this.content_input.Clear();
        }
Exemplo n.º 2
0
        void accept_messages(object thread_sleep_time)
        {
            while (true)
            {
                message.Message accepted_message = Global.client.accept_message((int)thread_sleep_time);

                if (accepted_message.type == "content")
                {
                    accepted_message.content = accepted_message.content.Replace("\n", Environment.NewLine);

                    accepted_message.content = accepted_message.content.Replace(":)", Emoji.smile);

                    accepted_message.content = accepted_message.content.Replace(";)", Emoji.wink);

                    accepted_message.content = accepted_message.content.Replace(":(", Emoji.cry);

                    this.text_screen.Text += accepted_message.content;
                }
            }
        }
Exemplo n.º 3
0
        public void ImportFacebookContacts()
        {
            var query =
                string.Format(
                    "SELECT uid, first_name, last_name, current_location, pic_big, profile_url, proxied_email, sex FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1 = {0})",
                    api.Application.Session.UserId);

            var rows = api.Fql.Query <users_getInfo_response>(query);

            foreach (var row in rows.user)
            {
                try
                {
                    var usr = repository.GetUserByFBID(row.uid.Value.ToString(), subdomainid);
                    if (usr != null)
                    {
                        continue;
                    }

                    var firstname = row.first_name;
                    var lastname  = row.last_name;

                    if (string.IsNullOrEmpty(firstname) && string.IsNullOrEmpty(lastname))
                    {
                        continue;
                    }

                    var org = new organisation
                    {
                        subdomain = subdomainid,
                        name      = string.Format("{0} {1}", firstname, lastname)
                    };

                    var friend = new user()
                    {
                        role                 = UserRole.USER.ToInt(),
                        email                = "",
                        proxiedEmail         = row.proxied_email,
                        firstName            = firstname,
                        lastName             = lastname,
                        gender               = row.sex,
                        organisation         = repository.AddOrganisation(org),
                        externalProfilePhoto = row.pic_big,
                        externalProfileUrl   = row.profile_url,
                        FBID                 = row.uid.Value.ToString(),
                        viewid               = Crypto.Utility.GetRandomString(),
                        permissions          = (int)UserPermission.USER
                    };

                    repository.UpdateCounters(subdomainid, 1, CounterType.CONTACTS_PRIVATE);

                    repository.AddUser(friend);

                    friend.externalProfilePhoto.ReadAndSaveFromUrl(subdomainid, friend.id, friend.id, PhotoType.PROFILE);
                }
                catch (Exception ex)
                {
                    Syslog.Write(ex);
                }
            }

            // mail user
            var owner = repository.GetUserById(ownerid, subdomainid);
            var msg   = new message.Message(owner, null, subdomainid);

            msg.SendMessage(null, repository, EmailViewType.GENERIC,
                            "Your Facebook contacts have been successfully imported", "Import Contacts");
        }