void LLPanelGroupNotices::onClickSendMessage(void* data) { LLPanelGroupNotices* self = (LLPanelGroupNotices*)data; if (self->mCreateSubject->getText().empty()) { // Must supply a subject LLNotificationsUtil::add("MustSpecifyGroupNoticeSubject"); return; } send_group_notice( self->mGroupID, self->mCreateSubject->getText(), self->mCreateMessage->getText(), self->mInventoryItem); //instantly add new notice. actual notice will be added after ferreshNotices call LLUUID id = LLUUID::generateNewID(); std::string subj = self->mCreateSubject->getText(); std::string name ; LLAgentUI::buildFullname(name); U32 timestamp = 0; LLSD row; row["id"] = id; row["columns"][0]["column"] = "icon"; row["columns"][1]["column"] = "subject"; row["columns"][1]["value"] = subj; row["columns"][2]["column"] = "from"; row["columns"][2]["value"] = name; row["columns"][3]["column"] = "date"; row["columns"][3]["value"] = build_notice_date(timestamp); row["columns"][4]["column"] = "sort"; row["columns"][4]["value"] = llformat( "%u", timestamp); self->mNoticesList->addElement(row, ADD_BOTTOM); self->mCreateMessage->clear(); self->mCreateSubject->clear(); onClickRemoveAttachment(data); self->arrangeNoticeView(VIEW_PAST_NOTICE); }
void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) { LLUUID id; std::string subj; std::string name; U32 timestamp; BOOL has_attachment; U8 asset_type; S32 i=0; S32 count = msg->getNumberOfBlocks("Data"); for (;i<count;++i) { msg->getUUID("Data","NoticeID",id,i); if (1 == count && id.isNull()) { // Only one entry, the dummy entry. mNoticesList->addCommentText(mNoNoticesStr); mNoticesList->setEnabled(FALSE); return; } msg->getString("Data","Subject",subj,i); msg->getString("Data","FromName",name,i); msg->getBOOL("Data","HasAttachment",has_attachment,i); msg->getU8("Data","AssetType",asset_type,i); msg->getU32("Data","Timestamp",timestamp,i); time_t t = timestamp; LLSD row; row["id"] = id; row["columns"][0]["column"] = "icon"; if (has_attachment) { std::string icon_name = get_item_icon_name( (LLAssetType::EType)asset_type, LLInventoryType::IT_NONE,FALSE, FALSE); row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = icon_name; } row["columns"][1]["column"] = "subject"; row["columns"][1]["value"] = subj; row["columns"][2]["column"] = "from"; row["columns"][2]["value"] = name; std::string buffer = build_notice_date(t); row["columns"][3]["column"] = "date"; row["columns"][3]["value"] = buffer; buffer = llformat( "%u", timestamp); row["columns"][4]["column"] = "sort"; row["columns"][4]["value"] = buffer; mNoticesList->addElement(row, ADD_BOTTOM); } mNoticesList->sortItems(); }
void LLPanelGroupNotices::processNotices(LLMessageSystem* msg) { LLUUID id; std::string subj; std::string name; U32 timestamp; BOOL has_attachment; U8 asset_type; S32 i=0; S32 count = msg->getNumberOfBlocks("Data"); mNoticesList->setEnabled(TRUE); //save sort state and set unsorted state to prevent unnecessary //sorting while adding notices bool save_sort = mNoticesList->isSorted(); mNoticesList->setNeedsSort(false); for (;i<count;++i) { msg->getUUID("Data","NoticeID",id,i); if (1 == count && id.isNull()) { // Only one entry, the dummy entry. mNoticesList->setCommentText(mNoNoticesStr); mNoticesList->setEnabled(FALSE); return; } //with some network delays we can receive notice list more then once... //so add only unique notices S32 pos = mNoticesList->getItemIndex(id); if(pos!=-1)//if items with this ID already in the list - skip it continue; msg->getString("Data","Subject",subj,i); msg->getString("Data","FromName",name,i); msg->getBOOL("Data","HasAttachment",has_attachment,i); msg->getU8("Data","AssetType",asset_type,i); msg->getU32("Data","Timestamp",timestamp,i); // we only have the legacy name here, convert it to a username if (LLAvatarNameCache::useDisplayNames()) { name = LLCacheName::buildUsername(name); } LLSD row; row["id"] = id; row["columns"][0]["column"] = "icon"; if (has_attachment) { std::string icon_name = LLInventoryIcon::getIconName( (LLAssetType::EType)asset_type, LLInventoryType::IT_NONE); row["columns"][0]["type"] = "icon"; row["columns"][0]["value"] = icon_name; } row["columns"][1]["column"] = "subject"; row["columns"][1]["value"] = subj; row["columns"][2]["column"] = "from"; row["columns"][2]["value"] = name; row["columns"][3]["column"] = "date"; row["columns"][3]["value"] = build_notice_date(timestamp); row["columns"][4]["column"] = "sort"; row["columns"][4]["value"] = llformat( "%u", timestamp); mNoticesList->addElement(row, ADD_BOTTOM); } mNoticesList->setNeedsSort(save_sort); mNoticesList->updateSort(); }