$ git clone https://socialnetwork.ion.nu/socialnetwork.git
commit b3f54256b676bbca6805fd5c27d4270f6994f31d
Author: Alicia <...>
Date:   Wed Aug 2 16:54:43 2017 +0000

    Added social_user_getfield()

diff --git a/social.c b/social.c
index b68b316..9534bc8 100644
--- a/social.c
+++ b/social.c
@@ -355,6 +355,17 @@ unsigned int social_user_loadmore(struct user* user)
   return user->updatecount-oldcount;
 }
 
+const char* social_user_getfield(struct user* user, const char* name)
+{
+  unsigned int i;
+  for(i=0; i<user->updatecount; ++i)
+  {
+    if(user->updates[i].type!=UPDATE_FIELD){continue;}
+    if(!strcmp(user->updates[i].field.name, name)){return user->updates[i].field.value;}
+  }
+  return 0;
+}
+
 void social_addfriend(const unsigned char id[ID_SIZE], uint32_t circle)
 {
   struct user* friend=social_finduser(id);
diff --git a/social.h b/social.h
index 087a156..eef4a5e 100644
--- a/social.h
+++ b/social.h
@@ -101,6 +101,15 @@ extern void social_user_removefromcircle(struct user* user, uint32_t circle, con
 * Returns: The number of additional updates loaded (will be 0 when there is nothing more to load)
 */
 extern unsigned int social_user_loadmore(struct user* user);
+/**
+* social_user_getfield:
+* @user: The user whose field you wish to access
+* @name: Name of the field
+*
+* Get the value of a #user's field update by name
+* Returns: The field's value, or NULL if none was found. Must not be modified or freed
+*/
+extern const char* social_user_getfield(struct user* user, const char* name);
 extern void social_addfriend(const unsigned char id[ID_SIZE], uint32_t circle);
 extern void social_removefriend(const unsigned char id[ID_SIZE], uint32_t circle);
 /**
@@ -111,6 +120,14 @@ extern void social_removefriend(const unsigned char id[ID_SIZE], uint32_t circle
 * Creates a post update
 */
 extern void social_createpost(const char* msg, struct privacy* privacy);
+/**
+* social_updatefield:
+* @name: Name of the field
+* @value: The field's (new) value
+* @privacy: Privacy setting for the field
+*
+* Sets the given field's value
+*/
 extern void social_updatefield(const char* name, const char* value, struct privacy* privacy);
 extern struct user* social_finduser(const unsigned char id[ID_SIZE]);
 extern void social_shareupdate(struct update* update);
diff --git a/socialtest.c b/socialtest.c
index d6cc161..52271d7 100644
--- a/socialtest.c
+++ b/socialtest.c
@@ -95,15 +95,15 @@ int main(int argc, char** argv)
       ssize_t len=read(0, buf, 1023);
       while(len>0 && strchr("\r\n", buf[len-1])){--len;}
       buf[len]=0;
-      if(!strcmp(buf, "lsfriends")) // TODO: These aren't necessarily friends
+      if(!strcmp(buf, "lsfriends")) // TODO: These aren't necessarily friends, just users we are somehow connected to
       {
         for(i=0; i<social_usercount; ++i)
         {
-          printf("%p %s\n", social_users[i], social_users[i]->peer?"(connected)":"");
+          printf("%p (%s) %s\n", social_users[i], social_user_getfield(social_users[i], "name"), social_users[i]->peer?"(connected)":"");
           unsigned int i2;
           for(i2=0; i2<social_users[i]->updatecount; ++i2)
           {
-            if(social_users[i]->updates[i2].type==UPDATE_FIELD)
+            if(social_users[i]->updates[i2].type==UPDATE_FIELD && strcmp(social_users[i]->updates[i2].field.name, "name"))
             {
               printf("  %s = %s", social_users[i]->updates[i2].field.name, social_users[i]->updates[i2].field.value);
             }
@@ -179,6 +179,7 @@ int main(int argc, char** argv)
         strcpy(name, &buf[13]);
         printf("Enter value: "); fflush(stdout);
         unsigned int len=read(0, buf, 1023);
+        while(len && (buf[len-1]=='\n'||buf[len-1]=='\r')){--len;}
         buf[len]=0;
         social_updatefield(name, buf, &privacy);
       }
diff --git a/udpstream.c b/udpstream.c
index 86cedf3..7b50481 100644
--- a/udpstream.c
+++ b/udpstream.c
@@ -333,7 +333,7 @@ ssize_t udpstream_read(struct udpstream* stream, void* buf, size_t size)
   {
     if(stream->recvpackets[i].seq==stream->inseq)
     {
-      ssize_t len=stream->recvpackets[i].buflen;
+      size_t len=stream->recvpackets[i].buflen;
       if(len>size) // Handle buffers smaller than the payload
       {
         memcpy(buf, stream->recvpackets[i].buf, size);