+static PyObject*
+pyobj_from_usernode(struct userNode* user) {
+ unsigned int n;
+ struct modeNode *mn;
+ PyObject* pChanList = PyTuple_New(user->channels.used);
+
+ for (n=0; n < user->channels.used; n++) {
+ mn = user->channels.list[n];
+ PyTuple_SetItem(pChanList, n, Py_BuildValue("s", mn->channel->name));
+ }
+
+ return Py_BuildValue("{"
+ "s: s, " /* nick */
+ "s: s, " /* ident */
+ "s: s, " /* info */
+ "s: s, " /* hostname */
+ "s: s, " /* ip */
+ "s: s, " /* fakehost */
+ "s: s, " /* sethost */
+ "s: s, " /* crypthost */
+ "s: s, " /* cryptip */
+#ifdef WITH_PROTOCOL_P10
+ "s: s, " /* numeric */
+#endif /* WITH_PROTOCOL_P10 */
+ "s: i, " /* loc */
+ "s: i, " /* no_notice */
+ "s: s, " /* mark */
+ "s: s, " /* version_reply */
+ "s: s, " /* account */
+ "s: O}", /* channels */
+ "nick", user->nick,
+ "ident", user->ident,
+ "info", user->info,
+ "hostname", user->hostname,
+ "ip", irc_ntoa(&user->ip),
+ "fakehost", user->fakehost,
+ "sethost", user->sethost,
+ "crypthost", user->crypthost,
+ "cryptip", user->cryptip,
+#ifdef WITH_PROTOCOL_P10
+ "numeric", user->numeric,
+#endif /* WITH_PROTOCOL_P10 */
+ "loc", user->loc,
+ "no_notice", user->no_notice,
+ "mark", user->mark,
+ "version_reply", user->version_reply,
+ "account", user->handle_info ? user->handle_info->handle : NULL,
+ "channels", pChanList);
+}
+