You can use the $menu identifier to refer to the menu that is about to pop up or that is assocaited with the script being performed. This allows you to modify the form of the popup based on whether it's a query, channel, etc. popup menu:
menu query,nicklist {
$iif($menu == nicklist,Op):/mode # +o $$1
}