Changeset 377:ce50a6f821f3

Show
Ignore:
Timestamp:
05/18/2009 10:14:32 PM (3 years ago)
Author:
Dmitry Nezhevenko <dion@…>
Branch:
default
Message:

Store last user version

Files:
4 modified

Legend:

Unmodified
Added
Removed
  • sql/update/pgsql/00374.sql

    r376 r377  
    1919  cnt_kick int NOT NULL default 0, 
    2020  cnt_ban int NOT NULL default 0, 
     21   
     22  version varchar(200) NULL, 
     23 
    2124  PRIMARY KEY(id), 
    2225  FOREIGN KEY(jid_id) REFERENCES conference_jids(id) ON DELETE CASCADE, 
  • src/plugins/muc/jidstat.cpp

    r376 r377  
    157157        } 
    158158} 
     159 
     160void JidStat::setVersion(const QString& v) 
     161{ 
     162        if (id_ <= 0) 
     163                return; 
     164 
     165        QSqlQuery q = DataStorage::instance()->prepareQuery( 
     166                        "UPDATE conference_jidstat SET version=? WHERE id=?" 
     167        ); 
     168        q.addBindValue(v); 
     169        q.addBindValue(id_); 
     170        if (!q.exec()) 
     171        { 
     172                qDebug() << "ERROR: Unable to update version info"; 
     173        } 
     174} 
  • src/plugins/muc/jidstat.h

    r376 r377  
    1818 *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             * 
    1919 ***************************************************************************/ 
    20 #ifndef NICKSTAT_H_ 
    21 #define NICKSTAT_H_ 
     20#ifndef JIDSTAT_H_ 
     21#define JIDSTAT_H_ 
    2222 
    2323#include <QString> 
     
    5252        void commit(); 
    5353        void setLastAction(ActionType type, const QString& reason); 
     54        void setVersion(const QString& version); 
    5455private: 
    5556        int id_; 
     
    6061}; 
    6162 
    62 #endif /* NICKSTAT_H_ */ 
     63#endif /* JIDSTAT_H_ */ 
  • src/plugins/muc/mucplugin.cpp

    r375 r377  
    12191219        bot()->asyncRequests()->removeAll(req); 
    12201220        nick->setVersionStored(true); 
     1221 
     1222        JidStat *stat = nick->jidStat(); 
     1223        if (stat) 
     1224        { 
     1225                stat->setVersion(QString("%1 %2 // %3").arg(nick->versionName(), 
     1226                                nick->versionClient(), nick->versionOs())); 
     1227        } 
     1228 
    12211229        checkMember(0L, conf, nick, AListItem::MatcherVersion); 
    12221230        return true;