+
+QString Identity::defaultRealName()
+{
+ QString generalDefault = tr("Quassel IRC User");
+
+#ifdef Q_OS_MAC
+ return CFStringToQString(CSCopyUserName(false));
+
+#elif defined(Q_OS_UNIX)
+ QString realName;
+ struct passwd *pwd = getpwuid(getuid());
+ if (pwd)
+ realName = QString::fromUtf8(pwd->pw_gecos);
+ if (!realName.isEmpty())
+ return realName;
+ else
+ return generalDefault;
+
+#elif defined(Q_OS_WIN)
+ TCHAR infoBuf[128];
+ DWORD bufCharCount = 128;
+ if (GetUserName(infoBuf, &bufCharCount))
+ return tcharToQString(infoBuf);
+ else
+ return generalDefault;
+#else
+ return generalDefault;
+#endif
+}
+
+
+void Identity::setToDefaults()
+{
+ setIdentityName(tr("<empty>"));
+ setRealName(defaultRealName());
+ QStringList n = QStringList() << defaultNick();
+ setNicks(n);
+ setAwayNick("");
+ setAwayNickEnabled(false);
+ setAwayReason(tr("Gone fishing."));
+ setAwayReasonEnabled(true);
+ setAutoAwayEnabled(false);
+ setAutoAwayTime(10);
+ setAutoAwayReason(tr("Not here. No, really. not here!"));
+ setAutoAwayReasonEnabled(false);
+ setDetachAwayEnabled(false);
+ setDetachAwayReason(tr("All Quassel clients vanished from the face of the earth..."));
+ setDetachAwayReasonEnabled(false);
+ setIdent("quassel");
+ setKickReason(tr("Kindergarten is elsewhere!"));
+ setPartReason(tr("https://quassel-irc.org - Chat comfortably. Anywhere."));
+ setQuitReason(tr("https://quassel-irc.org - Chat comfortably. Anywhere."));
+}
+
+