Beispiel #1
0
void clientMessageHandle(int client_sock,string message){
	vector<string> choppedString;
	stringChopper(message,choppedString);
	if (choppedString[0].compare("LIN") == 0){
		userLogin(client_sock,choppedString);
	}
	else if (choppedString[0].compare("LOU") == 0){
		userLogout(client_sock,choppedString);
	}
	else if (choppedString[0].compare("REG") == 0){
		userRegister(client_sock,choppedString);
	} 
	else if (choppedString[0].compare("MSG") == 0){
		sendMessage(client_sock,choppedString);
	}
	else if (choppedString[0].compare("CGR") == 0){
		createGroup(client_sock,choppedString);
	} 
	else if (choppedString[0].compare("JGR") == 0){
		joinGroup(client_sock,choppedString);
	}
	else if (choppedString[0].compare("LGR") == 0){
		leaveGroup(client_sock,choppedString);
	}
	else{
		errorReply(client_sock,"000","Protocol error!");
	}
}
Beispiel #2
0
void removeProcess(struct Process *proc) { //remove zombie
	//delete root page table
	deallocPhysPage(proc->addressSpace);

	//delete main thread
	//deallocThread(proc->mainThread); already done on kthreadExit
	leaveGroup(proc);
	unlinkChild(proc);
	procHTDel(proc);
	kfree(proc);
}
Beispiel #3
0
int SocketUDP::close()
{
    int r;
    
    if (_ip.getType() == IPv4::TYPE_MULTICAST && _leaveGroup) {
        _igmpSender.pause();

        r = leaveGroup();
        if (r != E_OK)
            return r;
    }
    
    return Socket::close();
}
Beispiel #4
0
void MulticastSocket::leaveGroup(const IPAddress& groupAddress)
{
	NetworkInterface intf;
	leaveGroup(groupAddress, intf);
}
Beispiel #5
0
Gui_Groups::Gui_Groups(LinqClient* c, QWidget* parent) : QGridLayout(parent), _client(c) {
    Gui_Avatar* portrait = new Gui_Avatar(QString::fromStdString(_client->avatar()));
    QPushButton* create = new QPushButton("CREATE");
    QLabel* title = new QLabel("NEW GROUP");
    showgrp = new Gui_DisplayInfo;
    newpost = new QTextEdit;
    newgrp = new QLineEdit;
    search = new QLineEdit;
    newbox = new QGroupBox;
    memlbl = new QLabel("Members");
    memlbl->setMaximumSize(80,20);

    grpname = new QLineEdit;
    newgrplayout = new QFormLayout;
    newgrplayout->setSpacing(15);
    newgrplayout->addRow(title);
    newgrplayout->addRow("Group name:", grpname);
    newgrplayout->addRow("Group description:", newgrp);
    newgrplayout->addRow(create);

    newbox->setLayout(newgrplayout);
    if(_client->level() < executive) newbox->hide();

    search->setPlaceholderText("Search group..");
    search->hide();
    connect(search,  SIGNAL(returnPressed()), this, SLOT(searchGroup()));

    post = new QPushButton("POST");
    grplist = new QListWidget;
    memlist = new QListWidget;
    QLabel* grplbl = new QLabel("Groups");
    grplbl->setMaximumSize(120,20);
    createGroups();
    QFormLayout* frm = new QFormLayout;
    mbuttons[0] = new QPushButton;
    mbuttons[0]->setIcon(QPixmap("img/document185.png"));
    mbuttons[0]->setToolTip("New group");
    mbuttons[1] = new QPushButton;
    mbuttons[1]->setIcon(QPixmap("img/cross108.png"));
    mbuttons[1]->setToolTip("Delete group");
    mbuttons[2] = new QPushButton;
    mbuttons[2]->setIcon(QPixmap("img/mop2.png"));
    mbuttons[2]->setToolTip("Delete all posts");
    mbuttons[3] = new QPushButton;
    mbuttons[3]->setIcon(QPixmap("img/exit6.png"));
    mbuttons[3]->setToolTip("Leave this group");
    mbuttons[4] = new QPushButton;
    mbuttons[4]->setIcon(QPixmap("img/enter3.png"));
    mbuttons[4]->setToolTip("Join this group");

    frm->addRow(mbuttons[0]);
    frm->addRow(mbuttons[3]);
    frm->addRow(mbuttons[4]);
    frm->addRow(mbuttons[1]);
    frm->addRow(mbuttons[2]);

    connect(mbuttons[0], SIGNAL(clicked()), this, SLOT(showNewGroup()));
    connect(create, SIGNAL(clicked()), this, SLOT(newGroup()));
    connect(mbuttons[1], SIGNAL(clicked()), this, SLOT(deleteGroup()));
    connect(mbuttons[2], SIGNAL(clicked()), this, SLOT(clearPosts()));
    connect(mbuttons[3], SIGNAL(clicked()), this, SLOT(leaveGroup()));
    connect(mbuttons[4], SIGNAL(clicked()), this, SLOT(addGroup()));

    mbuttons[0]->hide();
    mbuttons[1]->hide();
    mbuttons[2]->hide();
    mbuttons[3]->hide();
    mbuttons[4]->hide();
    if(_client->level() >= executive)
        mbuttons[0]->show();
    tbar = new QToolBar;
    tbuttons[0] = new QToolButton(tbar);
    tbuttons[0]->setIcon(QPixmap("img/cross108.png"));
    tbar->addWidget(tbuttons[0]);

    newpost->setStyleSheet("background: #1a1a1a; font-weight:400");
    newpost->setPlaceholderText("Insert new post into this group.");
    newpost->hide();
    post->hide();
    showgrp->hide();
    memlbl->hide();
    memlist->hide();
    memlist->setContextMenuPolicy(Qt::CustomContextMenu);
    connect(memlist, SIGNAL(customContextMenuRequested(const QPoint&)), this, SLOT(memListMenu(const QPoint&)));

    addWidget(newbox, 0, 1, 1, 1);
    addWidget(portrait, 0, 0, 1, 1, Qt::AlignTop);
    addWidget(showgrp, 0, 1, 3, 1);
    addLayout(frm, 0, 2, 1, 1, Qt::AlignRight);
    addWidget(newpost, 3, 1, 2, 3);
    addWidget(post, 5, 4, 1, 1, Qt::AlignRight);
    addWidget(grplbl, 1, 0, 1, 1);
    addWidget(grplist, 2, 0, 1, 1);
    addWidget(memlbl, 3, 0, 1, 1);
    addWidget(memlist, 4, 0, 1, 1);
    addWidget(search, 5, 0, 1, 1);
    setRowStretch(0, 0);
    setRowStretch(1, 10);
    setColumnStretch(0, 1);
    setColumnStretch(1, 5);
    connect(grplist, SIGNAL(clicked(QModelIndex)), this, SLOT(showGroup()));
    connect(post, SIGNAL(clicked()), this, SLOT(sendPost()));
    connect(this, SIGNAL(created(int)), this, SLOT(refresh(int)));
}