[#1886] No more compile warnings. + 1 comm

This commit is contained in:
Jérémy Quentin
2009-07-21 11:50:29 -04:00
parent 4eb3718f26
commit 8ff829ecfd
6 changed files with 43 additions and 35 deletions

View File

@ -127,7 +127,7 @@ bool AccountListModel::addAccount( QString alias )
return true; return true;
} }
int AccountListModel::rowCount(const QModelIndex & parent) const int AccountListModel::rowCount(const QModelIndex & /*parent*/) const
{ {
return accounts->size(); return accounts->size();
} }

View File

@ -56,13 +56,13 @@
***************************************************************************/ ***************************************************************************/
typedef struct { typedef struct {
char success; bool success;
char reason[200]; QString reason;
char user[200]; QString user;
char passwd[200]; QString passwd;
} rest_account; } rest_account;
int req(char *host, int port, char *req, char *ret) { int sendRequest(QString host, int port, QString req, QString & ret) {
int s; int s;
struct sockaddr_in servSockAddr; struct sockaddr_in servSockAddr;
@ -74,9 +74,9 @@ int req(char *host, int port, char *req, char *ret) {
char buf[1024]; char buf[1024];
bzero(&servSockAddr, sizeof(servSockAddr)); bzero(&servSockAddr, sizeof(servSockAddr));
servHostEnt = gethostbyname(host); servHostEnt = gethostbyname(host.toLatin1());
if (servHostEnt == NULL) { if (servHostEnt == NULL) {
strcpy(ret, "gethostbyname"); ret = "gethostbyname";
return -1; return -1;
} }
bcopy((char *)servHostEnt->h_addr, (char *)&servSockAddr.sin_addr, servHostEnt->h_length); bcopy((char *)servHostEnt->h_addr, (char *)&servSockAddr.sin_addr, servHostEnt->h_length);
@ -84,20 +84,22 @@ int req(char *host, int port, char *req, char *ret) {
servSockAddr.sin_family = AF_INET; servSockAddr.sin_family = AF_INET;
if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0) { if ((s = socket(AF_INET,SOCK_STREAM,0)) < 0) {
strcpy(ret, "socket"); ret = "socket";
return -1; return -1;
} }
if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) { if(connect(s, (const struct sockaddr *) &servSockAddr, (socklen_t) sizeof(servSockAddr)) < 0 ) {
perror("foo"); perror(NULL);
strcpy(ret, "connect"); ret = "connect";
return -1; return -1;
} }
f = fdopen(s, "r+"); f = fdopen(s, "r+");
fprintf(f, "%s HTTP/1.1\r\n", req); const char * req2 = req.toLatin1();
fprintf(f, "Host: %s\r\n", host); const char * host2 = host.toLatin1();
fprintf(f, "%s HTTP/1.1\r\n", req2);
fprintf(f, "Host: %s\r\n", host2);
fputs("User-Agent: SFLphone\r\n", f); fputs("User-Agent: SFLphone\r\n", f);
fputs("\r\n", f); fputs("\r\n", f);
@ -113,7 +115,8 @@ int req(char *host, int port, char *req, char *ret) {
ret[i] = fgetc(f); ret[i] = fgetc(f);
if (status != 200) { if (status != 200) {
sprintf(ret, "http error: %ld", status); ret = "http error: " + status;
// sprintf(ret, "http error: %ld", status);
return -1; return -1;
} }
@ -123,22 +126,22 @@ int req(char *host, int port, char *req, char *ret) {
return 0; return 0;
} }
rest_account get_rest_account(char *host,char *email) { rest_account get_rest_account(QString host, QString email) {
char ret[4096]; QString req = "GET /rest/accountcreator?email=" + email;
QString ret;
rest_account ra; rest_account ra;
bzero(ret, sizeof(ret)); qDebug() << "HOST: " << host;
printf("HOST: %s\n", host); int res = sendRequest(host, 80, req, ret);
strcpy(ret,"GET /rest/accountcreator?email="); if (res != -1) {
strcat(ret, email); QStringList list = ret.split("\n");
if (req(host, 80, ret, ret) != -1) { ra.user = list[0];
strcpy(ra.user, strtok(ret, "\n")); ra.passwd = list[1];\
strcpy(ra.passwd, strtok(NULL, "\n"));\ ra.success = true;
ra.success = 1;
} else { } else {
ra.success = 0; ra.success = false;
strcpy(ra.reason, ret); ra.reason = ret;
} }
puts(ret); qDebug() << ret;
return ra; return ra;
} }

View File

@ -71,12 +71,12 @@ QVariant CodecListModel::data ( const QModelIndex & index, int role) const
} }
int CodecListModel::rowCount(const QModelIndex & parent) const int CodecListModel::rowCount(const QModelIndex & /*parent*/) const
{ {
return codecs.count(); return codecs.count();
} }
int CodecListModel::columnCount(const QModelIndex & parent) const int CodecListModel::columnCount(const QModelIndex & /*parent*/) const
{ {
return 4; return 4;
} }

