Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

projectns/: notify people when they obtain or lose contact status #4

Open
wants to merge 1 commit into
base: production
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions projectns/contact.c
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,10 @@ static void cmd_contact(sourceinfo_t *si, int parc, char *parv[])
else
command_success_nodata(si, _("\2%s\2 was set as a primary contact for project \2%s\2 (only visible to staff)."), entity(mu)->name, p->name);
}

myuser_notice(projectsvs.me, mu, "You have been added as a %s contact for the \2%s\2 project "
"(%s).", c->secondary ? "secondary" : "primary", p->name,
c->visible ? "user-visible" : "only visible to staff");
}
else
{
Expand Down Expand Up @@ -160,24 +164,36 @@ static void cmd_contact(sourceinfo_t *si, int parc, char *parv[])
c->visible = true;
logcommand(si, CMDLOG_ADMIN, "PROJECT:CONTACT:SET: \2%s\2 on \2%s\2 to %s", entity(mu)->name, p->name, "public");
command_success_nodata(si, _("\2%s\2 is now listed as a public contact for project \2%s\2."), entity(mu)->name, p->name);

myuser_notice(projectsvs.me, mu, "Your status as a contact for the \2%s\2 project "
"has changed (now user-visible).", p->name);
}
else if (change_visible == VIS_PRIVATE)
{
c->visible = false;
logcommand(si, CMDLOG_ADMIN, "PROJECT:CONTACT:SET: \2%s\2 on \2%s\2 to %s", entity(mu)->name, p->name, "private");
command_success_nodata(si, _("\2%s\2 is now only displayed to staff as contact for project \2%s\2."), entity(mu)->name, p->name);

myuser_notice(projectsvs.me, mu, "Your status as a contact for the \2%s\2 project "
"has changed (now only visible to staff).", p->name);
}
if (change_secondary == GC_SECONDARY)
{
c->secondary = true;
logcommand(si, CMDLOG_ADMIN, "PROJECT:CONTACT:SET: \2%s\2 on \2%s\2 to %s", entity(mu)->name, p->name, "secondary");
command_success_nodata(si, _("\2%s\2 is now considered a secondary contact for project \2%s\2."), entity(mu)->name, p->name);

myuser_notice(projectsvs.me, mu, "Your status as a contact for the \2%s\2 project "
"has changed (now secondary).", p->name);
}
else if (change_secondary == GC_PRIMARY)
{
c->secondary = false;
logcommand(si, CMDLOG_ADMIN, "PROJECT:CONTACT:SET: \2%s\2 on \2%s\2 to %s", entity(mu)->name, p->name, "primary");
command_success_nodata(si, _("\2%s\2 is now considered a primary contact for project \2%s\2."), entity(mu)->name, p->name);

myuser_notice(projectsvs.me, mu, "Your status as a contact for the \2%s\2 project "
"has changed (now primary).", p->name);
}

if (!change_visible && !change_secondary)
Expand All @@ -190,6 +206,10 @@ static void cmd_contact(sourceinfo_t *si, int parc, char *parv[])
{
logcommand(si, CMDLOG_ADMIN, "PROJECT:CONTACT:DEL: \2%s\2 from \2%s\2", entity(mu)->name, p->name);
command_success_nodata(si, _("\2%s\2 was removed as a contact for project \2%s\2."), entity(mu)->name, p->name);

myuser_notice(projectsvs.me, mu, "You have been removed as a contact for the \2%s\2 project.",
p->name);

if (!p->contacts.count)
command_success_nodata(si, _("The project \2%s\2 now has no contacts."), p->name);
}
Expand Down
3 changes: 3 additions & 0 deletions projectns/main/objects.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,9 @@ void project_destroy(struct projectns * const p)
MOWGLI_ITER_FOREACH_SAFE(n, tn, p->contacts.head)
{
struct project_contact *contact = n->data;

myuser_notice(projectsvs.me, contact->mu, "You have been removed as a contact for the \2%s\2 project "
"(project no longer exists).", p->name);
contact_destroy(p, contact->mu);
}

Expand Down