The very start of a small framework for social.
[cascardo/sgp.git] / src / friend.c
diff --git a/src/friend.c b/src/friend.c
new file mode 100644 (file)
index 0000000..db5c457
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+ *  Copyright (C) 2013  Thadeu Lima de Souza Cascardo <cascardo@cascardo.info>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License along
+ *  with this program; if not, write to the Free Software Foundation, Inc.,
+ *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <sgp/friend.h>
+#include <sgp/channel.h>
+#include <stdlib.h>
+
+struct sgp_friend {
+       struct sgp_channel *channel;
+};
+
+struct sgp_friend * sgp_friend_new(char *alias)
+{
+       struct sgp_friend *friend;
+       friend = malloc(sizeof(*friend));
+       friend->channel = NULL;
+       return friend;
+}
+
+/*
+ * Get the channel used for communication with a friend.
+ */
+struct sgp_channel * sgp_friend_get_channel(struct sgp_friend *friend)
+{
+       /*
+        * TODO: A friend may have multiple channels for contact. We
+        * should either implement this at the core (at sgp_send, for
+        * example), or create a channel that encapsulates that.
+        */
+       return friend->channel;
+}