View File

@ -43,7 +43,12 @@ protected:
public: public:
Item(QListWidget *list=0) /**
* Would be great to take the QListWidget as attribute
* to be able to add the itemWidget to the item in the list.
* For the moment, we have to do it from outside.
*/
Item(/*QListWidget *list=0*/)
{ {
item = NULL; item = NULL;
itemWidget = NULL; itemWidget = NULL;
@ -63,6 +68,7 @@ public:
{ {
return item; return item;
} }
WIDGET_TYPE * getItemWidget() WIDGET_TYPE * getItemWidget()
{ {
return itemWidget; return itemWidget;

View File

@ -54,7 +54,7 @@ int main(int argc, char **argv)
//configuration dbus //configuration dbus
registerCommTypes(); registerCommTypes();
SFLPhone * fenetre = new SFLPhone(); new SFLPhone();
InstanceInterface & instance = InstanceInterfaceSingleton::getInstance(); InstanceInterface & instance = InstanceInterfaceSingleton::getInstance();
instance.Register(getpid(), APP_NAME); instance.Register(getpid(), APP_NAME);

View File

@ -1343,10 +1343,9 @@ void sflphone_kdeView::on1_error(MapStringString details)
qDebug() << "Signal : Daemon error : " << details; qDebug() << "Signal : Daemon error : " << details;
} }
void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString & callID) void sflphone_kdeView::on1_incomingCall(const QString & /*accountID*/, const QString & callID)
{ {
qDebug() << "Signal : Incoming Call ! ID = " << callID; qDebug() << "Signal : Incoming Call ! ID = " << callID;
ConfigurationManagerInterface & configurationManager = ConfigurationManagerInterfaceSingleton::getInstance();
Call * call = callList->addIncomingCall(callID); Call * call = callList->addIncomingCall(callID);
addCallToCallList(call); addCallToCallList(call);
listWidget_callList->setCurrentRow(listWidget_callList->count() - 1); listWidget_callList->setCurrentRow(listWidget_callList->count() - 1);
@ -1355,7 +1354,7 @@ void sflphone_kdeView::on1_incomingCall(const QString &accountID, const QString
void sflphone_kdeView::on1_incomingMessage(const QString &accountID, const QString &message) void sflphone_kdeView::on1_incomingMessage(const QString &accountID, const QString &message)
{ {
qDebug() << "Signal : Incoming Message ! \nMessage : " << message; qDebug() << "Signal : Incoming Message for account " << accountID << " ! \nMessage : " << message;
} }
void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count) void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count)
@ -1363,7 +1362,7 @@ void sflphone_kdeView::on1_voiceMailNotify(const QString &accountID, int count)
qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID; qDebug() << "Signal : VoiceMail Notify ! " << count << " new voice mails for account " << accountID;
} }
void sflphone_kdeView::on1_volumeChanged(const QString &device, double value) void sflphone_kdeView::on1_volumeChanged(const QString & /*device*/, double value)
{ {
qDebug() << "Signal : Volume Changed !"; qDebug() << "Signal : Volume Changed !";
if(! (toolButton_recVol->isChecked() && value == 0.0)) if(! (toolButton_recVol->isChecked() && value == 0.0))