projects
/
quassel.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Show current network name in main window title too
[quassel.git]
/
src
/
common
/
identity.cpp
diff --git
a/src/common/identity.cpp
b/src/common/identity.cpp
index
b8afedf
..
275afcc
100644
(file)
--- a/
src/common/identity.cpp
+++ b/
src/common/identity.cpp
@@
-22,6
+22,7
@@
#include <QMetaProperty>
#include <QVariantMap>
#include <QMetaProperty>
#include <QVariantMap>
+#include <QString>
#ifdef Q_OS_MAC
# include <CoreServices/CoreServices.h>
#ifdef Q_OS_MAC
# include <CoreServices/CoreServices.h>
@@
-41,6
+42,7
@@
# include <Security.h>
#endif
# include <Security.h>
#endif
+INIT_SYNCABLE_OBJECT(Identity)
Identity::Identity(IdentityId id, QObject *parent)
: SyncableObject(parent),
_identityId(id)
Identity::Identity(IdentityId id, QObject *parent)
: SyncableObject(parent),
_identityId(id)
@@
-88,7
+90,10
@@
QString Identity::defaultNick() {
nick = shortUserName;
#elif defined(Q_OS_UNIX)
nick = shortUserName;
#elif defined(Q_OS_UNIX)
- QString userName = getlogin();
+ QString userName;
+ struct passwd *pwd = getpwuid(getuid());
+ if(pwd)
+ userName = pwd->pw_name;
if(!userName.isEmpty())
nick = userName;
if(!userName.isEmpty())
nick = userName;
@@
-108,15
+113,27
@@
QString Identity::defaultNick() {
#endif
// cleaning forbidden characters from nick
#endif
// cleaning forbidden characters from nick
- QRegExp rx(QString("(^[\\d-]+|[^A-Za-z\x5b-\x60\x7b-\x7d])"));
+ QRegExp rx(QString("(^[\\d-]+|[^A-Za-z
0-9
\x5b-\x60\x7b-\x7d])"));
nick.remove(rx);
return nick;
}
QString Identity::defaultRealName() {
QString generalDefault = tr("Quassel IRC User");
nick.remove(rx);
return nick;
}
QString Identity::defaultRealName() {
QString generalDefault = tr("Quassel IRC User");
+
#ifdef Q_OS_MAC
return CFStringToQString(CSCopyUserName(false));
#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_WIN32)
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
#elif defined(Q_OS_WIN32)
TCHAR infoBuf[128];
DWORD bufCharCount = 128;
@@
-132,8
+149,7
@@
QString Identity::defaultRealName() {
void Identity::setToDefaults() {
setIdentityName(tr("<empty>"));
setRealName(defaultRealName());
void Identity::setToDefaults() {
setIdentityName(tr("<empty>"));
setRealName(defaultRealName());
- QStringList n;
- n << defaultNick() << defaultNick() + "_" << defaultNick() + "__";
+ QStringList n = QStringList() << defaultNick();
setNicks(n);
setAwayNick("");
setAwayNickEnabled(false);
setNicks(n);
setAwayNick("");
setAwayNickEnabled(false);
@@
-156,98
+172,100
@@
void Identity::setToDefaults() {
void Identity::setId(IdentityId _id) {
_identityId = _id;
void Identity::setId(IdentityId _id) {
_identityId = _id;
+ SYNC(ARG(_id))
emit idSet(_id);
renameObject(QString::number(id().toInt()));
}
void Identity::setIdentityName(const QString &identityName) {
_identityName = identityName;
emit idSet(_id);
renameObject(QString::number(id().toInt()));
}
void Identity::setIdentityName(const QString &identityName) {
_identityName = identityName;
- emit identityNameSet(identityName);
+ SYNC(ARG(identityName))
}
void Identity::setRealName(const QString &realName) {
_realName = realName;
}
void Identity::setRealName(const QString &realName) {
_realName = realName;
- emit realNameSet(realName);
+ SYNC(ARG(realName))
}
void Identity::setNicks(const QStringList &nicks) {
_nicks = nicks;
}
void Identity::setNicks(const QStringList &nicks) {
_nicks = nicks;
+ SYNC(ARG(nicks))
emit nicksSet(nicks);
}
void Identity::setAwayNick(const QString &nick) {
_awayNick = nick;
emit nicksSet(nicks);
}
void Identity::setAwayNick(const QString &nick) {
_awayNick = nick;
- emit awayNickSet(nick);
+ SYNC(ARG(nick))
}
void Identity::setAwayReason(const QString &reason) {
_awayReason = reason;
}
void Identity::setAwayReason(const QString &reason) {
_awayReason = reason;
- emit awayReasonSet(reason);
+ SYNC(ARG(reason))
}
void Identity::setAwayNickEnabled(bool enabled) {
_awayNickEnabled = enabled;
}
void Identity::setAwayNickEnabled(bool enabled) {
_awayNickEnabled = enabled;
- emit awayNickEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setAwayReasonEnabled(bool enabled) {
_awayReasonEnabled = enabled;
}
void Identity::setAwayReasonEnabled(bool enabled) {
_awayReasonEnabled = enabled;
- emit awayReasonEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setAutoAwayEnabled(bool enabled) {
_autoAwayEnabled = enabled;
}
void Identity::setAutoAwayEnabled(bool enabled) {
_autoAwayEnabled = enabled;
- emit autoAwayEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setAutoAwayTime(int time) {
_autoAwayTime = time;
}
void Identity::setAutoAwayTime(int time) {
_autoAwayTime = time;
- emit autoAwayTimeSet(time);
+ SYNC(ARG(time))
}
void Identity::setAutoAwayReason(const QString &reason) {
_autoAwayReason = reason;
}
void Identity::setAutoAwayReason(const QString &reason) {
_autoAwayReason = reason;
- emit autoAwayReasonSet(reason);
+ SYNC(ARG(reason))
}
void Identity::setAutoAwayReasonEnabled(bool enabled) {
_autoAwayReasonEnabled = enabled;
}
void Identity::setAutoAwayReasonEnabled(bool enabled) {
_autoAwayReasonEnabled = enabled;
- emit autoAwayReasonEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setDetachAwayEnabled(bool enabled) {
_detachAwayEnabled = enabled;
}
void Identity::setDetachAwayEnabled(bool enabled) {
_detachAwayEnabled = enabled;
- emit detachAwayEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setDetachAwayReason(const QString &reason) {
_detachAwayReason = reason;
}
void Identity::setDetachAwayReason(const QString &reason) {
_detachAwayReason = reason;
- emit detachAwayReasonSet(reason);
+ SYNC(ARG(reason))
}
void Identity::setDetachAwayReasonEnabled(bool enabled) {
_detachAwayReasonEnabled = enabled;
}
void Identity::setDetachAwayReasonEnabled(bool enabled) {
_detachAwayReasonEnabled = enabled;
- emit detachAwayReasonEnabledSet(enabled);
+ SYNC(ARG(enabled))
}
void Identity::setIdent(const QString &ident) {
_ident = ident;
}
void Identity::setIdent(const QString &ident) {
_ident = ident;
- emit identSet(ident);
+ SYNC(ARG(ident))
}
void Identity::setKickReason(const QString &reason) {
_kickReason = reason;
}
void Identity::setKickReason(const QString &reason) {
_kickReason = reason;
- emit kickReasonSet(reason);
+ SYNC(ARG(reason))
}
void Identity::setPartReason(const QString &reason) {
_partReason = reason;
}
void Identity::setPartReason(const QString &reason) {
_partReason = reason;
- emit partReasonSet(reason);
+ SYNC(ARG(reason))
}
void Identity::setQuitReason(const QString &reason) {
_quitReason = reason;
}
void Identity::setQuitReason(const QString &reason) {
_quitReason = reason;
- emit quitReasonSet(reason);
+ SYNC(ARG(reason))
}
/*** ***/
}
/*** ***/
@@
-297,3
+315,6
@@
QDataStream &operator>>(QDataStream &in, Identity &id) {
return in;
}
return in;
}
+#ifdef HAVE_SSL
+INIT_SYNCABLE_OBJECT(CertManager)
+#endif // HAVE_SSL